@syntrologie/runtime-sdk 2.8.0-canary.151 → 2.8.0-canary.152

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.
@@ -299,7 +299,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
299
299
  </div>
300
300
  `:J}
301
301
  </div>
302
- `}};ea.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",ea);var ow={mount(r,e){let{runtime:t,instanceId:n="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:n}),r.appendChild(s),()=>s.remove()}},Og={id:"adaptive-faq",version:"2.0.0",name:"FAQ Accordion",description:"Collapsible Q&A accordion with actions, rich content, feedback, and personalization",executors:hg,widgets:[{id:"adaptive-faq:accordion",component:ow,metadata:{name:"FAQ Accordion",description:"Collapsible Q&A accordion with search, categories, and feedback",icon:"\u2753",subtitle:"Curated just for you."}}],notifyWatchers(r){return(r.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 aw='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"',Pg={"\u{1F4B5}":['<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"/>'],"\u{1F3DB}\uFE0F":['<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"/>'],"\u23ED\uFE0F":['<polygon points="5 4 15 12 5 20 5 4"/>','<line x1="19" x2="19" y1="5" y2="19"/>'],"\u27A1\uFE0F":['<path d="M5 12h14"/>','<path d="m12 5 7 7-7 7"/>'],"\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 width="20" height="12" x="2" y="6" rx="2"/>','<circle cx="12" cy="12" r="2"/>','<path d="M6 12h.01M18 12h.01"/>'],"\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"/>','<path d="m9 11 3 3L22 4"/>'],"\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-3"/>','<path d="M12 9v4"/>','<path d="M12 17h.01"/>'],"\u{1F6E1}\uFE0F":['<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>'],"\u{1F4C8}":['<polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/>','<polyline points="16 7 22 7 22 13"/>'],"\u{1F52C}":['<path d="M6 18h8"/>','<path d="M3 22h18"/>','<path d="M14 22a7 7 0 1 0 0-14h-1"/>','<path d="M9 14h2"/>','<path d="M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z"/>','<path d="M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3"/>'],"\u{1F48A}":['<path d="m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z"/>','<path d="m8.5 8.5 7 7"/>'],"\u{1F4C4}":['<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/>','<path d="M14 2v4a2 2 0 0 0 2 2h4"/>','<path d="M10 9H8"/>','<path d="M16 13H8"/>','<path d="M16 17H8"/>'],"\u{1F9EA}":['<path d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2"/>','<path d="M6.453 15h11.094"/>','<path d="M8.5 2h7"/>'],"\u{1F501}":['<path d="m17 2 4 4-4 4"/>','<path d="M3 11v-1a4 4 0 0 1 4-4h14"/>','<path d="m7 22-4-4 4-4"/>','<path d="M21 13v1a4 4 0 0 1-4 4H3"/>'],"\u{1F9E0}":['<path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/>','<path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/>','<path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/>','<path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/>','<path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/>','<path d="M3.477 10.896a4 4 0 0 1 .585-.396"/>','<path d="M19.938 10.5a4 4 0 0 1 .585.396"/>','<path d="M6 18a4 4 0 0 1-1.967-.516"/>','<path d="M19.967 17.484A4 4 0 0 1 18 18"/>'],"\u{1F319}":['<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>'],"\u{1F4E6}":['<path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"/>','<path d="M12 22V12"/>','<path d="m3.3 7 8.7 5 8.7-5"/>','<path d="m7.5 4.27 9 5.15"/>'],"\u{1F331}":['<path d="M7 20h10"/>','<path d="M10 20c5.5-2.5.8-6.4 3-10"/>','<path d="M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z"/>','<path d="M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z"/>'],"\u26A1":['<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>'],"\u{1F333}":['<path d="M12 22V8"/>','<path d="m17 8-5-6-5 6"/>','<path d="M12 12c-2-2-4-2-4-2 0 0 0 4 2 6 1.5 1.5 3 1 4 0"/>','<path d="M12 12c2-2 4-2 4-2 0 0 0 4-2 6-1.5 1.5-3 1-4 0"/>'],"\u{1F33F}":['<path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19.2 2.96a1 1 0 0 1 1.8.5c0 6-2 11-9 16.5"/>','<path d="M2 21c0-3 1.85-5.36 5.08-6"/>'],"\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"/>'],"\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"/>'],"\u{1F393}":['<path d="M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z"/>','<path d="M22 10v6"/>','<path d="M6 12.5V16a6 3 0 0 0 12 0v-3.5"/>'],"\u23F0":['<circle cx="12" cy="13" r="8"/>','<path d="M12 9v4l2 2"/>','<path d="M5 3 2 6"/>','<path d="m22 6-3-3"/>','<path d="M6.38 18.7 4 21"/>','<path d="M17.64 18.67 20 21"/>'],"\u{1F504}":['<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/>','<path d="M21 3v5h-5"/>','<path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/>','<path d="M8 16H3v5"/>'],"\u{1F464}":['<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/>','<circle cx="12" cy="7" r="4"/>'],"\u{1F3E0}":['<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/>','<path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>'],"\u{1F6D2}":['<circle cx="8" cy="21" r="1"/>','<circle cx="19" cy="21" r="1"/>','<path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"/>'],"\u{1F4CA}":['<path d="M3 3v18h18"/>','<path d="M18 17V9"/>','<path d="M13 17V5"/>','<path d="M8 17v-3"/>'],"\u{1F4C9}":['<polyline points="22 17 13.5 8.5 8.5 13.5 2 7"/>','<polyline points="16 17 22 17 22 11"/>'],"\u{1F967}":['<path d="M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z"/>','<path d="M21.21 15.89A10 10 0 1 1 8 2.83"/>'],"\u{1F4B9}":['<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.5.5 0 0 1-.96 0L9.24 2.18a.5.5 0 0 0-.96 0l-2.35 8.36A2 2 0 0 1 4.02 12H2"/>'],"\u{1F321}\uFE0F":['<path d="M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z"/>']};function nn(r,e={}){let t=Pg[r];if(!t)return"";let n=e.size??14,i=e.color??"currentColor";return`${aw} width="${n}" height="${n}" stroke="${i}">${t.join("")}</svg>`}var d={};Zb(d,{BRAND:()=>Ow,DIRTY:()=>sn,EMPTY_PATH:()=>dw,INVALID:()=>Q,NEVER:()=>vk,OK:()=>Ge,ParseStatus:()=>We,Schema:()=>oe,ZodAny:()=>Sr,ZodArray:()=>tr,ZodBigInt:()=>an,ZodBoolean:()=>ln,ZodBranded:()=>is,ZodCatch:()=>_n,ZodDate:()=>cn,ZodDefault:()=>yn,ZodDiscriminatedUnion:()=>na,ZodEffects:()=>vt,ZodEnum:()=>mn,ZodError:()=>rt,ZodFirstPartyTypeKind:()=>ee,ZodFunction:()=>sa,ZodIntersection:()=>hn,ZodIssueCode:()=>T,ZodLazy:()=>fn,ZodLiteral:()=>gn,ZodMap:()=>Xn,ZodNaN:()=>Qn,ZodNativeEnum:()=>vn,ZodNever:()=>Mt,ZodNull:()=>dn,ZodNullable:()=>Bt,ZodNumber:()=>on,ZodObject:()=>nt,ZodOptional:()=>gt,ZodParsedType:()=>W,ZodPipeline:()=>ss,ZodPromise:()=>Er,ZodReadonly:()=>bn,ZodRecord:()=>ia,ZodSchema:()=>oe,ZodSet:()=>Jn,ZodString:()=>kr,ZodSymbol:()=>Kn,ZodTransformer:()=>vt,ZodTuple:()=>Ht,ZodType:()=>oe,ZodUndefined:()=>un,ZodUnion:()=>pn,ZodUnknown:()=>er,ZodVoid:()=>Yn,addIssueToContext:()=>F,any:()=>jw,array:()=>qw,bigint:()=>Fw,boolean:()=>zg,coerce:()=>mk,custom:()=>jg,date:()=>Dw,datetimeRegex:()=>Bg,defaultErrorMap:()=>Jt,discriminatedUnion:()=>Yw,effect:()=>lk,enum:()=>sk,function:()=>rk,getErrorMap:()=>qn,getParsedType:()=>Dt,instanceof:()=>Nw,intersection:()=>Xw,isAborted:()=>ta,isAsync:()=>Zn,isDirty:()=>ra,isValid:()=>wr,late:()=>Pw,lazy:()=>nk,literal:()=>ik,makeIssue:()=>ns,map:()=>ek,nan:()=>Lw,nativeEnum:()=>ok,never:()=>Uw,null:()=>Vw,nullable:()=>uk,number:()=>Ug,object:()=>Zw,objectUtil:()=>Lc,oboolean:()=>gk,onumber:()=>fk,optional:()=>ck,ostring:()=>hk,pipeline:()=>pk,preprocess:()=>dk,promise:()=>ak,quotelessJson:()=>lw,record:()=>Qw,set:()=>tk,setErrorMap:()=>uw,strictObject:()=>Gw,string:()=>Wg,symbol:()=>Hw,transformer:()=>lk,tuple:()=>Jw,undefined:()=>Bw,union:()=>Kw,unknown:()=>Ww,util:()=>ae,void:()=>zw});var ae;(function(r){r.assertEqual=i=>{};function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{let s={};for(let o of i)s[o]=o;return s},r.getValidEnumValues=i=>{let s=r.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of s)o[a]=i[a];return r.objectValues(o)},r.objectValues=i=>r.objectKeys(i).map(function(s){return i[s]}),r.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},r.find=(i,s)=>{for(let o of i)if(s(o))return o},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}r.joinValues=n,r.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(ae||(ae={}));var Lc;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Lc||(Lc={}));var W=ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Dt=r=>{switch(typeof r){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(r)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(r)?W.array:r===null?W.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?W.promise:typeof Map<"u"&&r instanceof Map?W.map:typeof Set<"u"&&r instanceof Set?W.set:typeof Date<"u"&&r instanceof Date?W.date:W.object;default:return W.unknown}};var T=ae.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"]),lw=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),rt=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};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},n={_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)n._errors.push(t(o));else{let a=n,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),n}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];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 n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};rt.create=r=>new rt(r);var cw=(r,e)=>{let t;switch(r.code){case T.invalid_type:r.received===W.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,ae.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${ae.joinValues(r.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ae.joinValues(r.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${ae.joinValues(r.options)}, received '${r.received}'`;break;case T.invalid_arguments:t="Invalid function arguments";break;case T.invalid_return_type:t="Invalid function return type";break;case T.invalid_date:t="Invalid date";break;case T.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:ae.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case T.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case T.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case T.custom:t="Invalid input";break;case T.invalid_intersection_types:t="Intersection results could not be merged";break;case T.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case T.not_finite:t="Number must be finite";break;default:t=e.defaultError,ae.assertNever(r)}return{message:t}},Jt=cw;var Ng=Jt;function uw(r){Ng=r}function qn(){return Ng}var ns=r=>{let{data:e,path:t,errorMaps:n,issueData:i}=r,s=[...t,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)a=c(o,{data:e,defaultError:a}).message;return{...i,path:s,message:a}},dw=[];function F(r,e){let t=qn(),n=ns({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Jt?void 0:Jt].filter(i=>!!i)});r.common.issues.push(n)}var We=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status==="aborted")return Q;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let i of t){let s=await i.key,o=await i.value;n.push({key:s,value:o})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Q;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[s.value]=o.value)}return{status:e.value,value:n}}},Q=Object.freeze({status:"aborted"}),sn=r=>({status:"dirty",value:r}),Ge=r=>({status:"valid",value:r}),ta=r=>r.status==="aborted",ra=r=>r.status==="dirty",wr=r=>r.status==="valid",Zn=r=>typeof Promise<"u"&&r instanceof Promise;var Z;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(Z||(Z={}));var mt=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,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}},Lg=(r,e)=>{if(wr(e))return{success:!0,data:e.value};if(!r.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(r.common.issues);return this._error=t,this._error}}};function ie(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))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}=r;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??t??a.defaultError}},description:i}}var oe=class{get description(){return this._def.description}_getType(e){return Dt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Dt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new We,ctx:{common:e.parent.common,data:e.data,parsedType:Dt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Zn(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dt(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Lg(n,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return wr(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>wr(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dt(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(Zn(i)?i:Promise.resolve(i));return Lg(n,s)}refine(e,t){let n=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:T.custom,...n(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((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new vt({schema:this,typeName:ee.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 gt.create(this,this._def)}nullable(){return Bt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return tr.create(this)}promise(){return Er.create(this,this._def)}or(e){return pn.create([this,e],this._def)}and(e){return hn.create(this,e,this._def)}transform(e){return new vt({...ie(this._def),schema:this,typeName:ee.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new yn({...ie(this._def),innerType:this,defaultValue:t,typeName:ee.ZodDefault})}brand(){return new is({typeName:ee.ZodBranded,type:this,...ie(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new _n({...ie(this._def),innerType:this,catchValue:t,typeName:ee.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ss.create(this,e)}readonly(){return bn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},pw=/^c[^\s-]{8,}$/i,hw=/^[0-9a-z]+$/,fw=/^[0-9A-HJKMNP-TV-Z]{26}$/i,gw=/^[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,mw=/^[a-z0-9_-]{21}$/i,vw=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yw=/^[-+]?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)?)??$/,_w=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,bw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Fc,xw=/^(?:(?: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])$/,ww=/^(?:(?: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])$/,kw=/^(([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]))$/,Sw=/^(([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])$/,Ew=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Cw=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Dg="((\\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])))",Aw=new RegExp(`^${Dg}$`);function Hg(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Rw(r){return new RegExp(`^${Hg(r)}$`)}function Bg(r){let e=`${Dg}T${Hg(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Tw(r,e){return!!((e==="v4"||!e)&&xw.test(r)||(e==="v6"||!e)&&kw.test(r))}function Iw(r,e){if(!vw.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function $w(r,e){return!!((e==="v4"||!e)&&ww.test(r)||(e==="v6"||!e)&&Sw.test(r))}var kr=class r extends oe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_type,expected:W.string,received:s.parsedType}),Q}let n=new We,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.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?F(i,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&F(i,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")_w.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"email",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Fc||(Fc=new RegExp(bw,"u")),Fc.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"emoji",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")gw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"uuid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")mw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"nanoid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")pw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"cuid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")hw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"cuid2",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")fw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"ulid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),F(i,{validation:"url",code:T.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"regex",code:T.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.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),F(i,{code:T.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Bg(s).test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Aw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Rw(s).test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?yw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"duration",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Tw(e.data,s.version)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"ip",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Iw(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"jwt",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?$w(e.data,s.version)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"cidr",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Ew.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"base64",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Cw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"base64url",code:T.invalid_string,message:s.message}),n.dirty()):ae.assertNever(s);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:T.invalid_string,...Z.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Z.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,...Z.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,...Z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Z.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Z.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Z.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Z.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Z.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Z.errToObj(t)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...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}};kr.create=r=>new kr({checks:[],typeName:ee.ZodString,coerce:r?.coerce??!1,...ie(r)});function Mw(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,s=Number.parseInt(r.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return s%o/10**i}var on=class r extends oe{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)!==W.number){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_type,expected:W.number,received:s.parsedType}),Q}let n,i=new We;for(let s of this._def.checks)s.kind==="int"?ae.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:T.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.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)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Mw(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:T.not_finite,message:s.message}),i.dirty()):ae.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Z.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Z.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Z.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"&&ae.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};on.create=r=>new on({checks:[],typeName:ee.ZodNumber,coerce:r?.coerce||!1,...ie(r)});var an=class r extends oe{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)!==W.bigint)return this._getInvalidInput(e);let n,i=new We;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.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)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):ae.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return F(t,{code:T.invalid_type,expected:W.bigint,received:t.parsedType}),Q}gte(e,t){return this.setLimit("min",e,!0,Z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Z.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Z.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Z.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}};an.create=r=>new an({checks:[],typeName:ee.ZodBigInt,coerce:r?.coerce??!1,...ie(r)});var ln=class extends oe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.boolean,received:n.parsedType}),Q}return Ge(e.data)}};ln.create=r=>new ln({typeName:ee.ZodBoolean,coerce:r?.coerce||!1,...ie(r)});var cn=class r extends oe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_type,expected:W.date,received:s.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_date}),Q}let n=new We,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):ae.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Z.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Z.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}};cn.create=r=>new cn({checks:[],coerce:r?.coerce||!1,typeName:ee.ZodDate,...ie(r)});var Kn=class extends oe{_parse(e){if(this._getType(e)!==W.symbol){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.symbol,received:n.parsedType}),Q}return Ge(e.data)}};Kn.create=r=>new Kn({typeName:ee.ZodSymbol,...ie(r)});var un=class extends oe{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.undefined,received:n.parsedType}),Q}return Ge(e.data)}};un.create=r=>new un({typeName:ee.ZodUndefined,...ie(r)});var dn=class extends oe{_parse(e){if(this._getType(e)!==W.null){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.null,received:n.parsedType}),Q}return Ge(e.data)}};dn.create=r=>new dn({typeName:ee.ZodNull,...ie(r)});var Sr=class extends oe{constructor(){super(...arguments),this._any=!0}_parse(e){return Ge(e.data)}};Sr.create=r=>new Sr({typeName:ee.ZodAny,...ie(r)});var er=class extends oe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ge(e.data)}};er.create=r=>new er({typeName:ee.ZodUnknown,...ie(r)});var Mt=class extends oe{_parse(e){let t=this._getOrReturnCtx(e);return F(t,{code:T.invalid_type,expected:W.never,received:t.parsedType}),Q}};Mt.create=r=>new Mt({typeName:ee.ZodNever,...ie(r)});var Yn=class extends oe{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.void,received:n.parsedType}),Q}return Ge(e.data)}};Yn.create=r=>new Yn({typeName:ee.ZodVoid,...ie(r)});var tr=class r extends oe{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==W.array)return F(t,{code:T.invalid_type,expected:W.array,received:t.parsedType}),Q;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(o||a)&&(F(t,{code:o?T.too_big:T.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}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(F(t,{code:T.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(F(t,{code:T.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>i.type._parseAsync(new mt(t,o,t.path,a)))).then(o=>We.mergeArray(n,o));let s=[...t.data].map((o,a)=>i.type._parseSync(new mt(t,o,t.path,a)));return We.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:Z.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:Z.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:Z.toString(t)}})}nonempty(e){return this.min(1,e)}};tr.create=(r,e)=>new tr({type:r,minLength:null,maxLength:null,exactLength:null,typeName:ee.ZodArray,...ie(e)});function Gn(r){if(r instanceof nt){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=gt.create(Gn(n))}return new nt({...r._def,shape:()=>e})}else return r instanceof tr?new tr({...r._def,type:Gn(r.element)}):r instanceof gt?gt.create(Gn(r.unwrap())):r instanceof Bt?Bt.create(Gn(r.unwrap())):r instanceof Ht?Ht.create(r.items.map(e=>Gn(e))):r}var nt=class r extends oe{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=ae.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==W.object){let c=this._getOrReturnCtx(e);return F(c,{code:T.invalid_type,expected:W.object,received:c.parsedType}),Q}let{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Mt&&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],p=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new mt(i,p,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Mt){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&&(F(i,{code:T.unrecognized_keys,keys:a}),n.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 p=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new mt(i,p,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,h=await u.value;c.push({key:p,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>We.mergeObjectSync(n,c)):We.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return Z.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let i=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:Z.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ee.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let n of ae.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let n of ae.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}deepPartial(){return Gn(this)}partial(e){let t={};for(let n of ae.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let n of ae.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof gt;)s=s._def.innerType;t[n]=s}return new r({...this._def,shape:()=>t})}keyof(){return Vg(ae.objectKeys(this.shape))}};nt.create=(r,e)=>new nt({shape:()=>r,unknownKeys:"strip",catchall:Mt.create(),typeName:ee.ZodObject,...ie(e)});nt.strictCreate=(r,e)=>new nt({shape:()=>r,unknownKeys:"strict",catchall:Mt.create(),typeName:ee.ZodObject,...ie(e)});nt.lazycreate=(r,e)=>new nt({shape:r,unknownKeys:"strip",catchall:Mt.create(),typeName:ee.ZodObject,...ie(e)});var pn=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n=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 F(t,{code:T.invalid_union,unionErrors:o}),Q}if(t.common.async)return Promise.all(n.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 n){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 F(t,{code:T.invalid_union,unionErrors:a}),Q}}get options(){return this._def.options}};pn.create=(r,e)=>new pn({options:r,typeName:ee.ZodUnion,...ie(e)});var Qt=r=>r instanceof fn?Qt(r.schema):r instanceof vt?Qt(r.innerType()):r instanceof gn?[r.value]:r instanceof mn?r.options:r instanceof vn?ae.objectValues(r.enum):r instanceof yn?Qt(r._def.innerType):r instanceof un?[void 0]:r instanceof dn?[null]:r instanceof gt?[void 0,...Qt(r.unwrap())]:r instanceof Bt?[null,...Qt(r.unwrap())]:r instanceof is||r instanceof bn?Qt(r.unwrap()):r instanceof _n?Qt(r._def.innerType):[],na=class r extends oe{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.object)return F(t,{code:T.invalid_type,expected:W.object,received:t.parsedType}),Q;let n=this.discriminator,i=t.data[n],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}):(F(t,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let i=new Map;for(let s of t){let o=Qt(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 r({typeName:ee.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...ie(n)})}};function Dc(r,e){let t=Dt(r),n=Dt(e);if(r===e)return{valid:!0,data:r};if(t===W.object&&n===W.object){let i=ae.objectKeys(e),s=ae.objectKeys(r).filter(a=>i.indexOf(a)!==-1),o={...r,...e};for(let a of s){let l=Dc(r[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===W.array&&n===W.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let s=0;s<r.length;s++){let o=r[s],a=e[s],l=Dc(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===W.date&&n===W.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var hn=class extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(s,o)=>{if(ta(s)||ta(o))return Q;let a=Dc(s.value,o.value);return a.valid?((ra(s)||ra(o))&&t.dirty(),{status:t.value,value:a.data}):(F(n,{code:T.invalid_intersection_types}),Q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};hn.create=(r,e,t)=>new hn({left:r,right:e,typeName:ee.ZodIntersection,...ie(t)});var Ht=class r extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.array)return F(n,{code:T.invalid_type,expected:W.array,received:n.parsedType}),Q;if(n.data.length<this._def.items.length)return F(n,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&n.data.length>this._def.items.length&&(F(n,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...n.data].map((o,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new mt(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>We.mergeArray(t,o)):We.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};Ht.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ht({items:r,typeName:ee.ZodTuple,rest:null,...ie(e)})};var ia=class r extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.object)return F(n,{code:T.invalid_type,expected:W.object,received:n.parsedType}),Q;let i=[],s=this._def.keyType,o=this._def.valueType;for(let a in n.data)i.push({key:s._parse(new mt(n,a,n.path,a)),value:o._parse(new mt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?We.mergeObjectAsync(t,i):We.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof oe?new r({keyType:e,valueType:t,typeName:ee.ZodRecord,...ie(n)}):new r({keyType:kr.create(),valueType:e,typeName:ee.ZodRecord,...ie(t)})}},Xn=class extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.map)return F(n,{code:T.invalid_type,expected:W.map,received:n.parsedType}),Q;let i=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([a,l],c)=>({key:i._parse(new mt(n,a,n.path,[c,"key"])),value:s._parse(new mt(n,l,n.path,[c,"value"]))}));if(n.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 Q;(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 Q;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}}}};Xn.create=(r,e,t)=>new Xn({valueType:e,keyType:r,typeName:ee.ZodMap,...ie(t)});var Jn=class r extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.set)return F(n,{code:T.invalid_type,expected:W.set,received:n.parsedType}),Q;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(F(n,{code:T.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(F(n,{code:T.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 Q;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}let a=[...n.data.values()].map((l,c)=>s._parse(new mt(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,t){return new r({...this._def,minSize:{value:e,message:Z.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:Z.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Jn.create=(r,e)=>new Jn({valueType:r,minSize:null,maxSize:null,typeName:ee.ZodSet,...ie(e)});var sa=class r extends oe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.function)return F(t,{code:T.invalid_type,expected:W.function,received:t.parsedType}),Q;function n(a,l){return ns({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,qn(),Jt].filter(c=>!!c),issueData:{code:T.invalid_arguments,argumentsError:l}})}function i(a,l){return ns({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,qn(),Jt].filter(c=>!!c),issueData:{code:T.invalid_return_type,returnTypeError:l}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Er){let a=this;return Ge(async function(...l){let c=new rt([]),u=await a._def.args.parseAsync(l,s).catch(f=>{throw c.addIssue(n(l,f)),c}),p=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(p,s).catch(f=>{throw c.addIssue(i(p,f)),c})})}else{let a=this;return Ge(function(...l){let c=a._def.args.safeParse(l,s);if(!c.success)throw new rt([n(l,c.error)]);let u=Reflect.apply(o,this,c.data),p=a._def.returns.safeParse(u,s);if(!p.success)throw new rt([i(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Ht.create(e).rest(er.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||Ht.create([]).rest(er.create()),returns:t||er.create(),typeName:ee.ZodFunction,...ie(n)})}},fn=class extends oe{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})}};fn.create=(r,e)=>new fn({getter:r,typeName:ee.ZodLazy,...ie(e)});var gn=class extends oe{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return F(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};gn.create=(r,e)=>new gn({value:r,typeName:ee.ZodLiteral,...ie(e)});function Vg(r,e){return new mn({values:r,typeName:ee.ZodEnum,...ie(e)})}var mn=class r extends oe{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return F(t,{expected:ae.joinValues(n),received:t.parsedType,code:T.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return F(t,{received:t.data,code:T.invalid_enum_value,options:n}),Q}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 r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};mn.create=Vg;var vn=class extends oe{_parse(e){let t=ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==W.string&&n.parsedType!==W.number){let i=ae.objectValues(t);return F(n,{expected:ae.joinValues(i),received:n.parsedType,code:T.invalid_type}),Q}if(this._cache||(this._cache=new Set(ae.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ae.objectValues(t);return F(n,{received:n.data,code:T.invalid_enum_value,options:i}),Q}return Ge(e.data)}get enum(){return this._def.values}};vn.create=(r,e)=>new vn({values:r,typeName:ee.ZodNativeEnum,...ie(e)});var Er=class extends oe{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.promise&&t.common.async===!1)return F(t,{code:T.invalid_type,expected:W.promise,received:t.parsedType}),Q;let n=t.parsedType===W.promise?t.data:Promise.resolve(t.data);return Ge(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Er.create=(r,e)=>new Er({type:r,typeName:ee.ZodPromise,...ie(e)});var vt=class extends oe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ee.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{F(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let o=i.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return Q;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?Q:l.status==="dirty"?sn(l.value):t.value==="dirty"?sn(l.value):l});{if(t.value==="aborted")return Q;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?Q:a.status==="dirty"?sn(a.value):t.value==="dirty"?sn(a.value):a}}if(i.type==="refinement"){let o=a=>{let l=i.refinement(a,s);if(n.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(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Q:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Q:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!wr(o))return Q;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:n.data,path:n.path,parent:n}).then(o=>wr(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:t.value,value:a})):Q);ae.assertNever(i)}};vt.create=(r,e,t)=>new vt({schema:r,typeName:ee.ZodEffects,effect:e,...ie(t)});vt.createWithPreprocess=(r,e,t)=>new vt({schema:e,effect:{type:"preprocess",transform:r},typeName:ee.ZodEffects,...ie(t)});var gt=class extends oe{_parse(e){return this._getType(e)===W.undefined?Ge(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gt.create=(r,e)=>new gt({innerType:r,typeName:ee.ZodOptional,...ie(e)});var Bt=class extends oe{_parse(e){return this._getType(e)===W.null?Ge(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bt.create=(r,e)=>new Bt({innerType:r,typeName:ee.ZodNullable,...ie(e)});var yn=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===W.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};yn.create=(r,e)=>new yn({innerType:r,typeName:ee.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var _n=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Zn(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new rt(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new rt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};_n.create=(r,e)=>new _n({innerType:r,typeName:ee.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var Qn=class extends oe{_parse(e){if(this._getType(e)!==W.nan){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.nan,received:n.parsedType}),Q}return{status:"valid",value:e.data}}};Qn.create=r=>new Qn({typeName:ee.ZodNaN,...ie(r)});var Ow=Symbol("zod_brand"),is=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},ss=class r extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Q:s.status==="dirty"?(t.dirty(),sn(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Q:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:ee.ZodPipeline})}},bn=class extends oe{_parse(e){let t=this._def.innerType._parse(e),n=i=>(wr(i)&&(i.value=Object.freeze(i.value)),i);return Zn(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};bn.create=(r,e)=>new bn({innerType:r,typeName:ee.ZodReadonly,...ie(e)});function Fg(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function jg(r,e={},t){return r?Sr.create().superRefine((n,i)=>{let s=r(n);if(s instanceof Promise)return s.then(o=>{if(!o){let a=Fg(e,n),l=a.fatal??t??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!s){let o=Fg(e,n),a=o.fatal??t??!0;i.addIssue({code:"custom",...o,fatal:a})}}):Sr.create()}var Pw={object:nt.lazycreate},ee;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(ee||(ee={}));var Nw=(r,e={message:`Input not instance of ${r.name}`})=>jg(t=>t instanceof r,e),Wg=kr.create,Ug=on.create,Lw=Qn.create,Fw=an.create,zg=ln.create,Dw=cn.create,Hw=Kn.create,Bw=un.create,Vw=dn.create,jw=Sr.create,Ww=er.create,Uw=Mt.create,zw=Yn.create,qw=tr.create,Zw=nt.create,Gw=nt.strictCreate,Kw=pn.create,Yw=na.create,Xw=hn.create,Jw=Ht.create,Qw=ia.create,ek=Xn.create,tk=Jn.create,rk=sa.create,nk=fn.create,ik=gn.create,sk=mn.create,ok=vn.create,ak=Er.create,lk=vt.create,ck=gt.create,uk=Bt.create,dk=vt.createWithPreprocess,pk=ss.create,hk=()=>Wg().optional(),fk=()=>Ug().optional(),gk=()=>zg().optional(),mk={string:(r=>kr.create({...r,coerce:!0})),number:(r=>on.create({...r,coerce:!0})),boolean:(r=>ln.create({...r,coerce:!0})),bigint:(r=>an.create({...r,coerce:!0})),date:(r=>cn.create({...r,coerce:!0}))};var vk=Q;var yk=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),qg=["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"],Zg=d.enum(qg).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),Gg=["time_on_page","page_views","scroll_depth"],Kg=d.enum(Gg).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");var Hc=d.object({type:d.literal("page_url"),url:d.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"}'),Bc=d.object({type:d.literal("route"),routeId:d.string().describe("Named route ID from the route filter")}).describe("Fires when the current route matches a named route ID."),Vc=d.object({type:d.literal("anchor_visible"),anchorId:d.string().describe("CSS selector of the anchor element"),state:d.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"}`),jc=d.object({type:d.literal("event_occurred"),eventName:d.string().describe('Event name (e.g. "ui.click", "$pageview")'),withinMs:d.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}'),Wc=d.object({type:d.literal("state_equals"),key:d.string().describe("Key in the SDK persistent state store (localStorage). Only valid for keys the host app explicitly sets via syntro.state.set()."),value:d.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."),Uc=d.object({type:d.literal("viewport"),minWidth:d.number().optional().describe("Minimum viewport width in pixels"),maxWidth:d.number().optional().describe("Maximum viewport width in pixels"),minHeight:d.number().optional().describe("Minimum viewport height in pixels"),maxHeight:d.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.'),zc=d.object({type:d.literal("session_metric"),key:Kg,operator:d.enum(["gte","lte","eq","gt","lt"]),threshold:d.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}'),qc=d.object({type:d.literal("dismissed"),key:d.string().describe("Dismissal key (usually a tile or action ID)"),inverted:d.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."),Zc=d.object({type:d.literal("cooldown_active"),key:d.string().describe("Cooldown key"),inverted:d.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."),Gc=d.object({type:d.literal("frequency_limit"),key:d.string().describe("Frequency counter key"),limit:d.number().describe("Maximum allowed count"),inverted:d.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."),os=d.object({equals:d.union([d.string(),d.number(),d.boolean()]).optional(),contains:d.string().optional()}).describe("Match operator for counter filters. Exactly one of equals or contains must be specified."),as=d.object({events:d.array(Zg).min(1).describe("Event names to count. Use values from the countable events enum."),match:d.record(d.string(),os).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."),Kc=d.object({type:d.literal("event_count"),key:d.string().describe("Unique key for this counter (used for accumulator registration)"),operator:d.enum(["gte","lte","eq","gt","lt"]),count:d.number().int().min(0).describe("Target count threshold"),withinMs:d.number().positive().optional().describe("Time window in ms. Omit = count across entire session."),counter:as.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"}}}}'),Cr=d.discriminatedUnion("type",[Hc,Bc,Vc,jc,Wc,Uc,zc,qc,Zc,Gc,Kc]),ls=d.object({conditions:d.array(Cr).describe("Array of conditions \u2014 ALL must match (AND logic) for this rule to fire."),value:d.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."),cs=d.object({type:d.literal("rules"),rules:d.array(ls).describe("Ordered list of rules. Evaluated top-to-bottom \u2014 first match wins."),default:d.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."),us=d.object({type:d.literal("score"),field:d.string(),threshold:d.number(),above:d.unknown(),below:d.unknown()}).describe("Score-based strategy. Compares a field value against a threshold."),ds=d.object({type:d.literal("model"),modelId:d.string(),inputs:d.array(d.string()),outputMapping:d.record(d.string(),d.unknown()),default:d.unknown()}).describe("ML model strategy. Sends inputs to a model and maps outputs."),ps=d.object({type:d.literal("external"),endpoint:d.string(),method:d.enum(["GET","POST"]).optional(),default:d.unknown(),timeoutMs:d.number().optional()}).describe("External API strategy. Calls an endpoint to determine the value."),hs=d.discriminatedUnion("type",[cs,us,ds,ps]),oa=hs.nullable().optional();var _k=d.object({events:d.array(d.string()),urlContains:d.string().optional(),props:d.record(d.union([d.string(),d.number(),d.boolean()])).optional()}),bk=d.object({title:d.string().optional(),body:d.string().optional(),icon:d.string().optional()}).nullable().optional();function Yg(r){let{href:e,external:t,windowOrigin:n,isIframe:i}=r;if(i||n==="null")return{kind:"open",url:e};if(t)return{kind:"open",url:e};let o;try{o=new URL(e,n)}catch{return{kind:"fullnav",url:e}}return o.origin!==n?{kind:"fullnav",url:o.toString()}:{kind:"spa",url:o}}function Xg(){if(typeof window>"u")return!1;try{return window!==window.top}catch{return!0}}var Fe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},aa=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},De,gs,ms,Yc,Xc,sm,Jc,Jg,Qg,em,fs,Qc,xk="#6a59ce",tm="#677384",rm="#87919f";function wk(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function kk(r){return nn(r)||wk(r)}function nm(r){if(typeof window>"u")return!1;let e=window.location.pathname;return r.some(t=>{let n=t.split("?")[0].split("#")[0];return n.endsWith("/**")?e.startsWith(n.slice(0,-3)):e===n})}function Sk(r){let e=[{boxShadow:"0 0 0 0 rgba(13, 148, 136, 0.5)"},{boxShadow:"0 0 0 8px rgba(13, 148, 136, 0)"}];r.animate(e,{duration:600,iterations:3,easing:"ease-out"})}function Ek(r){return r==="dark"?"dark":r==="light"?"light":typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var la=class extends he{constructor(){super(...arguments),De.add(this),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,gs.set(this,null),ms.set(this,null)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Fe(this,De,"m",Yc).call(this)}disconnectedCallback(){super.disconnectedCallback(),Fe(this,De,"m",Xc).call(this)}updated(e){e.has("runtime")&&(Fe(this,De,"m",Xc).call(this),Fe(this,De,"m",Yc).call(this))}render(){let e=Fe(this,De,"m",sm).call(this),t=Fe(this,De,"m",Jc).call(this),n=I({fontFamily:"var(--sc-font-family, system-ui, -apple-system, sans-serif)",maxWidth:"100%",overflow:"hidden",backgroundColor:"transparent",color:"inherit"}),i=I({display:"flex",flexDirection:"column",gap:"var(--sc-content-item-gap, 6px)"}),s=I({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:t==="dark"?rm:tm}),o=I({fontSize:"13px",padding:"16px",textAlign:"center",color:t==="dark"?tm:rm});if(e.length===0)return j`
302
+ `}};ea.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",ea);var ow={mount(r,e){let{runtime:t,instanceId:n="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:n}),r.appendChild(s),()=>s.remove()}},Og={id:"adaptive-faq",version:"2.0.0",name:"FAQ Accordion",description:"Collapsible Q&A accordion with actions, rich content, feedback, and personalization",executors:hg,widgets:[{id:"adaptive-faq:accordion",component:ow,metadata:{name:"FAQ Accordion",description:"Collapsible Q&A accordion with search, categories, and feedback",icon:"\u2753",subtitle:"Curated just for you."}}],notifyWatchers(r){return(r.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 aw='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"',Pg={"\u{1F4B5}":['<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"/>'],"\u{1F3DB}\uFE0F":['<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"/>'],"\u23ED\uFE0F":['<polygon points="5 4 15 12 5 20 5 4"/>','<line x1="19" x2="19" y1="5" y2="19"/>'],"\u27A1\uFE0F":['<path d="M5 12h14"/>','<path d="m12 5 7 7-7 7"/>'],"\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 width="20" height="12" x="2" y="6" rx="2"/>','<circle cx="12" cy="12" r="2"/>','<path d="M6 12h.01M18 12h.01"/>'],"\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"/>','<path d="m9 11 3 3L22 4"/>'],"\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-3"/>','<path d="M12 9v4"/>','<path d="M12 17h.01"/>'],"\u{1F6E1}\uFE0F":['<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>'],"\u{1F4C8}":['<polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/>','<polyline points="16 7 22 7 22 13"/>'],"\u{1F52C}":['<path d="M6 18h8"/>','<path d="M3 22h18"/>','<path d="M14 22a7 7 0 1 0 0-14h-1"/>','<path d="M9 14h2"/>','<path d="M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z"/>','<path d="M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3"/>'],"\u{1F48A}":['<path d="m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z"/>','<path d="m8.5 8.5 7 7"/>'],"\u{1F4C4}":['<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/>','<path d="M14 2v4a2 2 0 0 0 2 2h4"/>','<path d="M10 9H8"/>','<path d="M16 13H8"/>','<path d="M16 17H8"/>'],"\u{1F9EA}":['<path d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2"/>','<path d="M6.453 15h11.094"/>','<path d="M8.5 2h7"/>'],"\u{1F501}":['<path d="m17 2 4 4-4 4"/>','<path d="M3 11v-1a4 4 0 0 1 4-4h14"/>','<path d="m7 22-4-4 4-4"/>','<path d="M21 13v1a4 4 0 0 1-4 4H3"/>'],"\u{1F9E0}":['<path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"/>','<path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"/>','<path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4"/>','<path d="M17.599 6.5a3 3 0 0 0 .399-1.375"/>','<path d="M6.003 5.125A3 3 0 0 0 6.401 6.5"/>','<path d="M3.477 10.896a4 4 0 0 1 .585-.396"/>','<path d="M19.938 10.5a4 4 0 0 1 .585.396"/>','<path d="M6 18a4 4 0 0 1-1.967-.516"/>','<path d="M19.967 17.484A4 4 0 0 1 18 18"/>'],"\u{1F319}":['<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>'],"\u{1F4E6}":['<path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"/>','<path d="M12 22V12"/>','<path d="m3.3 7 8.7 5 8.7-5"/>','<path d="m7.5 4.27 9 5.15"/>'],"\u{1F331}":['<path d="M7 20h10"/>','<path d="M10 20c5.5-2.5.8-6.4 3-10"/>','<path d="M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z"/>','<path d="M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z"/>'],"\u26A1":['<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>'],"\u{1F525}":['<path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"/>'],"\u{1F333}":['<path d="M12 22V8"/>','<path d="m17 8-5-6-5 6"/>','<path d="M12 12c-2-2-4-2-4-2 0 0 0 4 2 6 1.5 1.5 3 1 4 0"/>','<path d="M12 12c2-2 4-2 4-2 0 0 0 4-2 6-1.5 1.5-3 1-4 0"/>'],"\u{1F33F}":['<path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19.2 2.96a1 1 0 0 1 1.8.5c0 6-2 11-9 16.5"/>','<path d="M2 21c0-3 1.85-5.36 5.08-6"/>'],"\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"/>'],"\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"/>'],"\u{1F393}":['<path d="M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z"/>','<path d="M22 10v6"/>','<path d="M6 12.5V16a6 3 0 0 0 12 0v-3.5"/>'],"\u23F0":['<circle cx="12" cy="13" r="8"/>','<path d="M12 9v4l2 2"/>','<path d="M5 3 2 6"/>','<path d="m22 6-3-3"/>','<path d="M6.38 18.7 4 21"/>','<path d="M17.64 18.67 20 21"/>'],"\u{1F504}":['<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/>','<path d="M21 3v5h-5"/>','<path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/>','<path d="M8 16H3v5"/>'],"\u{1F464}":['<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/>','<circle cx="12" cy="7" r="4"/>'],"\u{1F3E0}":['<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/>','<path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>'],"\u{1F6D2}":['<circle cx="8" cy="21" r="1"/>','<circle cx="19" cy="21" r="1"/>','<path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"/>'],"\u{1F4CA}":['<path d="M3 3v18h18"/>','<path d="M18 17V9"/>','<path d="M13 17V5"/>','<path d="M8 17v-3"/>'],"\u{1F4C9}":['<polyline points="22 17 13.5 8.5 8.5 13.5 2 7"/>','<polyline points="16 17 22 17 22 11"/>'],"\u{1F967}":['<path d="M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z"/>','<path d="M21.21 15.89A10 10 0 1 1 8 2.83"/>'],"\u{1F4B9}":['<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.5.5 0 0 1-.96 0L9.24 2.18a.5.5 0 0 0-.96 0l-2.35 8.36A2 2 0 0 1 4.02 12H2"/>'],"\u{1F321}\uFE0F":['<path d="M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z"/>']};function nn(r,e={}){let t=Pg[r];if(!t)return"";let n=e.size??14,i=e.color??"currentColor";return`${aw} width="${n}" height="${n}" stroke="${i}">${t.join("")}</svg>`}var d={};Zb(d,{BRAND:()=>Ow,DIRTY:()=>sn,EMPTY_PATH:()=>dw,INVALID:()=>Q,NEVER:()=>vk,OK:()=>Ge,ParseStatus:()=>We,Schema:()=>oe,ZodAny:()=>Sr,ZodArray:()=>tr,ZodBigInt:()=>an,ZodBoolean:()=>ln,ZodBranded:()=>is,ZodCatch:()=>_n,ZodDate:()=>cn,ZodDefault:()=>yn,ZodDiscriminatedUnion:()=>na,ZodEffects:()=>vt,ZodEnum:()=>mn,ZodError:()=>rt,ZodFirstPartyTypeKind:()=>ee,ZodFunction:()=>sa,ZodIntersection:()=>hn,ZodIssueCode:()=>T,ZodLazy:()=>fn,ZodLiteral:()=>gn,ZodMap:()=>Xn,ZodNaN:()=>Qn,ZodNativeEnum:()=>vn,ZodNever:()=>Mt,ZodNull:()=>dn,ZodNullable:()=>Bt,ZodNumber:()=>on,ZodObject:()=>nt,ZodOptional:()=>gt,ZodParsedType:()=>W,ZodPipeline:()=>ss,ZodPromise:()=>Er,ZodReadonly:()=>bn,ZodRecord:()=>ia,ZodSchema:()=>oe,ZodSet:()=>Jn,ZodString:()=>kr,ZodSymbol:()=>Kn,ZodTransformer:()=>vt,ZodTuple:()=>Ht,ZodType:()=>oe,ZodUndefined:()=>un,ZodUnion:()=>pn,ZodUnknown:()=>er,ZodVoid:()=>Yn,addIssueToContext:()=>F,any:()=>jw,array:()=>qw,bigint:()=>Fw,boolean:()=>zg,coerce:()=>mk,custom:()=>jg,date:()=>Dw,datetimeRegex:()=>Bg,defaultErrorMap:()=>Jt,discriminatedUnion:()=>Yw,effect:()=>lk,enum:()=>sk,function:()=>rk,getErrorMap:()=>qn,getParsedType:()=>Dt,instanceof:()=>Nw,intersection:()=>Xw,isAborted:()=>ta,isAsync:()=>Zn,isDirty:()=>ra,isValid:()=>wr,late:()=>Pw,lazy:()=>nk,literal:()=>ik,makeIssue:()=>ns,map:()=>ek,nan:()=>Lw,nativeEnum:()=>ok,never:()=>Uw,null:()=>Vw,nullable:()=>uk,number:()=>Ug,object:()=>Zw,objectUtil:()=>Lc,oboolean:()=>gk,onumber:()=>fk,optional:()=>ck,ostring:()=>hk,pipeline:()=>pk,preprocess:()=>dk,promise:()=>ak,quotelessJson:()=>lw,record:()=>Qw,set:()=>tk,setErrorMap:()=>uw,strictObject:()=>Gw,string:()=>Wg,symbol:()=>Hw,transformer:()=>lk,tuple:()=>Jw,undefined:()=>Bw,union:()=>Kw,unknown:()=>Ww,util:()=>ae,void:()=>zw});var ae;(function(r){r.assertEqual=i=>{};function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{let s={};for(let o of i)s[o]=o;return s},r.getValidEnumValues=i=>{let s=r.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(let a of s)o[a]=i[a];return r.objectValues(o)},r.objectValues=i=>r.objectKeys(i).map(function(s){return i[s]}),r.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},r.find=(i,s)=>{for(let o of i)if(s(o))return o},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}r.joinValues=n,r.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(ae||(ae={}));var Lc;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Lc||(Lc={}));var W=ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Dt=r=>{switch(typeof r){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(r)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(r)?W.array:r===null?W.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?W.promise:typeof Map<"u"&&r instanceof Map?W.map:typeof Set<"u"&&r instanceof Set?W.set:typeof Date<"u"&&r instanceof Date?W.date:W.object;default:return W.unknown}};var T=ae.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"]),lw=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),rt=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};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},n={_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)n._errors.push(t(o));else{let a=n,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),n}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];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 n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};rt.create=r=>new rt(r);var cw=(r,e)=>{let t;switch(r.code){case T.invalid_type:r.received===W.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,ae.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${ae.joinValues(r.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${ae.joinValues(r.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${ae.joinValues(r.options)}, received '${r.received}'`;break;case T.invalid_arguments:t="Invalid function arguments";break;case T.invalid_return_type:t="Invalid function return type";break;case T.invalid_date:t="Invalid date";break;case T.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:ae.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case T.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case T.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case T.custom:t="Invalid input";break;case T.invalid_intersection_types:t="Intersection results could not be merged";break;case T.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case T.not_finite:t="Number must be finite";break;default:t=e.defaultError,ae.assertNever(r)}return{message:t}},Jt=cw;var Ng=Jt;function uw(r){Ng=r}function qn(){return Ng}var ns=r=>{let{data:e,path:t,errorMaps:n,issueData:i}=r,s=[...t,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)a=c(o,{data:e,defaultError:a}).message;return{...i,path:s,message:a}},dw=[];function F(r,e){let t=qn(),n=ns({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Jt?void 0:Jt].filter(i=>!!i)});r.common.issues.push(n)}var We=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status==="aborted")return Q;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let i of t){let s=await i.key,o=await i.value;n.push({key:s,value:o})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Q;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[s.value]=o.value)}return{status:e.value,value:n}}},Q=Object.freeze({status:"aborted"}),sn=r=>({status:"dirty",value:r}),Ge=r=>({status:"valid",value:r}),ta=r=>r.status==="aborted",ra=r=>r.status==="dirty",wr=r=>r.status==="valid",Zn=r=>typeof Promise<"u"&&r instanceof Promise;var Z;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(Z||(Z={}));var mt=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,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}},Lg=(r,e)=>{if(wr(e))return{success:!0,data:e.value};if(!r.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(r.common.issues);return this._error=t,this._error}}};function ie(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))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}=r;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??t??a.defaultError}},description:i}}var oe=class{get description(){return this._def.description}_getType(e){return Dt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Dt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new We,ctx:{common:e.parent.common,data:e.data,parsedType:Dt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Zn(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dt(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Lg(n,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return wr(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>wr(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Dt(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(Zn(i)?i:Promise.resolve(i));return Lg(n,s)}refine(e,t){let n=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:T.custom,...n(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((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new vt({schema:this,typeName:ee.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 gt.create(this,this._def)}nullable(){return Bt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return tr.create(this)}promise(){return Er.create(this,this._def)}or(e){return pn.create([this,e],this._def)}and(e){return hn.create(this,e,this._def)}transform(e){return new vt({...ie(this._def),schema:this,typeName:ee.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new yn({...ie(this._def),innerType:this,defaultValue:t,typeName:ee.ZodDefault})}brand(){return new is({typeName:ee.ZodBranded,type:this,...ie(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new _n({...ie(this._def),innerType:this,catchValue:t,typeName:ee.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ss.create(this,e)}readonly(){return bn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},pw=/^c[^\s-]{8,}$/i,hw=/^[0-9a-z]+$/,fw=/^[0-9A-HJKMNP-TV-Z]{26}$/i,gw=/^[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,mw=/^[a-z0-9_-]{21}$/i,vw=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yw=/^[-+]?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)?)??$/,_w=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,bw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Fc,xw=/^(?:(?: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])$/,ww=/^(?:(?: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])$/,kw=/^(([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]))$/,Sw=/^(([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])$/,Ew=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Cw=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Dg="((\\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])))",Aw=new RegExp(`^${Dg}$`);function Hg(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Rw(r){return new RegExp(`^${Hg(r)}$`)}function Bg(r){let e=`${Dg}T${Hg(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Tw(r,e){return!!((e==="v4"||!e)&&xw.test(r)||(e==="v6"||!e)&&kw.test(r))}function Iw(r,e){if(!vw.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function $w(r,e){return!!((e==="v4"||!e)&&ww.test(r)||(e==="v6"||!e)&&Sw.test(r))}var kr=class r extends oe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_type,expected:W.string,received:s.parsedType}),Q}let n=new We,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.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?F(i,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&F(i,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")_w.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"email",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Fc||(Fc=new RegExp(bw,"u")),Fc.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"emoji",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")gw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"uuid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")mw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"nanoid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")pw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"cuid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")hw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"cuid2",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")fw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"ulid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),F(i,{validation:"url",code:T.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"regex",code:T.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.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),F(i,{code:T.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Bg(s).test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Aw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Rw(s).test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:T.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?yw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"duration",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Tw(e.data,s.version)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"ip",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Iw(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"jwt",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?$w(e.data,s.version)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"cidr",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Ew.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"base64",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Cw.test(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{validation:"base64url",code:T.invalid_string,message:s.message}),n.dirty()):ae.assertNever(s);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:T.invalid_string,...Z.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Z.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,...Z.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,...Z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Z.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Z.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Z.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Z.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Z.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Z.errToObj(t)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...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}};kr.create=r=>new kr({checks:[],typeName:ee.ZodString,coerce:r?.coerce??!1,...ie(r)});function Mw(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,s=Number.parseInt(r.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return s%o/10**i}var on=class r extends oe{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)!==W.number){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_type,expected:W.number,received:s.parsedType}),Q}let n,i=new We;for(let s of this._def.checks)s.kind==="int"?ae.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:T.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.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)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Mw(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),F(n,{code:T.not_finite,message:s.message}),i.dirty()):ae.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Z.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Z.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Z.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"&&ae.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};on.create=r=>new on({checks:[],typeName:ee.ZodNumber,coerce:r?.coerce||!1,...ie(r)});var an=class r extends oe{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)!==W.bigint)return this._getInvalidInput(e);let n,i=new We;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.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)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),F(n,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):ae.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return F(t,{code:T.invalid_type,expected:W.bigint,received:t.parsedType}),Q}gte(e,t){return this.setLimit("min",e,!0,Z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Z.toString(t))}setLimit(e,t,n,i){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Z.toString(i)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Z.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}};an.create=r=>new an({checks:[],typeName:ee.ZodBigInt,coerce:r?.coerce??!1,...ie(r)});var ln=class extends oe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.boolean,received:n.parsedType}),Q}return Ge(e.data)}};ln.create=r=>new ln({typeName:ee.ZodBoolean,coerce:r?.coerce||!1,...ie(r)});var cn=class r extends oe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_type,expected:W.date,received:s.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return F(s,{code:T.invalid_date}),Q}let n=new We,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),F(i,{code:T.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):ae.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Z.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Z.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}};cn.create=r=>new cn({checks:[],coerce:r?.coerce||!1,typeName:ee.ZodDate,...ie(r)});var Kn=class extends oe{_parse(e){if(this._getType(e)!==W.symbol){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.symbol,received:n.parsedType}),Q}return Ge(e.data)}};Kn.create=r=>new Kn({typeName:ee.ZodSymbol,...ie(r)});var un=class extends oe{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.undefined,received:n.parsedType}),Q}return Ge(e.data)}};un.create=r=>new un({typeName:ee.ZodUndefined,...ie(r)});var dn=class extends oe{_parse(e){if(this._getType(e)!==W.null){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.null,received:n.parsedType}),Q}return Ge(e.data)}};dn.create=r=>new dn({typeName:ee.ZodNull,...ie(r)});var Sr=class extends oe{constructor(){super(...arguments),this._any=!0}_parse(e){return Ge(e.data)}};Sr.create=r=>new Sr({typeName:ee.ZodAny,...ie(r)});var er=class extends oe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ge(e.data)}};er.create=r=>new er({typeName:ee.ZodUnknown,...ie(r)});var Mt=class extends oe{_parse(e){let t=this._getOrReturnCtx(e);return F(t,{code:T.invalid_type,expected:W.never,received:t.parsedType}),Q}};Mt.create=r=>new Mt({typeName:ee.ZodNever,...ie(r)});var Yn=class extends oe{_parse(e){if(this._getType(e)!==W.undefined){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.void,received:n.parsedType}),Q}return Ge(e.data)}};Yn.create=r=>new Yn({typeName:ee.ZodVoid,...ie(r)});var tr=class r extends oe{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==W.array)return F(t,{code:T.invalid_type,expected:W.array,received:t.parsedType}),Q;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,a=t.data.length<i.exactLength.value;(o||a)&&(F(t,{code:o?T.too_big:T.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}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(F(t,{code:T.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(F(t,{code:T.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>i.type._parseAsync(new mt(t,o,t.path,a)))).then(o=>We.mergeArray(n,o));let s=[...t.data].map((o,a)=>i.type._parseSync(new mt(t,o,t.path,a)));return We.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:Z.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:Z.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:Z.toString(t)}})}nonempty(e){return this.min(1,e)}};tr.create=(r,e)=>new tr({type:r,minLength:null,maxLength:null,exactLength:null,typeName:ee.ZodArray,...ie(e)});function Gn(r){if(r instanceof nt){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=gt.create(Gn(n))}return new nt({...r._def,shape:()=>e})}else return r instanceof tr?new tr({...r._def,type:Gn(r.element)}):r instanceof gt?gt.create(Gn(r.unwrap())):r instanceof Bt?Bt.create(Gn(r.unwrap())):r instanceof Ht?Ht.create(r.items.map(e=>Gn(e))):r}var nt=class r extends oe{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=ae.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==W.object){let c=this._getOrReturnCtx(e);return F(c,{code:T.invalid_type,expected:W.object,received:c.parsedType}),Q}let{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Mt&&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],p=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new mt(i,p,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Mt){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&&(F(i,{code:T.unrecognized_keys,keys:a}),n.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 p=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new mt(i,p,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,h=await u.value;c.push({key:p,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>We.mergeObjectSync(n,c)):We.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return Z.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let i=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:Z.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ee.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let n of ae.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let n of ae.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}deepPartial(){return Gn(this)}partial(e){let t={};for(let n of ae.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let n of ae.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof gt;)s=s._def.innerType;t[n]=s}return new r({...this._def,shape:()=>t})}keyof(){return Vg(ae.objectKeys(this.shape))}};nt.create=(r,e)=>new nt({shape:()=>r,unknownKeys:"strip",catchall:Mt.create(),typeName:ee.ZodObject,...ie(e)});nt.strictCreate=(r,e)=>new nt({shape:()=>r,unknownKeys:"strict",catchall:Mt.create(),typeName:ee.ZodObject,...ie(e)});nt.lazycreate=(r,e)=>new nt({shape:r,unknownKeys:"strip",catchall:Mt.create(),typeName:ee.ZodObject,...ie(e)});var pn=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n=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 F(t,{code:T.invalid_union,unionErrors:o}),Q}if(t.common.async)return Promise.all(n.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 n){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 F(t,{code:T.invalid_union,unionErrors:a}),Q}}get options(){return this._def.options}};pn.create=(r,e)=>new pn({options:r,typeName:ee.ZodUnion,...ie(e)});var Qt=r=>r instanceof fn?Qt(r.schema):r instanceof vt?Qt(r.innerType()):r instanceof gn?[r.value]:r instanceof mn?r.options:r instanceof vn?ae.objectValues(r.enum):r instanceof yn?Qt(r._def.innerType):r instanceof un?[void 0]:r instanceof dn?[null]:r instanceof gt?[void 0,...Qt(r.unwrap())]:r instanceof Bt?[null,...Qt(r.unwrap())]:r instanceof is||r instanceof bn?Qt(r.unwrap()):r instanceof _n?Qt(r._def.innerType):[],na=class r extends oe{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.object)return F(t,{code:T.invalid_type,expected:W.object,received:t.parsedType}),Q;let n=this.discriminator,i=t.data[n],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}):(F(t,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let i=new Map;for(let s of t){let o=Qt(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 r({typeName:ee.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...ie(n)})}};function Dc(r,e){let t=Dt(r),n=Dt(e);if(r===e)return{valid:!0,data:r};if(t===W.object&&n===W.object){let i=ae.objectKeys(e),s=ae.objectKeys(r).filter(a=>i.indexOf(a)!==-1),o={...r,...e};for(let a of s){let l=Dc(r[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===W.array&&n===W.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let s=0;s<r.length;s++){let o=r[s],a=e[s],l=Dc(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===W.date&&n===W.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var hn=class extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(s,o)=>{if(ta(s)||ta(o))return Q;let a=Dc(s.value,o.value);return a.valid?((ra(s)||ra(o))&&t.dirty(),{status:t.value,value:a.data}):(F(n,{code:T.invalid_intersection_types}),Q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};hn.create=(r,e,t)=>new hn({left:r,right:e,typeName:ee.ZodIntersection,...ie(t)});var Ht=class r extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.array)return F(n,{code:T.invalid_type,expected:W.array,received:n.parsedType}),Q;if(n.data.length<this._def.items.length)return F(n,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&n.data.length>this._def.items.length&&(F(n,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...n.data].map((o,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new mt(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>We.mergeArray(t,o)):We.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};Ht.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ht({items:r,typeName:ee.ZodTuple,rest:null,...ie(e)})};var ia=class r extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.object)return F(n,{code:T.invalid_type,expected:W.object,received:n.parsedType}),Q;let i=[],s=this._def.keyType,o=this._def.valueType;for(let a in n.data)i.push({key:s._parse(new mt(n,a,n.path,a)),value:o._parse(new mt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?We.mergeObjectAsync(t,i):We.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof oe?new r({keyType:e,valueType:t,typeName:ee.ZodRecord,...ie(n)}):new r({keyType:kr.create(),valueType:e,typeName:ee.ZodRecord,...ie(t)})}},Xn=class extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.map)return F(n,{code:T.invalid_type,expected:W.map,received:n.parsedType}),Q;let i=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([a,l],c)=>({key:i._parse(new mt(n,a,n.path,[c,"key"])),value:s._parse(new mt(n,l,n.path,[c,"value"]))}));if(n.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 Q;(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 Q;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}}}};Xn.create=(r,e,t)=>new Xn({valueType:e,keyType:r,typeName:ee.ZodMap,...ie(t)});var Jn=class r extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==W.set)return F(n,{code:T.invalid_type,expected:W.set,received:n.parsedType}),Q;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(F(n,{code:T.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(F(n,{code:T.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 Q;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}let a=[...n.data.values()].map((l,c)=>s._parse(new mt(n,l,n.path,c)));return n.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,t){return new r({...this._def,minSize:{value:e,message:Z.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:Z.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Jn.create=(r,e)=>new Jn({valueType:r,minSize:null,maxSize:null,typeName:ee.ZodSet,...ie(e)});var sa=class r extends oe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.function)return F(t,{code:T.invalid_type,expected:W.function,received:t.parsedType}),Q;function n(a,l){return ns({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,qn(),Jt].filter(c=>!!c),issueData:{code:T.invalid_arguments,argumentsError:l}})}function i(a,l){return ns({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,qn(),Jt].filter(c=>!!c),issueData:{code:T.invalid_return_type,returnTypeError:l}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Er){let a=this;return Ge(async function(...l){let c=new rt([]),u=await a._def.args.parseAsync(l,s).catch(f=>{throw c.addIssue(n(l,f)),c}),p=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(p,s).catch(f=>{throw c.addIssue(i(p,f)),c})})}else{let a=this;return Ge(function(...l){let c=a._def.args.safeParse(l,s);if(!c.success)throw new rt([n(l,c.error)]);let u=Reflect.apply(o,this,c.data),p=a._def.returns.safeParse(u,s);if(!p.success)throw new rt([i(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Ht.create(e).rest(er.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||Ht.create([]).rest(er.create()),returns:t||er.create(),typeName:ee.ZodFunction,...ie(n)})}},fn=class extends oe{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})}};fn.create=(r,e)=>new fn({getter:r,typeName:ee.ZodLazy,...ie(e)});var gn=class extends oe{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return F(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};gn.create=(r,e)=>new gn({value:r,typeName:ee.ZodLiteral,...ie(e)});function Vg(r,e){return new mn({values:r,typeName:ee.ZodEnum,...ie(e)})}var mn=class r extends oe{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return F(t,{expected:ae.joinValues(n),received:t.parsedType,code:T.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return F(t,{received:t.data,code:T.invalid_enum_value,options:n}),Q}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 r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};mn.create=Vg;var vn=class extends oe{_parse(e){let t=ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==W.string&&n.parsedType!==W.number){let i=ae.objectValues(t);return F(n,{expected:ae.joinValues(i),received:n.parsedType,code:T.invalid_type}),Q}if(this._cache||(this._cache=new Set(ae.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ae.objectValues(t);return F(n,{received:n.data,code:T.invalid_enum_value,options:i}),Q}return Ge(e.data)}get enum(){return this._def.values}};vn.create=(r,e)=>new vn({values:r,typeName:ee.ZodNativeEnum,...ie(e)});var Er=class extends oe{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==W.promise&&t.common.async===!1)return F(t,{code:T.invalid_type,expected:W.promise,received:t.parsedType}),Q;let n=t.parsedType===W.promise?t.data:Promise.resolve(t.data);return Ge(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Er.create=(r,e)=>new Er({type:r,typeName:ee.ZodPromise,...ie(e)});var vt=class extends oe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ee.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{F(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let o=i.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return Q;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?Q:l.status==="dirty"?sn(l.value):t.value==="dirty"?sn(l.value):l});{if(t.value==="aborted")return Q;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?Q:a.status==="dirty"?sn(a.value):t.value==="dirty"?sn(a.value):a}}if(i.type==="refinement"){let o=a=>{let l=i.refinement(a,s);if(n.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(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Q:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Q:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!wr(o))return Q;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:n.data,path:n.path,parent:n}).then(o=>wr(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:t.value,value:a})):Q);ae.assertNever(i)}};vt.create=(r,e,t)=>new vt({schema:r,typeName:ee.ZodEffects,effect:e,...ie(t)});vt.createWithPreprocess=(r,e,t)=>new vt({schema:e,effect:{type:"preprocess",transform:r},typeName:ee.ZodEffects,...ie(t)});var gt=class extends oe{_parse(e){return this._getType(e)===W.undefined?Ge(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gt.create=(r,e)=>new gt({innerType:r,typeName:ee.ZodOptional,...ie(e)});var Bt=class extends oe{_parse(e){return this._getType(e)===W.null?Ge(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bt.create=(r,e)=>new Bt({innerType:r,typeName:ee.ZodNullable,...ie(e)});var yn=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===W.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};yn.create=(r,e)=>new yn({innerType:r,typeName:ee.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});var _n=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Zn(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new rt(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new rt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};_n.create=(r,e)=>new _n({innerType:r,typeName:ee.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});var Qn=class extends oe{_parse(e){if(this._getType(e)!==W.nan){let n=this._getOrReturnCtx(e);return F(n,{code:T.invalid_type,expected:W.nan,received:n.parsedType}),Q}return{status:"valid",value:e.data}}};Qn.create=r=>new Qn({typeName:ee.ZodNaN,...ie(r)});var Ow=Symbol("zod_brand"),is=class extends oe{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},ss=class r extends oe{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Q:s.status==="dirty"?(t.dirty(),sn(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Q:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:ee.ZodPipeline})}},bn=class extends oe{_parse(e){let t=this._def.innerType._parse(e),n=i=>(wr(i)&&(i.value=Object.freeze(i.value)),i);return Zn(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};bn.create=(r,e)=>new bn({innerType:r,typeName:ee.ZodReadonly,...ie(e)});function Fg(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function jg(r,e={},t){return r?Sr.create().superRefine((n,i)=>{let s=r(n);if(s instanceof Promise)return s.then(o=>{if(!o){let a=Fg(e,n),l=a.fatal??t??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!s){let o=Fg(e,n),a=o.fatal??t??!0;i.addIssue({code:"custom",...o,fatal:a})}}):Sr.create()}var Pw={object:nt.lazycreate},ee;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(ee||(ee={}));var Nw=(r,e={message:`Input not instance of ${r.name}`})=>jg(t=>t instanceof r,e),Wg=kr.create,Ug=on.create,Lw=Qn.create,Fw=an.create,zg=ln.create,Dw=cn.create,Hw=Kn.create,Bw=un.create,Vw=dn.create,jw=Sr.create,Ww=er.create,Uw=Mt.create,zw=Yn.create,qw=tr.create,Zw=nt.create,Gw=nt.strictCreate,Kw=pn.create,Yw=na.create,Xw=hn.create,Jw=Ht.create,Qw=ia.create,ek=Xn.create,tk=Jn.create,rk=sa.create,nk=fn.create,ik=gn.create,sk=mn.create,ok=vn.create,ak=Er.create,lk=vt.create,ck=gt.create,uk=Bt.create,dk=vt.createWithPreprocess,pk=ss.create,hk=()=>Wg().optional(),fk=()=>Ug().optional(),gk=()=>zg().optional(),mk={string:(r=>kr.create({...r,coerce:!0})),number:(r=>on.create({...r,coerce:!0})),boolean:(r=>ln.create({...r,coerce:!0})),bigint:(r=>an.create({...r,coerce:!0})),date:(r=>cn.create({...r,coerce:!0}))};var vk=Q;var yk=d.object({selector:d.string(),route:d.union([d.string(),d.array(d.string())])}).strict(),qg=["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"],Zg=d.enum(qg).describe("Event name to count. ui.* = user interactions and behavioral detectors, nav.* = page navigation, behavior.* = derived behavioral signals."),Gg=["time_on_page","page_views","scroll_depth"],Kg=d.enum(Gg).describe("Session metric key. time_on_page = seconds on current page, page_views = pages visited this session, scroll_depth = 0-100 percentage.");var Hc=d.object({type:d.literal("page_url"),url:d.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"}'),Bc=d.object({type:d.literal("route"),routeId:d.string().describe("Named route ID from the route filter")}).describe("Fires when the current route matches a named route ID."),Vc=d.object({type:d.literal("anchor_visible"),anchorId:d.string().describe("CSS selector of the anchor element"),state:d.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"}`),jc=d.object({type:d.literal("event_occurred"),eventName:d.string().describe('Event name (e.g. "ui.click", "$pageview")'),withinMs:d.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}'),Wc=d.object({type:d.literal("state_equals"),key:d.string().describe("Key in the SDK persistent state store (localStorage). Only valid for keys the host app explicitly sets via syntro.state.set()."),value:d.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."),Uc=d.object({type:d.literal("viewport"),minWidth:d.number().optional().describe("Minimum viewport width in pixels"),maxWidth:d.number().optional().describe("Maximum viewport width in pixels"),minHeight:d.number().optional().describe("Minimum viewport height in pixels"),maxHeight:d.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.'),zc=d.object({type:d.literal("session_metric"),key:Kg,operator:d.enum(["gte","lte","eq","gt","lt"]),threshold:d.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}'),qc=d.object({type:d.literal("dismissed"),key:d.string().describe("Dismissal key (usually a tile or action ID)"),inverted:d.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."),Zc=d.object({type:d.literal("cooldown_active"),key:d.string().describe("Cooldown key"),inverted:d.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."),Gc=d.object({type:d.literal("frequency_limit"),key:d.string().describe("Frequency counter key"),limit:d.number().describe("Maximum allowed count"),inverted:d.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."),os=d.object({equals:d.union([d.string(),d.number(),d.boolean()]).optional(),contains:d.string().optional()}).describe("Match operator for counter filters. Exactly one of equals or contains must be specified."),as=d.object({events:d.array(Zg).min(1).describe("Event names to count. Use values from the countable events enum."),match:d.record(d.string(),os).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."),Kc=d.object({type:d.literal("event_count"),key:d.string().describe("Unique key for this counter (used for accumulator registration)"),operator:d.enum(["gte","lte","eq","gt","lt"]),count:d.number().int().min(0).describe("Target count threshold"),withinMs:d.number().positive().optional().describe("Time window in ms. Omit = count across entire session."),counter:as.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"}}}}'),Cr=d.discriminatedUnion("type",[Hc,Bc,Vc,jc,Wc,Uc,zc,qc,Zc,Gc,Kc]),ls=d.object({conditions:d.array(Cr).describe("Array of conditions \u2014 ALL must match (AND logic) for this rule to fire."),value:d.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."),cs=d.object({type:d.literal("rules"),rules:d.array(ls).describe("Ordered list of rules. Evaluated top-to-bottom \u2014 first match wins."),default:d.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."),us=d.object({type:d.literal("score"),field:d.string(),threshold:d.number(),above:d.unknown(),below:d.unknown()}).describe("Score-based strategy. Compares a field value against a threshold."),ds=d.object({type:d.literal("model"),modelId:d.string(),inputs:d.array(d.string()),outputMapping:d.record(d.string(),d.unknown()),default:d.unknown()}).describe("ML model strategy. Sends inputs to a model and maps outputs."),ps=d.object({type:d.literal("external"),endpoint:d.string(),method:d.enum(["GET","POST"]).optional(),default:d.unknown(),timeoutMs:d.number().optional()}).describe("External API strategy. Calls an endpoint to determine the value."),hs=d.discriminatedUnion("type",[cs,us,ds,ps]),oa=hs.nullable().optional();var _k=d.object({events:d.array(d.string()),urlContains:d.string().optional(),props:d.record(d.union([d.string(),d.number(),d.boolean()])).optional()}),bk=d.object({title:d.string().optional(),body:d.string().optional(),icon:d.string().optional()}).nullable().optional();function Yg(r){let{href:e,external:t,windowOrigin:n,isIframe:i}=r;if(i||n==="null")return{kind:"open",url:e};if(t)return{kind:"open",url:e};let o;try{o=new URL(e,n)}catch{return{kind:"fullnav",url:e}}return o.origin!==n?{kind:"fullnav",url:o.toString()}:{kind:"spa",url:o}}function Xg(){if(typeof window>"u")return!1;try{return window!==window.top}catch{return!0}}var Fe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},aa=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},De,gs,ms,Yc,Xc,sm,Jc,Jg,Qg,em,fs,Qc,xk="#6a59ce",tm="#677384",rm="#87919f";function wk(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function kk(r){return nn(r)||wk(r)}function nm(r){if(typeof window>"u")return!1;let e=window.location.pathname;return r.some(t=>{let n=t.split("?")[0].split("#")[0];return n.endsWith("/**")?e.startsWith(n.slice(0,-3)):e===n})}function Sk(r){let e=[{boxShadow:"0 0 0 0 rgba(13, 148, 136, 0.5)"},{boxShadow:"0 0 0 8px rgba(13, 148, 136, 0)"}];r.animate(e,{duration:600,iterations:3,easing:"ease-out"})}function Ek(r){return r==="dark"?"dark":r==="light"?"light":typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}var la=class extends he{constructor(){super(...arguments),De.add(this),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,gs.set(this,null),ms.set(this,null)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),Fe(this,De,"m",Yc).call(this)}disconnectedCallback(){super.disconnectedCallback(),Fe(this,De,"m",Xc).call(this)}updated(e){e.has("runtime")&&(Fe(this,De,"m",Xc).call(this),Fe(this,De,"m",Yc).call(this))}render(){let e=Fe(this,De,"m",sm).call(this),t=Fe(this,De,"m",Jc).call(this),n=I({fontFamily:"var(--sc-font-family, system-ui, -apple-system, sans-serif)",maxWidth:"100%",overflow:"hidden",backgroundColor:"transparent",color:"inherit"}),i=I({display:"flex",flexDirection:"column",gap:"var(--sc-content-item-gap, 6px)"}),s=I({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:t==="dark"?rm:tm}),o=I({fontSize:"13px",padding:"16px",textAlign:"center",color:t==="dark"?tm:rm});if(e.length===0)return j`
303
303
  <div
304
304
  style=${n}
305
305
  data-adaptive-id=${this.instanceId}
@@ -433,7 +433,7 @@ Please report this to https://github.com/markedjs/marked.`,r){let n="<p>An error
433
433
  .runtimeRef=${this.runtimeRef}
434
434
  ></syntro-tile-stack>`:J}
435
435
  </div>
436
- `}};_a.properties={tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},runtimeRef:{attribute:!1}};customElements.define("syntro-inline-shell",_a);function ba(r,e,t="merge"){return t==="first-match"?rS(r,e):nS(r,e)}function rS(r,e){for(let t of e){let n=r.getFeatureValue?.(t,null);if(!n||typeof n!="object")continue;let i=n,s=i.tiles&&i.tiles.length>0,o=i.actions&&i.actions.length>0;if(s||o)return fm([i])}return null}function nS(r,e){let t=[];for(let n of e){let i=r.getFeatureValue?.(n,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:fm(t)}function fm(r){let e=[],t=[],n,i,s,o,a,l,c,u;for(let p of r)p.tiles&&e.push(...p.tiles),p.actions&&t.push(...p.actions),n??(n=p.fetchedAt),i??(i=p.schemaVersion),s??(s=p.configVersion),o??(o=p.canvasTitle),a??(a=p.displayMode),l??(l=p.theme),c??(c=p.launcher),u??(u=p.meta);return{tiles:e,actions:t,fetchedAt:n??new Date().toISOString(),...i&&{schemaVersion:i},...s&&{configVersion:s},...o&&{canvasTitle:o},...a&&{displayMode:a},...l&&{theme:l},...c&&{launcher:c},...u&&{meta:u}}}var au=!1;function gm(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function lu(r){if(gm()){au=!0;return}au=r??!1}function iS(){return gm()?!0:au}function z(r,e,t){iS()&&(t!==void 0?console.log(`[${r}]`,e,t):console.log(`[${r}]`,e))}function Je(r,e,t){t!==void 0?console.warn(`[${r}]`,e,t):console.warn(`[${r}]`,e)}function xa(r,e,t){t!==void 0?console.error(`[${r}]`,e,t):console.error(`[${r}]`,e)}var cu="2.8.0-canary.151";var Ar="2.0";var sS=["api.syntrologie.com","cdn.syntrologie.com","localhost","127.0.0.1"];function oS(r){try{let e=new URL(r),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(console.warn("[SmartCanvas] Config URI must use HTTPS:",r),!1):sS.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:",r),!1}}function aS(r){if(typeof window>"u")return!1;try{return new URL(r).origin===window.location.origin}catch{return!1}}var mm="syntro_config_cache",lS=1440*60*1e3;function vm(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function cS(r,e){if(vm())try{let t={config:r,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(mm,JSON.stringify(t))}catch{}}function uS(r){if(!vm())return null;try{let e=localStorage.getItem(mm);if(!e)return null;let t=JSON.parse(e);return!t.config||typeof t.timestamp!="number"||!t.sdkVersion||t.sdkVersion!==r||Date.now()-t.timestamp>lS?null:t.config}catch{return null}}var uu=({configUri:r,experiments:e,featureKey:t})=>{if(r)return r;if(e&&t){let n=e.getFeatureValue?.(t,null);if(n)return n}};function dS(r,e,t){if(e){let n=r.getFeatureValue?.(e,null);if(n&&typeof n=="object"){let i=n.variant_flags;if(i&&i.length>0)return i}}if(r.getAllFeatures){let n=r.getAllFeatures();return t?Object.keys(n).filter(i=>i.startsWith(t)):Object.keys(n)}return[]}var ti=({configUri:r,experiments:e,featureKey:t,credentials:n,configFeatureKey:i,manifestKey:s,variantFlagPrefix:o,sdkVersion:a})=>async()=>{if(e&&i){let u=e.getFeatureValue?.(i,null);if(u&&typeof u=="object")return z("SmartCanvas Config","Resolved config directly from feature flag",u),u}if(e&&(s||o||e.getAllFeatures)){let u=dS(e,s,o);if(u.length>0){let p=ba(e,u);if(p)return z("SmartCanvas Config","Resolved config from variant flags",p),p}}let l=uu({configUri:r,experiments:e,featureKey:t});if(!l)return z("SmartCanvas Config","No config available \u2014 returning empty config"),{tiles:[],actions:[],fetchedAt:new Date().toISOString()};if(!oS(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=n??(aS(l)?"include":"omit");try{let u=await fetch(l,{credentials:c,headers:{"X-SDK-Version":cu,"X-SDK-Schema-Version":Ar}});if(!u.ok)throw new Error(`SmartCanvas: failed to fetch config (${u.status})`);let p=await u.json();return z("SmartCanvas Config","Fetched config from URI",p),a&&cS(p,a),p}catch(u){if(a){let p=uS(a);if(p)return z("SmartCanvas Config","Serving config from offline cache"),p}throw u}};var du=class{constructor(e){this.listeners=new Set;let t=e?.open??!1;if(e?.open===void 0)try{let n=sessionStorage?.getItem("syntro:editor:panel-open");n!==null&&(t=JSON.parse(n))}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)}},ym=r=>new du(r);function re(r,e){return`${r}${Math.round(e*255).toString(16).padStart(2,"0")}`}var A2={colorPrimary:te[3],colorPrimaryHover:te[4],colorPrimaryMuted:te[0],colorBackground:re(S[1],.95),colorBackgroundElevated:re(S[3],.95),colorBackgroundSubtle:re(S[0],.2),colorSurface:re(S[4],.8),colorSurfaceHover:re(S[5],.8),colorText:at.primary,colorTextSecondary:at.secondary,colorTextMuted:at.tertiary,colorTextInverse:S[1],colorBorder:Ql.primary,colorBorderSubtle:Ql.secondary,colorSuccess:_e[4],colorSuccessMuted:_e[0],colorWarning:Ve[4],colorWarningMuted:Ve[0],colorError:Re[4],colorErrorMuted:Re[0],colorInfo:ot[4],colorInfoMuted:ot[0],colorNotification:te[4],colorNotificationMuted:re(te[4],.4),glassBackground:re(S[1],.6),glassBackgroundHover:re(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"},R2={colorPrimary:te[3],colorPrimaryHover:te[2],colorPrimaryMuted:re(te[5],.1),colorBackground:re(S[12],.95),colorBackgroundElevated:re(S[11],.95),colorBackgroundSubtle:re(S[0],.02),colorSurface:re(S[11],.6),colorSurfaceHover:re(S[10],.6),colorText:S[1],colorTextSecondary:S[6],colorTextMuted:S[8],colorTextInverse:S[12],colorBorder:re(S[0],.12),colorBorderSubtle:re(S[0],.06),colorSuccess:_e[4],colorSuccessMuted:re(_e[4],.12),colorWarning:Ve[4],colorWarningMuted:re(Ve[4],.12),colorError:Re[4],colorErrorMuted:re(Re[4],.12),colorInfo:ot[4],colorInfoMuted:re(ot[4],.12),colorNotification:te[3],colorNotificationMuted:re(te[3],.4),glassBackground:re(S[12],.7),glassBackgroundHover:re(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 pS(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var _m={mode:"dark",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:te[3],colorPrimaryHover:te[4],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:re(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%",padding:"0"},launcher:{background:So.primary.backgroundDefault,backgroundHover:So.primary.backgroundHover,color:So.primary.icon,size:"56px",shadow:`0 8px 32px ${re(S[0],.6)}`,borderRadius:"9999px"},tile:{background:re(S[1],.6),backgroundHover:re(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, ${te[3]} 0%, ${te[3]}cc 100%)`,iconShadow:`0 2px 8px ${te[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:re(S[1],.6),textColor:at.primary,titleColor:at.primary,arrowColor:re(S[1],.6),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${te[3]}`},notification:{background:re(S[0],.95),textColor:at.primary,textSecondaryColor:at.secondary,border:`1px solid ${S[5]}`,borderRadius:"12px",successColor:_e[4],warningColor:Ve[4],errorColor:Re[4],iconBackground:re(te[3],.15),progressGradient:`linear-gradient(90deg, ${te[3]}, ${te[4]})`},content:{background:re(S[3],.8),backgroundHover:re(S[5],.6),border:`1px solid ${re(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:re(S[3],.8),searchColor:at.primary,chevronColor:"currentColor"}},bm={mode:"light",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:te[3],colorPrimaryHover:te[2],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:re(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%",padding:"0"},launcher:{background:te[3],backgroundHover:te[2],color:"#ffffff",size:"56px",shadow:"0 8px 32px rgba(0, 0, 0, 0.15)",borderRadius:"9999px"},tile:{background:re(S[12],.7),backgroundHover:re(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, ${te[3]} 0%, ${te[3]}cc 100%)`,iconShadow:`0 2px 8px ${te[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:re(S[12],.7),textColor:S[1],titleColor:S[1],arrowColor:re(S[12],.7),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${te[3]}`},notification:{background:re(S[12],.95),textColor:S[1],textSecondaryColor:S[6],border:`1px solid ${re(S[0],.12)}`,borderRadius:"12px",successColor:_e[4],warningColor:Ve[4],errorColor:Re[4],iconBackground:re(te[3],.1),progressGradient:`linear-gradient(90deg, ${te[3]}, ${te[2]})`},content:{background:re(S[12],.8),backgroundHover:re(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 xm(r){let e=r.mode==="light"?bm:_m;return{mode:r.mode??e.mode,fontFamily:r.fontFamily??e.fontFamily,colorPrimary:r.colorPrimary??e.colorPrimary,colorPrimaryHover:r.colorPrimaryHover??e.colorPrimaryHover,borderRadius:r.borderRadius??e.borderRadius,canvas:{...e.canvas,...r.canvas},launcher:{...e.launcher,...r.launcher},tile:{...e.tile,...r.tile},overlay:{...e.overlay,...r.overlay},notification:{...e.notification,...r.notification},content:{...e.content,...r.content}}}function wm(r,e){let t=e.mode??r.mode??"dark",n=t==="light"?bm:_m;return{mode:t,fontFamily:e.fontFamily??r.fontFamily??n.fontFamily,colorPrimary:e.colorPrimary??r.colorPrimary??n.colorPrimary,colorPrimaryHover:e.colorPrimaryHover??r.colorPrimaryHover??n.colorPrimaryHover,borderRadius:e.borderRadius??r.borderRadius??n.borderRadius,canvas:{...n.canvas,...r.canvas,...e.canvas},launcher:{...n.launcher,...r.launcher,...e.launcher},tile:{...n.tile,...r.tile,...e.tile},overlay:{...n.overlay,...r.overlay,...e.overlay},notification:{...n.notification,...r.notification,...e.notification},content:{...n.content,...r.content,...e.content}}}var hS=["canvas","launcher","tile","overlay","notification","content"];function km(r){let e={};r.fontFamily&&(e["--sc-font-family"]=r.fontFamily),r.colorPrimary&&(e["--sc-color-primary"]=r.colorPrimary),r.colorPrimaryHover&&(e["--sc-color-primary-hover"]=r.colorPrimaryHover),r.borderRadius&&(e["--sc-border-radius"]=r.borderRadius);for(let t of hS){let n=r[t];if(n)for(let[i,s]of Object.entries(n))s!==void 0&&(e[`--sc-${t}-${pS(i)}`]=s)}return e}var Rr,wn,kn,rr,nr,pu,wa,ws=class{constructor(e,t,n){ge(this,nr);ge(this,Rr);ge(this,wn);ge(this,kn);ge(this,rr);ne(this,Rr,e),ne(this,wn,t??{}),ne(this,kn,n),ne(this,rr,ye(this,nr,pu).call(this)),e.addController(this)}get config(){return U(this,rr).config}get mode(){return U(this,rr).mode}get cssVariables(){return U(this,rr).cssVariables}hostConnected(){ye(this,nr,wa).call(this)}hostDisconnected(){}hostUpdated(){ye(this,nr,wa).call(this)}setThemeConfig(e,t){ne(this,wn,e),ne(this,kn,t),ne(this,rr,ye(this,nr,pu).call(this)),ye(this,nr,wa).call(this),U(this,Rr).requestUpdate()}};Rr=new WeakMap,wn=new WeakMap,kn=new WeakMap,rr=new WeakMap,nr=new WeakSet,pu=function(){let e=U(this,kn)?wm(U(this,kn),U(this,wn)):xm(U(this,wn)),t=km(e);return{config:e,mode:e.mode,cssVariables:t}},wa=function(){let e=U(this,Rr).shadowRoot??("renderRoot"in U(this,Rr)?U(this,Rr).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 n=Object.entries(U(this,rr).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
436
+ `}};_a.properties={tiles:{attribute:!1},isLoading:{type:Boolean},error:{type:String},runtimeRef:{attribute:!1}};customElements.define("syntro-inline-shell",_a);function ba(r,e,t="merge"){return t==="first-match"?rS(r,e):nS(r,e)}function rS(r,e){for(let t of e){let n=r.getFeatureValue?.(t,null);if(!n||typeof n!="object")continue;let i=n,s=i.tiles&&i.tiles.length>0,o=i.actions&&i.actions.length>0;if(s||o)return fm([i])}return null}function nS(r,e){let t=[];for(let n of e){let i=r.getFeatureValue?.(n,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:fm(t)}function fm(r){let e=[],t=[],n,i,s,o,a,l,c,u;for(let p of r)p.tiles&&e.push(...p.tiles),p.actions&&t.push(...p.actions),n??(n=p.fetchedAt),i??(i=p.schemaVersion),s??(s=p.configVersion),o??(o=p.canvasTitle),a??(a=p.displayMode),l??(l=p.theme),c??(c=p.launcher),u??(u=p.meta);return{tiles:e,actions:t,fetchedAt:n??new Date().toISOString(),...i&&{schemaVersion:i},...s&&{configVersion:s},...o&&{canvasTitle:o},...a&&{displayMode:a},...l&&{theme:l},...c&&{launcher:c},...u&&{meta:u}}}var au=!1;function gm(){if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("syntro_debug")==="true"}catch{return!1}}function lu(r){if(gm()){au=!0;return}au=r??!1}function iS(){return gm()?!0:au}function z(r,e,t){iS()&&(t!==void 0?console.log(`[${r}]`,e,t):console.log(`[${r}]`,e))}function Je(r,e,t){t!==void 0?console.warn(`[${r}]`,e,t):console.warn(`[${r}]`,e)}function xa(r,e,t){t!==void 0?console.error(`[${r}]`,e,t):console.error(`[${r}]`,e)}var cu="2.8.0-canary.152";var Ar="2.0";var sS=["api.syntrologie.com","cdn.syntrologie.com","localhost","127.0.0.1"];function oS(r){try{let e=new URL(r),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(console.warn("[SmartCanvas] Config URI must use HTTPS:",r),!1):sS.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:",r),!1}}function aS(r){if(typeof window>"u")return!1;try{return new URL(r).origin===window.location.origin}catch{return!1}}var mm="syntro_config_cache",lS=1440*60*1e3;function vm(){try{return typeof localStorage<"u"&&localStorage!==null}catch{return!1}}function cS(r,e){if(vm())try{let t={config:r,timestamp:Date.now(),sdkVersion:e};localStorage.setItem(mm,JSON.stringify(t))}catch{}}function uS(r){if(!vm())return null;try{let e=localStorage.getItem(mm);if(!e)return null;let t=JSON.parse(e);return!t.config||typeof t.timestamp!="number"||!t.sdkVersion||t.sdkVersion!==r||Date.now()-t.timestamp>lS?null:t.config}catch{return null}}var uu=({configUri:r,experiments:e,featureKey:t})=>{if(r)return r;if(e&&t){let n=e.getFeatureValue?.(t,null);if(n)return n}};function dS(r,e,t){if(e){let n=r.getFeatureValue?.(e,null);if(n&&typeof n=="object"){let i=n.variant_flags;if(i&&i.length>0)return i}}if(r.getAllFeatures){let n=r.getAllFeatures();return t?Object.keys(n).filter(i=>i.startsWith(t)):Object.keys(n)}return[]}var ti=({configUri:r,experiments:e,featureKey:t,credentials:n,configFeatureKey:i,manifestKey:s,variantFlagPrefix:o,sdkVersion:a})=>async()=>{if(e&&i){let u=e.getFeatureValue?.(i,null);if(u&&typeof u=="object")return z("SmartCanvas Config","Resolved config directly from feature flag",u),u}if(e&&(s||o||e.getAllFeatures)){let u=dS(e,s,o);if(u.length>0){let p=ba(e,u);if(p)return z("SmartCanvas Config","Resolved config from variant flags",p),p}}let l=uu({configUri:r,experiments:e,featureKey:t});if(!l)return z("SmartCanvas Config","No config available \u2014 returning empty config"),{tiles:[],actions:[],fetchedAt:new Date().toISOString()};if(!oS(l))throw new Error(`SmartCanvas: config URI not allowed: ${l}`);let c=n??(aS(l)?"include":"omit");try{let u=await fetch(l,{credentials:c,headers:{"X-SDK-Version":cu,"X-SDK-Schema-Version":Ar}});if(!u.ok)throw new Error(`SmartCanvas: failed to fetch config (${u.status})`);let p=await u.json();return z("SmartCanvas Config","Fetched config from URI",p),a&&cS(p,a),p}catch(u){if(a){let p=uS(a);if(p)return z("SmartCanvas Config","Serving config from offline cache"),p}throw u}};var du=class{constructor(e){this.listeners=new Set;let t=e?.open??!1;if(e?.open===void 0)try{let n=sessionStorage?.getItem("syntro:editor:panel-open");n!==null&&(t=JSON.parse(n))}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)}},ym=r=>new du(r);function re(r,e){return`${r}${Math.round(e*255).toString(16).padStart(2,"0")}`}var A2={colorPrimary:te[3],colorPrimaryHover:te[4],colorPrimaryMuted:te[0],colorBackground:re(S[1],.95),colorBackgroundElevated:re(S[3],.95),colorBackgroundSubtle:re(S[0],.2),colorSurface:re(S[4],.8),colorSurfaceHover:re(S[5],.8),colorText:at.primary,colorTextSecondary:at.secondary,colorTextMuted:at.tertiary,colorTextInverse:S[1],colorBorder:Ql.primary,colorBorderSubtle:Ql.secondary,colorSuccess:_e[4],colorSuccessMuted:_e[0],colorWarning:Ve[4],colorWarningMuted:Ve[0],colorError:Re[4],colorErrorMuted:Re[0],colorInfo:ot[4],colorInfoMuted:ot[0],colorNotification:te[4],colorNotificationMuted:re(te[4],.4),glassBackground:re(S[1],.6),glassBackgroundHover:re(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"},R2={colorPrimary:te[3],colorPrimaryHover:te[2],colorPrimaryMuted:re(te[5],.1),colorBackground:re(S[12],.95),colorBackgroundElevated:re(S[11],.95),colorBackgroundSubtle:re(S[0],.02),colorSurface:re(S[11],.6),colorSurfaceHover:re(S[10],.6),colorText:S[1],colorTextSecondary:S[6],colorTextMuted:S[8],colorTextInverse:S[12],colorBorder:re(S[0],.12),colorBorderSubtle:re(S[0],.06),colorSuccess:_e[4],colorSuccessMuted:re(_e[4],.12),colorWarning:Ve[4],colorWarningMuted:re(Ve[4],.12),colorError:Re[4],colorErrorMuted:re(Re[4],.12),colorInfo:ot[4],colorInfoMuted:re(ot[4],.12),colorNotification:te[3],colorNotificationMuted:re(te[3],.4),glassBackground:re(S[12],.7),glassBackgroundHover:re(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 pS(r){return r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var _m={mode:"dark",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:te[3],colorPrimaryHover:te[4],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:re(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%",padding:"0"},launcher:{background:So.primary.backgroundDefault,backgroundHover:So.primary.backgroundHover,color:So.primary.icon,size:"56px",shadow:`0 8px 32px ${re(S[0],.6)}`,borderRadius:"9999px"},tile:{background:re(S[1],.6),backgroundHover:re(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, ${te[3]} 0%, ${te[3]}cc 100%)`,iconShadow:`0 2px 8px ${te[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:re(S[1],.6),textColor:at.primary,titleColor:at.primary,arrowColor:re(S[1],.6),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${te[3]}`},notification:{background:re(S[0],.95),textColor:at.primary,textSecondaryColor:at.secondary,border:`1px solid ${S[5]}`,borderRadius:"12px",successColor:_e[4],warningColor:Ve[4],errorColor:Re[4],iconBackground:re(te[3],.15),progressGradient:`linear-gradient(90deg, ${te[3]}, ${te[4]})`},content:{background:re(S[3],.8),backgroundHover:re(S[5],.6),border:`1px solid ${re(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:re(S[3],.8),searchColor:at.primary,chevronColor:"currentColor"}},bm={mode:"light",fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif",colorPrimary:te[3],colorPrimaryHover:te[2],borderRadius:"12px",canvas:{position:"right",layout:"overlay",background:re(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%",padding:"0"},launcher:{background:te[3],backgroundHover:te[2],color:"#ffffff",size:"56px",shadow:"0 8px 32px rgba(0, 0, 0, 0.15)",borderRadius:"9999px"},tile:{background:re(S[12],.7),backgroundHover:re(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, ${te[3]} 0%, ${te[3]}cc 100%)`,iconShadow:`0 2px 8px ${te[3]}40`,headerPadding:"0.375rem 0.75rem",bodyPadding:"0 0.75rem 0.5rem",gap:"0.25rem"},overlay:{background:re(S[12],.7),textColor:S[1],titleColor:S[1],arrowColor:re(S[12],.7),arrowSize:"8px",border:"none",borderRadius:"0",scrimOpacity:"0",highlightRing:`2px solid ${te[3]}`},notification:{background:re(S[12],.95),textColor:S[1],textSecondaryColor:S[6],border:`1px solid ${re(S[0],.12)}`,borderRadius:"12px",successColor:_e[4],warningColor:Ve[4],errorColor:Re[4],iconBackground:re(te[3],.1),progressGradient:`linear-gradient(90deg, ${te[3]}, ${te[2]})`},content:{background:re(S[12],.8),backgroundHover:re(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 xm(r){let e=r.mode==="light"?bm:_m;return{mode:r.mode??e.mode,fontFamily:r.fontFamily??e.fontFamily,colorPrimary:r.colorPrimary??e.colorPrimary,colorPrimaryHover:r.colorPrimaryHover??e.colorPrimaryHover,borderRadius:r.borderRadius??e.borderRadius,canvas:{...e.canvas,...r.canvas},launcher:{...e.launcher,...r.launcher},tile:{...e.tile,...r.tile},overlay:{...e.overlay,...r.overlay},notification:{...e.notification,...r.notification},content:{...e.content,...r.content}}}function wm(r,e){let t=e.mode??r.mode??"dark",n=t==="light"?bm:_m;return{mode:t,fontFamily:e.fontFamily??r.fontFamily??n.fontFamily,colorPrimary:e.colorPrimary??r.colorPrimary??n.colorPrimary,colorPrimaryHover:e.colorPrimaryHover??r.colorPrimaryHover??n.colorPrimaryHover,borderRadius:e.borderRadius??r.borderRadius??n.borderRadius,canvas:{...n.canvas,...r.canvas,...e.canvas},launcher:{...n.launcher,...r.launcher,...e.launcher},tile:{...n.tile,...r.tile,...e.tile},overlay:{...n.overlay,...r.overlay,...e.overlay},notification:{...n.notification,...r.notification,...e.notification},content:{...n.content,...r.content,...e.content}}}var hS=["canvas","launcher","tile","overlay","notification","content"];function km(r){let e={};r.fontFamily&&(e["--sc-font-family"]=r.fontFamily),r.colorPrimary&&(e["--sc-color-primary"]=r.colorPrimary),r.colorPrimaryHover&&(e["--sc-color-primary-hover"]=r.colorPrimaryHover),r.borderRadius&&(e["--sc-border-radius"]=r.borderRadius);for(let t of hS){let n=r[t];if(n)for(let[i,s]of Object.entries(n))s!==void 0&&(e[`--sc-${t}-${pS(i)}`]=s)}return e}var Rr,wn,kn,rr,nr,pu,wa,ws=class{constructor(e,t,n){ge(this,nr);ge(this,Rr);ge(this,wn);ge(this,kn);ge(this,rr);ne(this,Rr,e),ne(this,wn,t??{}),ne(this,kn,n),ne(this,rr,ye(this,nr,pu).call(this)),e.addController(this)}get config(){return U(this,rr).config}get mode(){return U(this,rr).mode}get cssVariables(){return U(this,rr).cssVariables}hostConnected(){ye(this,nr,wa).call(this)}hostDisconnected(){}hostUpdated(){ye(this,nr,wa).call(this)}setThemeConfig(e,t){ne(this,wn,e),ne(this,kn,t),ne(this,rr,ye(this,nr,pu).call(this)),ye(this,nr,wa).call(this),U(this,Rr).requestUpdate()}};Rr=new WeakMap,wn=new WeakMap,kn=new WeakMap,rr=new WeakMap,nr=new WeakSet,pu=function(){let e=U(this,kn)?wm(U(this,kn),U(this,wn)):xm(U(this,wn)),t=km(e);return{config:e,mode:e.mode,cssVariables:t}},wa=function(){let e=U(this,Rr).shadowRoot??("renderRoot"in U(this,Rr)?U(this,Rr).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 n=Object.entries(U(this,rr).cssVariables).map(([i,s])=>` ${i}: ${s};`).join(`
437
437
  `);t.textContent=`:host {
438
438
  ${n}
439
439
  }`};var fS=new Set(["tag_name","$el_text"]);function gS(r){return fS.has(r)||r.startsWith("attr__")}function Sm(r,e){return r.equals!==void 0?e===r.equals:r.contains!==void 0?typeof e=="string"&&e.includes(r.contains):!1}function mS(r){let{events:e,match:t}=r;return n=>{if(!e.includes(n.name))return!1;if(t){for(let[i,s]of Object.entries(t))if(gS(i)){let o=n.props?.elements;if(!o||!o.some(l=>Sm(s,l[i])))return!1}else if(!Sm(s,n.props?.[i]))return!1}return!0}}function Em(r,e){for(let t of r.rules)for(let n of t.conditions)if(n.type==="event_count"&&n.key){let i=n.counter,s=i?mS(i):()=>!0,o=typeof n.withinMs=="number";e.register(n.key,s,o)}}function ri(r,e,t){for(let n of r){let i=n.props;if(!i)continue;let s=i.actions;if(s)for(let o of s)o.triggerWhen?.type==="rules"&&Em(o.triggerWhen,e)}if(t)for(let n of t){let i=n;i.triggerWhen?.type==="rules"&&Em(i.triggerWhen,e)}}var vS="syntro-runtime",Cm="smart-canvas",Am=r=>[...r].sort((e,t)=>(t.priority??0)-(e.priority??0));function Rm(r){let e=typeof window<"u"?window.SynOS?.interventionTracker:null;if(e)for(let t of r)e.trackTriggered(t.id,t.widget??"unknown")}var it,ii,Vt,ir,Pt,Sn,ks,Ss,En,Cn,An,Tr,Ir,$r,Rn,si,Es,Se,Tm,Im,oi,hu,$m,fu,gu,mu,Mm,vu,ka,ni=class extends he{constructor(){super();ge(this,Se);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.initialBatchActions=void 0;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:"/";ge(this,it);ge(this,ii,null);ge(this,Vt,null);ge(this,ir,null);ge(this,Pt,null);ge(this,Sn);ge(this,ks,0);ge(this,Ss,null);ge(this,En,"[]");ge(this,Cn,null);ge(this,An,null);ge(this,Tr,null);ge(this,Ir,null);ge(this,$r,null);ge(this,Rn,()=>{this._pageUrl=window.location.href});ge(this,si);ge(this,Es);ge(this,oi,0);ge(this,ka,t=>{U(this,it).toggle()});ne(this,it,ym()),ne(this,Sn,!1),ne(this,si,new ws(this)),ne(this,Es,new ei(this,{context:vS,initialValue:null}))}connectedCallback(){super.connectedCallback(),this.style.setProperty("font-family","inherit"),ne(this,ii,U(this,it).subscribe(t=>{this._isOpen=t.open})),this._isOpen=U(this,it).getState().open,ne(this,Vt,document.createElement("div")),U(this,Vt).id="overlayContainer",Object.assign(U(this,Vt).style,{position:"fixed",inset:"0",zIndex:"2147483645",pointerEvents:"none"}),this.shadowRoot.appendChild(U(this,Vt)),ne(this,ir,document.createElement("div")),U(this,ir).id="portalRoot",this.shadowRoot.appendChild(U(this,ir)),ye(this,Se,fu).call(this),ye(this,Se,vu).call(this),ye(this,Se,mu).call(this)}disconnectedCallback(){var t,n,i,s,o;super.disconnectedCallback(),(t=U(this,ii))==null||t.call(this),ne(this,ii,null),(n=U(this,An))==null||n.call(this),ne(this,An,null),(i=U(this,Tr))==null||i.call(this),ne(this,Tr,null),(s=U(this,Ir))==null||s.call(this),ne(this,Ir,null),(o=U(this,$r))==null||o.call(this),ne(this,$r,null),ye(this,Se,gu).call(this),U(this,Pt)&&(U(this,Pt).revertAll().catch(a=>{console.error("[SmartCanvasElementLit] Failed to revert actions on disconnect:",a)}),ne(this,Pt,null)),U(this,Vt)?.remove(),ne(this,Vt,null),U(this,ir)?.remove(),ne(this,ir,null)}updated(t){var i;t.has("runtime")&&(U(this,Es).setValue(this.runtime??null),ye(this,Se,Mm).call(this),ye(this,Se,mu).call(this),ye(this,Se,vu).call(this),ye(this,Se,gu).call(this),ye(this,Se,fu).call(this));let n=t.has("runtime")||t.has("fetcher")||t.has("configUri")||t.has("configUriFeatureKey")||t.has("configFeatureKey")||t.has("fetchCredentials")||t.has("experiments");if(n&&(ye(this,Se,Tm).call(this),(i=U(this,An))==null||i.call(this),this.experiments?.onFeaturesChanged&&ne(this,An,this.experiments.onFeaturesChanged(()=>this._loadConfig()))),(n||t.has("_pageUrl"))&&this._loadConfig(),(t.has("_theme")||t.has("workspaceTheme"))&&U(this,si).setThemeConfig(this._theme??{},this.workspaceTheme),(t.has("_configActions")||t.has("_pageUrl"))&&ye(this,Se,$m).call(this),t.has("_tiles")||t.has("_isLoading")||t.has("_error")){let s=this._tiles.length>0&&!this._error;!this._isLoading&&!s&&U(this,it).getState().open&&U(this,it).setOpen(!1)}t.has("initialBatchHandle")&&this.initialBatchHandle&&(ne(this,Pt,this.initialBatchHandle),ne(this,Sn,!0),this.initialBatchActions&&(this._configActions=this.initialBatchActions,ne(this,En,JSON.stringify(this.initialBatchActions))))}render(){let t=this._tiles.length>0&&!this._error;return this._isLoading||t?this._displayMode==="inline"?j`
@@ -1007,7 +1007,7 @@ Actions:`,b.map((O,q)=>` [${q}] ${O.kind} ${O.anchorId?`anchor="${O.anchorId.se
1007
1007
  `,t=document.createElement("style");t.setAttribute("data-syntro","base-overlay"),t.textContent=e,r.appendChild(t),yv=!0}var Uu=async(r={})=>{if(typeof window>"u"||typeof document>"u")throw new Error("SmartCanvas can only be created in a browser-like environment");let e=null;if(r.antiFlicker){let g=typeof r.antiFlicker=="object"?r.antiFlicker:{};e=fv(g)}let t=null,n=null,i=null,{runtime:s}=r;async function o(g){!s?.actions||g.length===0||(i?.isApplied()&&await i.revertAll(),i=await s.actions.applyBatch(g))}async function a(){i?.isApplied()&&(await i.revertAll(),i=null)}if(r.fetcher)try{n=r.fetcher,console.log("[SmartCanvas] Fetching initial config...");let g=await r.fetcher();t=g,console.log("[SmartCanvas] Config fetched:",`tiles=${g.tiles?.length??0},`,`actions=${g.actions?.length??0},`,`theme=${g.theme?.mode??"default"}`),g.actions?.length&&console.log("[SmartCanvas] Actions to apply:",g.actions.map((y,x)=>`[${x}] ${y.kind}${y.anchorId?` anchor="${y.anchorId.selector}"`:""}${y.label?` "${y.label}"`:""}`).join(", ")),g.actions&&g.actions.length>0&&s?.actions&&(await o(g.actions),console.log("[SmartCanvas] Initial actions applied successfully")),g.tiles&&s?.accumulator&&ri(g.tiles,s.accumulator,g.actions)}catch(g){console.error("[SmartCanvas] Error fetching/applying initial config:",g)}e&&e();let l=Pa();Sa();let c=document.createElement("smart-canvas");if(r.tokens)for(let[g,y]of Object.entries(r.tokens))c.style.setProperty(g,y);let u=r.integrations?.experiments,p=r.integrations?.telemetry,h=r.fetcher??ti({configUri:r.configUri,experiments:u,featureKey:r.configUriFeatureKey,credentials:r.fetchCredentials});n||(n=h);let f={fetcher:h,configUri:r.configUri,configUriFeatureKey:r.configUriFeatureKey,fetchCredentials:r.fetchCredentials,experiments:u,telemetry:p,runtime:s,initialBatchHandle:i,initialBatchActions:i?t?.actions??[]:void 0,workspaceTheme:r.workspaceTheme};c.mountLitApp(f),r.defaultOpen&&c.open();let v=()=>{let g=r.target??document.body;if(g){g.appendChild(c);let y=c.getOverlayContainer();y&&_v(y)}};document.body?v():document.addEventListener("DOMContentLoaded",v,{once:!0}),(l||r.editorUrl)&&(console.log(`[SmartCanvas] Loading editor SDK for ${l??"config"} mode`),vv(r.editorUrl).catch(console.error));let m={el:c,open:()=>c.open(),close:()=>c.close(),destroy:()=>{a(),c.remove()},setTokens:g=>{for(let[y,x]of Object.entries(g))c.style.setProperty(y,x)},getConfig:async()=>{if(n)try{let g=await n();return t=g,g}catch(g){console.error("[SmartCanvas] Error fetching config:",g)}return t??{tiles:[],actions:[],fetchedAt:""}},setEnabled:async g=>{g?t&&await o(t.actions):await a()},setOverrideFetcher:g=>{n=g,c.setOverrideFetcher(g),s?.accumulator&&g().then(y=>{y?.tiles&&ri(y.tiles,s.accumulator,y.actions)}).catch(()=>{})},registerTelemetryProperties:g=>{p?.register?.(g)},getSessionId:()=>p?.getSessionId?.(),startSessionRecording:()=>{p?.startSessionRecording?.()},track:(g,y)=>p?.track?(p.track(g,y),!0):!1,runtime:s};if(typeof window<"u"){let g=window.SynOS;g&&(g.handle=m)}return m};typeof window<"u"&&(window.SmartCanvas={async create(r){return Uu(r)}});var zu="syn_";function Is(r){if(!r.startsWith(zu))throw new Error("Invalid Syntro token: must start with 'syn_'");let t=r.slice(zu.length).replace(/-/g,"+").replace(/_/g,"/"),n=atob(t),i=JSON.parse(n);if(i.v!==1)throw new Error(`Unsupported token version: ${i.v}`);return i}function qu(r){let e=JSON.stringify(r),t=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return zu+t}function bt(r){if(typeof process<"u"&&process.env)return process.env[r];if(typeof import.meta.env<"u"&&import.meta.env)return import.meta.env[r]}var wv="syntro_segment_attributes";function kv(){if(typeof window>"u")return{};try{let r=localStorage.getItem(wv);if(r){let e=JSON.parse(r);return z("Syntro Bootstrap","Loaded cached segment attributes:",e),e}}catch(r){Je("Syntro Bootstrap","Failed to load cached segment attributes:",r)}return{}}function Sv(r){if(!(typeof window>"u"))try{localStorage.setItem(wv,JSON.stringify(r)),z("Syntro Bootstrap","Cached segment attributes:",r)}catch(e){Je("Syntro Bootstrap","Failed to cache segment attributes:",e)}}function Ev(r){if(!r)return{};let e={};for(let[t,n]of Object.entries(r))t.startsWith("in_segment_")&&(e[t]=n===!0);return e}function Zu(){if(typeof window>"u")return{};let r={};try{let e=new URLSearchParams(window.location.search);for(let t of["utm_source","utm_medium","utm_campaign","utm_content","utm_term"]){let n=e.get(t);n&&(r[t]=n)}}catch{}try{navigator.language&&(r.browser_language=navigator.language),navigator.languages?.length&&(r.browser_languages=[...navigator.languages])}catch{}try{let e=window.innerWidth;r.device_type=e<768?"mobile":e<1024?"tablet":"desktop"}catch{}try{if(document.referrer){r.referrer=document.referrer;try{r.referrer_hostname=new URL(document.referrer).hostname}catch{}}}catch{}try{let e=navigator.userAgent;e.includes("Edg/")?r.browser="Edge":e.includes("OPR/")||e.includes("Opera")?r.browser="Opera":e.includes("Chrome/")&&!e.includes("Chromium")?r.browser="Chrome":e.includes("Safari/")&&!e.includes("Chrome")?r.browser="Safari":e.includes("Firefox/")&&(r.browser="Firefox"),e.includes("Windows")?r.os="Windows":e.includes("iPhone")||e.includes("iPad")?r.os="iOS":e.includes("Mac OS X")||e.includes("Macintosh")?r.os="macOS":e.includes("Android")?r.os="Android":e.includes("Linux")&&(r.os="Linux")}catch{}try{r.page_url=window.location.href,r.page_path=window.location.pathname,r.page_host=window.location.hostname,window.location.search&&(r.page_query=window.location.search)}catch{}try{let e=window.Telegram?.WebApp;e?(r.surface_type="telegram",r.surface_host=e.platform||"unknown"):(r.surface_type="web",r.surface_host="web")}catch{r.surface_type="web",r.surface_host="web"}return r}var xv="syntro_geo",Cv="https://geo.syntrologie.com";async function Gu(r){if(typeof window>"u")return{};try{let e=localStorage.getItem(xv);if(e){let t=JSON.parse(e);return z("Syntro Bootstrap","Geo: using cached data:",t),t}}catch{}try{let e=await fetch(r,{signal:AbortSignal.timeout(2e3)});if(e.ok){let t=await e.json(),n={};for(let[i,s]of Object.entries(t))typeof s=="string"&&s&&(n[i]=s);try{localStorage.setItem(xv,JSON.stringify(n))}catch{}return z("Syntro Bootstrap","Geo: fetched from worker:",n),n}}catch{}return{}}var Ku=null;if(typeof document<"u")try{let r=document.currentScript instanceof HTMLScriptElement?document.currentScript.src:null;if(r){let e=new URL(r),t=e.pathname.replace(/\/[^/]*$/,"");Ku=`${e.origin}${t}`}}catch{Ku=null}function Av(){return Ku}var Rv="app:",VS="syntro:",jS=/^[a-z][a-z0-9_]*$/;function Yu(r){if(!r)return{valid:!1,reason:"Event name cannot be empty"};if(r.startsWith(VS))return{valid:!1,reason:'"syntro:" prefix is reserved for internal SDK events'};if(!r.startsWith(Rv))return{valid:!1,reason:`Custom events must start with "app:" prefix. Got: "${r}"`};let e=r.slice(Rv.length).split(":");if(e.length<2)return{valid:!1,reason:`Event name must have at least 2 segments after "app:" (app:{category}:{action}). Got: "${r}"`};for(let t of e)if(!jS.test(t))return{valid:!1,reason:`Segment "${t}" must be lowercase alphanumeric + underscores. Got: "${r}"`};return{valid:!0}}function WS(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null}function Tv(r,e,t=0){if(t>=e)return!1;for(let n of Object.values(r))if(n!==null&&typeof n=="object"&&!Array.isArray(n)&&!Tv(n,e,t+1))return!1;return!0}function Xu(r){if(r===void 0)return{valid:!0};if(r===null||typeof r!="object"||Array.isArray(r))return{valid:!1,reason:"Props must be a plain object"};if(!Tv(r,2))return{valid:!1,reason:"Props nesting depth exceeds 2 levels"};let e=[];for(let[t,n]of Object.entries(r))n!==null&&typeof n=="object"||WS(n)||e.push(t);return e.length>0?{valid:!0,stripped:e}:{valid:!0}}function Na(r,e){return e?!(e.names&&e.names.length>0&&!e.names.includes(r.name)||e.patterns&&e.patterns.length>0&&!e.patterns.some(n=>{try{return new RegExp(n).test(r.name)}catch{return!1}})||e.sources&&e.sources.length>0&&!e.sources.includes(r.source)):!0}var La=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 n,i;typeof e=="function"?(n=void 0,i=e):(n=e,i=t);let s={filter:n,callback:i};return this.subscriptions.add(s),()=>{this.subscriptions.delete(s)}}publish(e,t,n="canvas"){let i={ts:Date.now(),name:e,source:n,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(Na(e,t.filter))try{t.callback(e)}catch(n){console.error("[EventBus] Subscriber error:",n)}}emit(e,t){let n=Yu(e);if(!n.valid)return console.warn(`[EventBus] emit() rejected: ${n.reason}`),this.debug?{delivered:!1,matchedRules:[],posthogCaptured:!1,listenersNotified:0}:void 0;let i=Xu(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(Na(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 n=this.history;return e&&(n=n.filter(i=>Na(i,e))),t&&t>0&&(n=n.slice(-t)),n}hasRecentEvent(e,t,n){let i=Date.now()-t;return this.history.some(s=>s.name===e&&s.ts>=i&&(n===void 0||s.source===n))}countRecentEvents(e,t){let n=this.history.filter(i=>Na(i,e));if(t!==void 0){let i=Date.now()-t;n=n.filter(s=>s.ts>=i)}return n.length}clearHistory(){this.history=[]}getSubscriberCount(){return this.subscriptions.size}};function $s(r={}){return new La(r)}var Ms=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 $v={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function Mv(){return $v}function Ju(r){let e=2166136261,t=r.length;for(let n=0;n<t;n++)e^=r.charCodeAt(n),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0}function Os(r,e,t){return t===2?Ju(Ju(r+e)+"")%1e4/1e4:t===1?Ju(e+r)%1e3/1e3:null}function US(r){return r<=0?[]:new Array(r).fill(1/r)}function Fa(r,e){return r>=e[0]&&r<e[1]}function Ov(r,e){let t=Os("__"+e[0],r,1);return t===null?!1:t>=e[1]&&t<e[2]}function Pv(r,e){for(let t=0;t<e.length;t++)if(Fa(r,e[t]))return t;return-1}function ed(r){try{let e=r.replace(/([^\\])\//g,"$1\\/");return new RegExp(e)}catch(e){console.error(e);return}}function Da(r,e){if(!e.length)return!1;let t=!1,n=!1;for(let i=0;i<e.length;i++){let s=ZS(r,e[i].type,e[i].pattern);if(e[i].include===!1){if(s)return!1}else t=!0,s&&(n=!0)}return n||!t}function zS(r,e,t){try{let n=e.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return t&&(n="\\/?"+n.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+n+"$","i").test(r)}catch{return!1}}function qS(r,e){try{let t=new URL(e.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),n=[[r.host,t.host,!1],[r.pathname,t.pathname,!0]];return t.hash&&n.push([r.hash,t.hash,!1]),t.searchParams.forEach((i,s)=>{n.push([r.searchParams.get(s)||"",i,!1])}),!n.some(i=>!zS(i[0],i[1],i[2]))}catch{return!1}}function ZS(r,e,t){try{let n=new URL(r,"https://_");if(e==="regex"){let i=ed(t);return i?i.test(n.href)||i.test(n.href.substring(n.origin.length)):!1}else if(e==="simple")return qS(n,t);return!1}catch{return!1}}function Nv(r,e,t){e=e===void 0?1:e,e<0?e=0:e>1&&(e=1);let n=US(r);t=t||n,t.length!==r&&(t=n);let i=t.reduce((o,a)=>a+o,0);(i<.99||i>1.01)&&(t=n);let s=0;return t.map(o=>{let a=s;return s+=o,[a,a+e*o]})}function Lv(r,e,t){if(!e)return null;let n=e.split("?")[1];if(!n)return null;let i=n.replace(/#.*/,"").split("&").map(s=>s.split("=",2)).filter(([s])=>s===r).map(([,s])=>parseInt(s));return i.length>0&&i[0]>=0&&i[0]<t?i[0]:null}function Fv(r){try{return r()}catch(e){return console.error(e),!1}}var Qu=r=>Uint8Array.from(atob(r),e=>e.charCodeAt(0));async function Tn(r,e,t){if(e=e||"",t=t||globalThis.crypto&&globalThis.crypto.subtle||$v.SubtleCrypto,!t)throw new Error("No SubtleCrypto implementation found");try{let n=await t.importKey("raw",Qu(e),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=r.split("."),o=await t.decrypt({name:"AES-CBC",iv:Qu(i)},n,Qu(s));return new TextDecoder().decode(o)}catch{throw new Error("Failed to decrypt")}}function Ps(r){return typeof r=="string"?r:JSON.stringify(r)}function ct(r){typeof r=="number"&&(r=r+""),(!r||typeof r!="string")&&(r="0");let e=r.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return e.length===3&&e.push("~"),e.map(t=>t.match(/^[0-9]+$/)?t.padStart(5," "):t).join("-")}function Dv(){let r;try{r="1.6.4"}catch{r=""}return r}function Hv(r,e){let t,n;try{t=new URL(r),n=new URL(e)}catch(i){return console.error(`Unable to merge query strings: ${i}`),e}return t.searchParams.forEach((i,s)=>{n.searchParams.has(s)||n.searchParams.set(s,i)}),n.toString()}function Iv(r){return typeof r=="object"&&r!==null}function Ha(r){return r.urlPatterns&&r.variations.some(e=>Iv(e)&&"urlRedirect"in e)?"redirect":r.variations.some(e=>Iv(e)&&(e.domMutations||"js"in e||"css"in e))?"visual":"unknown"}async function Ba(r,e){return new Promise(t=>{let n=!1,i,s=o=>{n||(n=!0,i&&clearTimeout(i),t(o||null))};e&&(i=setTimeout(()=>s(),e)),r.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},Ut=Mv(),ai={fetchFeaturesCall:({host:r,clientKey:e,headers:t})=>Ut.fetch(`${r}/api/features/${e}`,{headers:t}),fetchRemoteEvalCall:({host:r,clientKey:e,payload:t,headers:n})=>{let i={method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)};return Ut.fetch(`${r}/api/eval/${e}`,i)},eventSourceCall:({host:r,clientKey:e,headers:t})=>t?new Ut.EventSource(`${r}/sub/${e}`,{headers:t}):new Ut.EventSource(`${r}/sub/${e}`),startIdleListener:()=>{let r;if(!(typeof window<"u"&&typeof document<"u"))return;let t=()=>{document.visibilityState==="visible"?(window.clearTimeout(r),YS()):document.visibilityState==="hidden"&&(r=window.setTimeout(KS,Ke.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(Ut.localStorage=globalThis.localStorage)}catch{}var li=new Map,Bv=!1,ar=new Map,Va=new Map,ci=new Map,ui=new Set;function jv(r){Object.assign(Ke,r),Ke.backgroundSync||od()}async function Wv({instance:r,timeout:e,skipCache:t,allowStale:n,backgroundSync:i}){return i||(Ke.backgroundSync=!1),XS({instance:r,allowStale:n,timeout:e,skipCache:t})}function GS(r){let e=Ns(r),t=li.get(e)||new Set;t.add(r),li.set(e,t)}function Uv(r){li.forEach(e=>e.delete(r))}function KS(){ci.forEach(r=>{r&&(r.state="idle",id(r))})}function YS(){ci.forEach(r=>{r&&r.state==="idle"&&sd(r)})}async function Vv(){try{if(!Ut.localStorage)return;await Ut.localStorage.setItem(Ke.cacheKey,JSON.stringify(Array.from(ar.entries())))}catch{}}async function XS({instance:r,allowStale:e,timeout:t,skipCache:n}){let i=Ns(r),s=rd(r),o=new Date,a=new Date(o.getTime()-Ke.maxAge+Ke.staleTTL);await JS();let l=!Ke.disableCache&&!n?ar.get(s):void 0;return l&&(e||l.staleAt>o)&&l.staleAt>a?(l.sse&&ui.add(i),l.staleAt<o?td(r):nd(r),{data:l.data,success:!0,source:"cache"}):await Ba(td(r),t)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}function Ns(r){let[e,t]=r.getApiInfo();return`${e}||${t}`}function rd(r){let e=Ns(r);if(!("isRemoteEval"in r)||!r.isRemoteEval())return e;let t=r.getAttributes(),n=r.getCacheKeyAttributes()||Object.keys(r.getAttributes()),i={};n.forEach(a=>{i[a]=t[a]});let s=r.getForcedVariations(),o=r.getUrl();return`${e}||${JSON.stringify({ca:i,fv:s,url:o})}`}async function JS(){if(!Bv){Bv=!0;try{if(Ut.localStorage){let r=await Ut.localStorage.getItem(Ke.cacheKey);if(!Ke.disableCache&&r){let e=JSON.parse(r);e&&Array.isArray(e)&&e.forEach(([t,n])=>{ar.set(t,{...n,staleAt:new Date(n.staleAt)})}),zv()}}}catch{}if(!Ke.disableIdleStreams){let r=ai.startIdleListener();r&&(ai.stopIdleListener=r)}}}function zv(){let r=Array.from(ar.entries()).map(([t,n])=>({key:t,staleAt:n.staleAt.getTime()})).sort((t,n)=>t.staleAt-n.staleAt),e=Math.min(Math.max(0,ar.size-Ke.maxEntries),ar.size);for(let t=0;t<e;t++)ar.delete(r[t].key)}function qv(r,e,t){let n=t.dateUpdated||"",i=new Date(Date.now()+Ke.staleTTL),s=Ke.disableCache?void 0:ar.get(e);if(s&&n&&s.version===n){s.staleAt=i,Vv();return}Ke.disableCache||(ar.set(e,{data:t,version:n,staleAt:i,sse:ui.has(r)}),zv()),Vv();let o=li.get(r);o&&o.forEach(a=>QS(a,t))}async function QS(r,e){await r.setPayload(e||r.getPayload())}async function td(r){let{apiHost:e,apiRequestHeaders:t}=r.getApiHosts(),n=r.getClientKey(),i="isRemoteEval"in r&&r.isRemoteEval(),s=Ns(r),o=rd(r),a=Va.get(o);return a||(a=(i?ai.fetchRemoteEvalCall({host:e,clientKey:n,payload:{attributes:r.getAttributes(),forcedVariations:r.getForcedVariations(),forcedFeatures:Array.from(r.getForcedFeatures().entries()),url:r.getUrl()},headers:t}):ai.fetchFeaturesCall({host:e,clientKey:n,headers:t})).then(c=>{if(!c.ok)throw new Error(`HTTP error: ${c.status}`);return c.headers.get("x-sse-support")==="enabled"&&ui.add(s),c.json()}).then(c=>(qv(s,o,c),nd(r),Va.delete(o),{data:c,success:!0,source:"network"})).catch(c=>(Va.delete(o),{data:null,source:"error",success:!1,error:c})),Va.set(o,a)),a}function nd(r,e=!1){let t=Ns(r),n=rd(r),{streamingHost:i,streamingHostRequestHeaders:s}=r.getApiHosts(),o=r.getClientKey();if(e&&ui.add(t),Ke.backgroundSync&&ui.has(t)&&Ut.EventSource){if(ci.has(t))return;let a={src:null,host:i,clientKey:o,headers:s,cb:l=>{try{if(l.type==="features-updated"){let c=li.get(t);c&&c.forEach(u=>{td(u)})}else if(l.type==="features"){let c=JSON.parse(l.data);qv(t,n,c)}a.errors=0}catch{Zv(a)}},errors:0,state:"active"};ci.set(t,a),sd(a)}}function Zv(r){if(r.state!=="idle"&&(r.errors++,r.errors>3||r.src&&r.src.readyState===2)){let e=Math.pow(3,r.errors-3)*(1e3+Math.random()*1e3);id(r),setTimeout(()=>{["idle","active"].includes(r.state)||sd(r)},Math.min(e,3e5))}}function id(r){r.src&&(r.src.onopen=null,r.src.onerror=null,r.src.close(),r.src=null,r.state==="active"&&(r.state="disabled"))}function sd(r){r.src=ai.eventSourceCall({host:r.host,clientKey:r.clientKey,headers:r.headers}),r.state="active",r.src.addEventListener("features",r.cb),r.src.addEventListener("features-updated",r.cb),r.src.onerror=()=>Zv(r),r.src.onopen=()=>{r.errors=0}}function eE(r,e){id(r),ci.delete(e)}function od(){ui.clear(),ci.forEach(eE),li.clear(),ai.stopIdleListener()}function ja(r,e){if(e.streaming){if(!r.getClientKey())throw new Error("Must specify clientKey to enable streaming");e.payload&&nd(r,!0),GS(r)}}var tE=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,cd={revert:function(){}},qa=new Map,ud=new Set;function rE(r){return r==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[r]}}function Za(r){var e=qa.get(r);return e||(e={element:r,attributes:{}},qa.set(r,e)),e}function Ga(r,e,t,n,i){var s=t(r),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:r,_positionTimeout:null,observer:new MutationObserver(function(){if(!(e==="position"&&o._positionTimeout)){e==="position"&&(o._positionTimeout=setTimeout(function(){o._positionTimeout=null},1e3));var a=t(r);e==="position"&&a.parentNode===o.virtualValue.parentNode&&a.insertBeforeNode===o.virtualValue.insertBeforeNode||a!==o.virtualValue&&(o.originalValue=a,i(o))}}),mutationRunner:i,setValue:n,getCurrentValue:t};return e==="position"&&r.parentNode?o.observer.observe(r.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(r,rE(e)),o}function Ka(r,e){var t=e.getCurrentValue(e.el);e.virtualValue=r,r&&typeof r!="string"?(!t||r.parentNode!==t.parentNode||r.insertBeforeNode!==t.insertBeforeNode)&&(e.isDirty=!0,Gv()):r!==t&&(e.isDirty=!0,Gv())}function nE(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),Ka(vE(e),r)}function iE(r){var e=new Set(r.originalValue.split(/\s+/).filter(Boolean));r.mutations.forEach(function(t){return t.mutate(e)}),Ka(Array.from(e).filter(Boolean).join(" "),r)}function sE(r){var e=r.originalValue;r.mutations.forEach(function(t){return e=t.mutate(e)}),Ka(e,r)}function oE(r){var e=r.parentSelector,t=r.insertBeforeSelector,n=document.querySelector(e);if(!n)return null;var i=t?document.querySelector(t):null;return t&&!i?null:{parentNode:n,insertBeforeNode:i}}function aE(r){var e=r.originalValue;r.mutations.forEach(function(t){var n=t.mutate(),i=oE(n);e=i||e}),Ka(e,r)}var lE=function(e){return e.innerHTML},cE=function(e,t){return e.innerHTML=t};function Yv(r){var e=Za(r);return e.html||(e.html=Ga(r,"html",lE,cE,nE)),e.html}var uE=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},dE=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function Xv(r){var e=Za(r);return e.position||(e.position=Ga(r,"position",uE,dE,aE)),e.position}var pE=function(e,t){return t?e.className=t:e.removeAttribute("class")},hE=function(e){return e.className};function Jv(r){var e=Za(r);return e.classes||(e.classes=Ga(r,"class",hE,pE,iE)),e.classes}var fE=function(e){return function(t){var n;return(n=t.getAttribute(e))!=null?n:null}},gE=function(e){return function(t,n){return n!==null?t.setAttribute(e,n):t.removeAttribute(e)}};function Qv(r,e){var t=Za(r);return t.attributes[e]||(t.attributes[e]=Ga(r,e,fE(e),gE(e),sE)),t.attributes[e]}function mE(r,e){var t=qa.get(r);if(t)if(e==="html"){var n,i;(n=t.html)==null||(i=n.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,p;(c=t.attributes)==null||(u=c[e])==null||(p=u.observer)==null||p.disconnect(),delete t.attributes[e]}}var Wa;function vE(r){return Wa||(Wa=document.createElement("div")),Wa.innerHTML=r,Wa.innerHTML}function Ua(r,e,t){if(t.isDirty){t.isDirty=!1;var n=t.virtualValue;t.mutations.length||mE(r,e),t.setValue(r,n)}}function yE(r,e){r.html&&Ua(e,"html",r.html),r.classes&&Ua(e,"class",r.classes),r.position&&Ua(e,"position",r.position),Object.keys(r.attributes).forEach(function(t){Ua(e,t,r.attributes[t])})}function Gv(){qa.forEach(yE)}function _E(r,e){var t=null;r.kind==="html"?t=Yv(e):r.kind==="class"?t=Jv(e):r.kind==="attribute"?t=Qv(e,r.attribute):r.kind==="position"&&(t=Xv(e)),t&&(t.mutations.push(r),t.mutationRunner(t))}function bE(r,e){var t=null;if(r.kind==="html"?t=Yv(e):r.kind==="class"?t=Jv(e):r.kind==="attribute"?t=Qv(e,r.attribute):r.kind==="position"&&(t=Xv(e)),!!t){var n=t.mutations.indexOf(r);n!==-1&&t.mutations.splice(n,1),t.mutationRunner(t)}}function ey(r){if(!(r.kind==="position"&&r.elements.size===1)){var e=new Set(r.elements),t=document.querySelectorAll(r.selector);t.forEach(function(n){e.has(n)||(r.elements.add(n),_E(r,n))})}}function xE(r){r.elements.forEach(function(e){return bE(r,e)}),r.elements.clear(),ud.delete(r)}function Kv(){ud.forEach(ey)}var ad;function wE(){typeof document>"u"||(ad||(ad=new MutationObserver(function(){Kv()})),Kv(),ad.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}wE();function Ya(r){return typeof document>"u"?cd:(ud.add(r),ey(r),{revert:function(){xE(r)}})}function ld(r,e){return Ya({kind:"html",elements:new Set,mutate:e,selector:r})}function ty(r,e){return Ya({kind:"position",elements:new Set,mutate:e,selector:r})}function Ls(r,e){return Ya({kind:"class",elements:new Set,mutate:e,selector:r})}function za(r,e,t){return tE.test(e)?e==="class"||e==="className"?Ls(r,function(n){var i=t(Array.from(n).join(" "));n.clear(),i&&i.split(/\s+/g).filter(Boolean).forEach(function(s){return n.add(s)})}):Ya({kind:"attribute",attribute:e,elements:new Set,mutate:t,selector:r}):cd}function kE(r){var e=r.selector,t=r.action,n=r.value,i=r.attribute,s=r.parentSelector,o=r.insertBeforeSelector;if(i==="html"){if(t==="append")return ld(e,function(a){return a+(n??"")});if(t==="set")return ld(e,function(){return n??""})}else if(i==="class"){if(t==="append")return Ls(e,function(a){n&&a.add(n)});if(t==="remove")return Ls(e,function(a){n&&a.delete(n)});if(t==="set")return Ls(e,function(a){a.clear(),n&&a.add(n)})}else if(i==="position"){if(t==="set"&&s)return ty(e,function(){return{insertBeforeSelector:o,parentSelector:s}})}else{if(t==="append")return za(e,i,function(a){return a!==null?a+(n??""):n??""});if(t==="set")return za(e,i,function(){return n??""});if(t==="remove")return za(e,i,function(){return null})}return cd}var SE={html:ld,classes:Ls,attribute:za,position:ty,declarative:kE},ry=SE;var dd={};function Pr(r,e,t){t=t||{};for(let[n,i]of Object.entries(e))switch(n){case"$or":if(!sy(r,i,t))return!1;break;case"$nor":if(sy(r,i,t))return!1;break;case"$and":if(!TE(r,i,t))return!1;break;case"$not":if(Pr(r,i,t))return!1;break;default:if(!Fs(i,EE(r,n),t))return!1}return!0}function EE(r,e){let t=e.split("."),n=r;for(let i=0;i<t.length;i++)if(n&&typeof n=="object"&&t[i]in n)n=n[t[i]];else return null;return n}function ny(r,e=!1){let t=`${r}${e?"/i":""}`;return dd[t]||(dd[t]=new RegExp(r.replace(/([^\\])\//g,"$1\\/"),e?"i":void 0)),dd[t]}function Fs(r,e,t,n=!1){if(typeof r=="string")return n?String(e).toLowerCase()===r.toLowerCase():e+""===r;if(typeof r=="number")return e*1===r;if(typeof r=="boolean")return e!==null&&!!e===r;if(r===null)return e===null;if(Array.isArray(r)||!oy(r))return JSON.stringify(e)===JSON.stringify(r);for(let i in r)if(!RE(i,e,r[i],t))return!1;return!0}function oy(r){let e=Object.keys(r);return e.length>0&&e.filter(t=>t[0]==="$").length===e.length}function CE(r){if(r===null)return"null";if(Array.isArray(r))return"array";let e=typeof r;return["string","number","boolean","object","undefined"].includes(e)?e:"unknown"}function AE(r,e,t){if(!Array.isArray(r))return!1;let n=oy(e)?i=>Fs(e,i,t):i=>Pr(i,e,t);for(let i=0;i<r.length;i++)if(r[i]&&n(r[i]))return!0;return!1}function di(r,e,t=!1){if(t){let n=i=>typeof i=="string"?i.toLowerCase():i;return Array.isArray(r)?r.some(i=>e.some(s=>n(i)===n(s))):e.some(i=>n(r)===n(i))}return Array.isArray(r)?r.some(n=>e.includes(n)):e.includes(r)}function iy(r,e,t,n=!1){if(!Array.isArray(r))return!1;for(let i=0;i<e.length;i++){let s=!1;for(let o=0;o<r.length;o++)if(Fs(e[i],r[o],t,n)){s=!0;break}if(!s)return!1}return!0}function RE(r,e,t,n){switch(r){case"$veq":return ct(e)===ct(t);case"$vne":return ct(e)!==ct(t);case"$vgt":return ct(e)>ct(t);case"$vgte":return ct(e)>=ct(t);case"$vlt":return ct(e)<ct(t);case"$vlte":return ct(e)<=ct(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)?di(e,t):!1;case"$ini":return Array.isArray(t)?di(e,t,!0):!1;case"$inGroup":return di(e,n[t]||[]);case"$notInGroup":return!di(e,n[t]||[]);case"$nin":return Array.isArray(t)?!di(e,t):!1;case"$nini":return Array.isArray(t)?!di(e,t,!0):!1;case"$not":return!Fs(t,e,n);case"$size":return Array.isArray(e)?Fs(t,e.length,n):!1;case"$elemMatch":return AE(e,t,n);case"$all":return Array.isArray(t)?iy(e,t,n):!1;case"$alli":return Array.isArray(t)?iy(e,t,n,!0):!1;case"$regex":try{return ny(t).test(e)}catch{return!1}case"$regexi":try{return ny(t,!0).test(e)}catch{return!1}case"$type":return CE(e)===t;default:return console.error("Unknown operator: "+r),!1}}function sy(r,e,t){if(!e.length)return!0;for(let n=0;n<e.length;n++)if(Pr(r,e[n],t))return!0;return!1}function TE(r,e,t){for(let n=0;n<e.length;n++)if(!Pr(r,e[n],t))return!1;return!0}var IE="Feature Evaluated",$E="Experiment Viewed";function ME(r){let e=new Map;return r.global.forcedFeatureValues&&r.global.forcedFeatureValues.forEach((t,n)=>e.set(n,t)),r.user.forcedFeatureValues&&r.user.forcedFeatureValues.forEach((t,n)=>e.set(n,t)),e}function OE(r){return r.global.forcedVariations&&r.user.forcedVariations?{...r.global.forcedVariations,...r.user.forcedVariations}:r.global.forcedVariations?r.global.forcedVariations:r.user.forcedVariations?r.user.forcedVariations:{}}async function pi(r){try{await r()}catch{}}function ay(r,e,t){if(r.user.trackedExperiments){let i=Qa(e,t);if(r.user.trackedExperiments.has(i))return[];r.user.trackedExperiments.add(i)}r.user.enableDevMode&&r.user.devLogs&&r.user.devLogs.push({experiment:e,result:t,timestamp:Date.now().toString(),logType:"experiment"});let n=[];if(r.global.trackingCallback){let i=r.global.trackingCallback;n.push(pi(()=>i(e,t,r.user)))}if(r.user.trackingCallback){let i=r.user.trackingCallback;n.push(pi(()=>i(e,t)))}if(r.global.eventLogger){let i=r.global.eventLogger;n.push(pi(()=>i($E,{experimentId:e.key,variationId:t.key,hashAttribute:t.hashAttribute,hashValue:t.hashValue},r.user)))}return n}function PE(r,e,t){if(r.user.trackedFeatureUsage){let n=JSON.stringify(t.value);if(r.user.trackedFeatureUsage[e]===n)return;r.user.trackedFeatureUsage[e]=n,r.user.enableDevMode&&r.user.devLogs&&r.user.devLogs.push({featureKey:e,result:t,timestamp:Date.now().toString(),logType:"feature"})}if(r.global.onFeatureUsage){let n=r.global.onFeatureUsage;pi(()=>n(e,t,r.user))}if(r.user.onFeatureUsage){let n=r.user.onFeatureUsage;pi(()=>n(e,t))}if(r.global.eventLogger){let n=r.global.eventLogger;pi(()=>n(IE,{feature:e,source:t.source,value:t.value,ruleId:t.source==="defaultValue"?"$default":t.ruleId||"",variationId:t.experimentResult?t.experimentResult.key:""},r.user))}}function Xa(r,e){if(e.stack.evaluatedFeatures.has(r))return Nr(e,r,null,"cyclicPrerequisite");e.stack.evaluatedFeatures.add(r),e.stack.id=r;let t=ME(e);if(t.has(r))return Nr(e,r,t.get(r),"override");if(!e.global.features||!e.global.features[r])return Nr(e,r,null,"unknownFeature");let n=e.global.features[r];if(n.rules){let i=new Set(e.stack.evaluatedFeatures);e:for(let s of n.rules){if(s.parentConditions)for(let l of s.parentConditions){e.stack.evaluatedFeatures=new Set(i);let c=Xa(l.id,e);if(c.source==="cyclicPrerequisite")return Nr(e,r,null,"cyclicPrerequisite");let u={value:c.value};if(!Pr(u,l.condition||{})){if(l.gate)return Nr(e,r,null,"prerequisite");continue e}}if(s.filters&&uy(s.filters,e))continue;if("force"in s){if(s.condition&&!cy(s.condition,e)||!NE(e,s.seed||r,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=>{!ay(e,l.experiment,l.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:l.experiment,result:l.result})}),Nr(e,r,s.force,"force",s.id)}if(!s.variations)continue;let o={variations:s.variations,key:s.key||r};"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}=Ja(o,r,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(o,a),a.inExperiment&&!a.passthrough)return Nr(e,r,a.value,"experiment",s.id,o,a)}}return Nr(e,r,n.defaultValue===void 0?null:n.defaultValue,"defaultValue")}function Ja(r,e,t){let n=r.key,i=r.variations.length;if(i<2)return{result:Ce(t,r,-1,!1,e)};if(t.global.enabled===!1||t.user.enabled===!1)return{result:Ce(t,r,-1,!1,e)};if(r=LE(r,t),r.urlPatterns&&!Da(t.user.url||"",r.urlPatterns))return{result:Ce(t,r,-1,!1,e)};let s=Lv(n,t.user.url||"",i);if(s!==null)return{result:Ce(t,r,s,!1,e)};let o=OE(t);if(n in o){let g=o[n];return{result:Ce(t,r,g,!1,e)}}if(r.status==="draft"||r.active===!1)return{result:Ce(t,r,-1,!1,e)};let{hashAttribute:a,hashValue:l}=In(t,r.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing?r.fallbackAttribute:void 0);if(!l)return{result:Ce(t,r,-1,!1,e)};let c=-1,u=!1,p=!1;if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{variation:g,versionIsBlocked:y}=HE({ctx:t,expKey:r.key,expBucketVersion:r.bucketVersion,expHashAttribute:r.hashAttribute,expFallbackAttribute:r.fallbackAttribute,expMinBucketVersion:r.minBucketVersion,expMeta:r.meta});u=g>=0,c=g,p=!!y}if(!u){if(r.filters){if(uy(r.filters,t))return{result:Ce(t,r,-1,!1,e)}}else if(r.namespace&&!Ov(l,r.namespace))return{result:Ce(t,r,-1,!1,e)};if(r.include&&!Fv(r.include))return{result:Ce(t,r,-1,!1,e)};if(r.condition&&!cy(r.condition,t))return{result:Ce(t,r,-1,!1,e)};if(r.parentConditions){let g=new Set(t.stack.evaluatedFeatures);for(let y of r.parentConditions){t.stack.evaluatedFeatures=new Set(g);let x=Xa(y.id,t);if(x.source==="cyclicPrerequisite")return{result:Ce(t,r,-1,!1,e)};let k={value:x.value};if(!Pr(k,y.condition||{}))return{result:Ce(t,r,-1,!1,e)}}}if(r.groups&&!DE(r.groups,t))return{result:Ce(t,r,-1,!1,e)}}if(r.url&&!FE(r.url,t))return{result:Ce(t,r,-1,!1,e)};let h=Os(r.seed||n,l,r.hashVersion||1);if(h===null)return{result:Ce(t,r,-1,!1,e)};if(!u){let g=r.ranges||Nv(i,r.coverage===void 0?1:r.coverage,r.weights);c=Pv(h,g)}if(p)return{result:Ce(t,r,-1,!1,e,void 0,!0)};if(c<0)return{result:Ce(t,r,-1,!1,e)};if("force"in r)return{result:Ce(t,r,r.force===void 0?-1:r.force,!1,e)};if(t.global.qaMode||t.user.qaMode)return{result:Ce(t,r,-1,!1,e)};if(r.status==="stopped")return{result:Ce(t,r,-1,!1,e)};let f=Ce(t,r,c,!0,e,h,u);if(t.user.saveStickyBucketAssignmentDoc&&!r.disableStickyBucketing){let{changed:g,key:y,doc:x}=VE(t,a,Ps(l),{[pd(r.key,r.bucketVersion)]:f.key});g&&(t.user.stickyBucketAssignmentDocs=t.user.stickyBucketAssignmentDocs||{},t.user.stickyBucketAssignmentDocs[y]=x,t.user.saveStickyBucketAssignmentDoc(x))}let v=ay(t,r,f);v.length===0&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:r,result:f});let m=v.length?v.length===1?v[0]:Promise.all(v).then(()=>{}):void 0;return"changeId"in r&&r.changeId&&t.global.recordChangeId&&t.global.recordChangeId(r.changeId),{result:f,trackingCall:m}}function Nr(r,e,t,n,i,s,o){let a={value:t,on:!!t,off:!t,source:n,ruleId:i||""};return s&&(a.experiment=s),o&&(a.experimentResult=o),n!=="override"&&PE(r,e,a),a}function ly(r){return{...r.user.attributes,...r.user.attributeOverrides}}function cy(r,e){return Pr(ly(e),r,e.global.savedGroups||{})}function uy(r,e){return r.some(t=>{let{hashValue:n}=In(e,t.attribute);if(!n)return!0;let i=Os(t.seed,n,t.hashVersion||2);return i===null?!0:!t.ranges.some(s=>Fa(i,s))})}function NE(r,e,t,n,i,s,o){if(!i&&s===void 0)return!0;if(!i&&s===0)return!1;let{hashValue:a}=In(r,t,n);if(!a)return!1;let l=Os(e,a,o||1);return l===null?!1:i?Fa(l,i):s!==void 0?l<=s:!0}function Ce(r,e,t,n,i,s,o){let a=!0;(t<0||t>=e.variations.length)&&(t=0,a=!1);let{hashAttribute:l,hashValue:c}=In(r,e.hashAttribute,r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),u=e.meta?e.meta[t]:{},p={key:u.key||""+t,featureId:i,inExperiment:a,hashUsed:n,variationId:t,value:e.variations[t],hashAttribute:l,hashValue:c,stickyBucketUsed:!!o};return u.name&&(p.name=u.name),s!==void 0&&(p.bucket=s),u.passthrough&&(p.passthrough=u.passthrough),p}function LE(r,e){let t=r.key,n=e.global.overrides;return n&&n[t]&&(r=Object.assign({},r,n[t]),typeof r.url=="string"&&(r.url=ed(r.url))),r}function In(r,e,t){let n=e||"id",i="",s=ly(r);return s[n]&&(i=s[n]),!i&&t&&(s[t]&&(i=s[t]),i&&(n=t)),{hashAttribute:n,hashValue:i}}function FE(r,e){let t=e.user.url;if(!t)return!1;let n=t.replace(/^https?:\/\//,"").replace(/^[^/]*\//,"/");return!!(r.test(t)||r.test(n))}function DE(r,e){let t=e.global.groups||{};for(let n=0;n<r.length;n++)if(t[r[n]])return!0;return!1}function HE({ctx:r,expKey:e,expBucketVersion:t,expHashAttribute:n,expFallbackAttribute:i,expMinBucketVersion:s,expMeta:o}){t=t||0,s=s||0,n=n||"id",o=o||[];let a=pd(e,t),l=BE(r,n,i);if(s>0)for(let p=0;p<s;p++){let h=pd(e,p);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(p=>p.key===c);return u<0?{variation:-1}:{variation:u}}function pd(r,e){return e=e||0,`${r}__${e}`}function hd(r,e){return`${r}||${e}`}function BE(r,e,t){if(!r.user.stickyBucketAssignmentDocs)return{};let{hashAttribute:n,hashValue:i}=In(r,e),s=hd(n,Ps(i)),{hashAttribute:o,hashValue:a}=In(r,t),l=a?hd(o,Ps(a)):null,c={};return l&&r.user.stickyBucketAssignmentDocs[l]&&Object.assign(c,r.user.stickyBucketAssignmentDocs[l].assignments||{}),r.user.stickyBucketAssignmentDocs[s]&&Object.assign(c,r.user.stickyBucketAssignmentDocs[s].assignments||{}),c}function VE(r,e,t,n){let i=hd(e,t),s=r.user.stickyBucketAssignmentDocs&&r.user.stickyBucketAssignmentDocs[i]?r.user.stickyBucketAssignmentDocs[i].assignments||{}:{},o={...s,...n},a=JSON.stringify(s)!==JSON.stringify(o);return{key:i,doc:{attributeName:e,attributeValue:t,assignments:o},changed:a}}function jE(r,e){let t=new Set,n=e&&e.features?e.features:r.global.features||{},i=e&&e.experiments?e.experiments:r.global.experiments||[];return Object.keys(n).forEach(s=>{let o=n[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 dy(r,e,t){let n=fd(r,t);return e.getAllAssignments(n)}function fd(r,e){let t={};return jE(r,e).forEach(i=>{let{hashValue:s}=In(r,i);t[i]=Ps(s)}),t}async function py(r,e,t){if(r={...r},r.encryptedFeatures){try{r.features=JSON.parse(await Tn(r.encryptedFeatures,e,t))}catch(n){console.error(n)}delete r.encryptedFeatures}if(r.encryptedExperiments){try{r.experiments=JSON.parse(await Tn(r.encryptedExperiments,e,t))}catch(n){console.error(n)}delete r.encryptedExperiments}if(r.encryptedSavedGroups){try{r.savedGroups=JSON.parse(await Tn(r.encryptedSavedGroups,e,t))}catch(n){console.error(n)}delete r.encryptedSavedGroups}return r}function hy(r){let e=r.apiHost||"https://cdn.growthbook.io";return{apiHost:e.replace(/\/*$/,""),streamingHost:(r.streamingHost||e).replace(/\/*$/,""),apiRequestHeaders:r.apiHostRequestHeaders,streamingHostRequestHeaders:r.streamingHostRequestHeaders}}function Qa(r,e){return e.hashAttribute+e.hashValue+r.key+e.variationId}var hi=typeof window<"u"&&typeof document<"u",WE=Dv(),Ds=class{constructor(e){if(e=e||{},this.version=WE,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=n=>t.saveAssignments(n)}if(e.plugins)for(let t of e.plugins)t(this);if(e.features&&(this.ready=!0),hi&&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 n=this._options.stickyBucketAssignmentDocs[t];n&&this._options.stickyBucketService.saveAssignments(n).catch(()=>{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(e){this._payload=e;let t=await py(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,ja(this,e),this}async init(e){if(this._initialized=!0,e=e||{},e.cacheSettings&&jv(e.cacheSettings),e.payload)return await this.setPayload(e.payload),ja(this,e),{success:!0,source:"init"};{let{data:t,...n}=await this._refresh({...e,allowStale:!0});return ja(this,e),await this.setPayload(t||{}),n}}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 hy(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:n,streaming:i}){if(!this._options.clientKey)throw new Error("Missing clientKey");return Wv({instance:this,timeout:e,skipCache:t||this._options.disableCache,allowStale:n,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,n){let i=await Tn(e,t||this._options.decryptionKey,n);this.setFeatures(JSON.parse(i))}setExperiments(e){this._options.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(e,t,n){let i=await Tn(e,t||this._options.decryptionKey,n);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(n){console.error(n)}}),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,Uv(this),e.destroyAllStreams&&od(),this.logs=[],hi&&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}=Ja(e,null,this._getEvalContext());return this._onExperimentEval(e,t),t}triggerExperiment(e){return this._triggeredExpKeys.add(e),this._options.experiments?this._options.experiments.filter(n=>n.key===e).map(n=>this._runAutoExperiment(n)).filter(n=>n!==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 n=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!n)return null;let i=this._isAutoExperimentBlockedByContext(e),s,o;i?s=Ce(this._getEvalContext(),e,-1,!1,""):({result:s,trackingCall:o}=Ja(e,null,this._getEvalContext()),this._onExperimentEval(e,s));let a=JSON.stringify(s.value);if(!t&&s.inExperiment&&n&&n.valueHash===a)return s;if(n&&this._undoActiveAutoExperiment(e),s.inExperiment){let l=Ha(e);if(l==="redirect"&&s.value.urlRedirect&&e.urlPatterns){let c=e.persistQueryString?Hv(this._getContextUrl(),s.value.urlRedirect):s.value.urlRedirect;if(Da(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:p}=this._getNavigateFunction();if(u)if(hi)Promise.all([...o?[Ba(o,this._options.maxNavigateDelay??1e3)]:[],new Promise(h=>window.setTimeout(h,this._options.navigateDelay??p))]).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||[],n=new Set(t);this._activeAutoExperiments.forEach((i,s)=>{n.has(s)||(i.undo(),this._activeAutoExperiments.delete(s))});for(let i of t){let s=this._runAutoExperiment(i,e);if(s&&s.inExperiment&&Ha(i)==="redirect")break}}_onExperimentEval(e,t){let n=this._assigned.get(e.key);this._assigned.set(e.key,{experiment:e,result:t}),this._subscriptions.size>0&&this._fireSubscriptions(e,t,n)}_fireSubscriptions(e,t,n){(!n||n.result.inExperiment!==t.inExperiment||n.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 n=this.evalFeature(e).value;return n===null?t:n}feature(e){return this.evalFeature(e)}evalFeature(e){return Xa(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=>[Qa(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(n){console.error(n)}else console.error("No event logger configured")}_saveDeferredTrack(e){this._deferredTrackingCalls.set(Qa(e.experiment,e.result),e)}_getContextUrl(){return this._options.url||(hi?window.location.href:"")}_isAutoExperimentBlockedByContext(e){let t=Ha(e);if(t==="visual"){if(this._options.disableVisualExperiments||this._options.disableJsInjection&&e.variations.some(n=>n.js))return!0}else if(t==="redirect"){if(this._options.disableUrlRedirectExperiments)return!0;try{let n=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!==n.protocol||s.host!==n.host))return!0}}catch(n){return this.log("Error parsing current or redirect URL",{id:e.key,error:n}),!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}:hi?{navigate:e=>{window.location.replace(e)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(e){if(!hi)return;let t=[];if(e.css){let n=document.createElement("style");n.innerHTML=e.css,document.head.appendChild(n),t.push(()=>n.remove())}if(e.js){let n=document.createElement("script");n.innerHTML=e.js,this._options.jsInjectionNonce&&(n.nonce=this._options.jsInjectionNonce),document.head.appendChild(n),t.push(()=>n.remove())}return e.domMutations&&e.domMutations.forEach(n=>{t.push(ry.declarative(n).revert)}),()=>{t.forEach(n=>n())}}async refreshStickyBuckets(e){if(this._options.stickyBucketService){let t=this._getEvalContext(),n=await dy(t,this._options.stickyBucketService,e);this._options.stickyBucketAssignmentDocs=n}}generateStickyBucketAssignmentDocsSync(e,t){if(!("getAllAssignmentsSync"in e)){console.error("generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync");return}let n=this._getEvalContext(),i=fd(n,t);return e.getAllAssignmentsSync(i)}inDevMode(){return!!this._options.enableDevMode}};var UE="https://experiment.syntrologie.com",gd=class{constructor(e={}){this.featureListeners=new Set;if(e.client)this.gb=e.client;else{let t=e.onExperimentViewed?(n,i)=>{e.onExperimentViewed(n.key,i.variationId,typeof i.value=="string"?i.value:`variation_${i.variationId}`)}:void 0;this.gb=new Ds({...e,apiHost:e.apiHost??UE,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 n of Object.keys(e))t[n]=this.gb.getFeatureValue(n,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 md(r={}){return new gd(r)}var fy={growthbook:r=>md({...r,autoInit:!0})};function gy(r,e){let t=fy[r];if(!t)throw new Error(`Unknown experiment provider: ${r}. Supported: ${Object.keys(fy).join(", ")}`);return t(e)}var zE=["cdn.syntrologie.com","localhost","127.0.0.1"];function qE(r){try{let e=new URL(r),t=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);return e.protocol!=="https:"&&!t?(console.warn("[SmartCanvas] CDN URL must use HTTPS:",r),!1):zE.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:",r),!1}}var vd=class{constructor(e){this.name="cdn";if(this.url=`${e.baseUrl}/${e.configId}.json`,this.integrity=e.integrity,!qE(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 n=await t.text();if(this.integrity){let l=await ZE(n),c=this.integrity.replace("sha384-","");if(l!==c)throw new Error(`[SmartCanvas] Config integrity check failed. Expected ${c}, got ${l}`)}let i=JSON.parse(n),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 ZE(r){let t=new TextEncoder().encode(r),n=await crypto.subtle.digest("SHA-384",t),i=new Uint8Array(n);return btoa(String.fromCharCode(...i))}function my(r){return new vd(r)}var GE="syntro_exp",KE="syntro_var",yd=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(GE),o=i.get(KE);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 n=performance.now()-e;return{config:t,meta:{source:"experiments",fetchTimeMs:n,cached:!0}}}fetchMultiFlag(){let e=this.getVariantFlagKeys();return!e||e.length===0?null:ba(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 vy(r){return new yd(r)}var YE="https://cdn.syntrologie.com/configs",yy={cdn:r=>{if(!r.configId)throw new Error("CDN fetcher requires 'configId' option");return my({baseUrl:r.baseUrl??YE,configId:r.configId,integrity:r.integrity})},experiments:r=>{if(!r.featureKey)throw new Error("Experiments fetcher requires 'featureKey' option");return vy({featureKey:r.featureKey})}};function _y(r,e={}){let t=yy[r];if(!t)throw new Error(`Unknown config fetcher type: ${r}. Supported: ${Object.keys(yy).join(", ")}`);return t(e)}var by="syntro_session_metrics",el=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 n of e)t[`${this.attributePrefix}${n}`]=0,this.onMetricChange?.(n,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 n=`${this.attributePrefix}${e}`;this.experiments.setAttributes({[n]:t})}syncAllToExperiments(){if(!this.experiments?.setAttributes)return;let e={};for(let[t,n]of this.metrics)e[`${this.attributePrefix}${t}`]=n;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(by);if(e){let t=JSON.parse(e);for(let[n,i]of Object.entries(t))this.metrics.set(n,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,n]of this.metrics)e[t]={count:n,lastUpdated:Date.now()};sessionStorage.setItem(by,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function _d(r={}){return new el(r)}var tl=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),n=document.querySelectorAll(`${t} [data-syntro-action-id]`);for(let i of n)i.style.opacity="0",i.style.transition="none"}revealContentInSection(e){let t=this.sectionSelector(e);requestAnimationFrame(()=>{if(this.destroyed)return;let n=document.querySelectorAll(`${t} [data-syntro-action-id]`);for(let i of n)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 rl=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 tl(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 n=t.detail?.sectionId;if(n)for(let i of this.loadCallbacks)try{i(n)}catch{}},{signal:e}),document.addEventListener("shopify:section:unload",t=>{let n=t.detail?.sectionId;if(n)for(let i of this.unloadCallbacks)try{i(n)}catch{}},{signal:e})}waitForInitialSections(e,t){return new Promise(n=>{if(document.querySelector(".shopify-section")){n();return}let i=!1,s=()=>{i||(i=!0,n())};document.addEventListener("shopify:section:load",()=>s(),{once:!0,signal:t});let o=setTimeout(s,e);t.addEventListener("abort",()=>{clearTimeout(o),s()},{once:!0})})}};var XE=[()=>new rl];function xy(){for(let r of XE){let e=r();if(e.detect())return e}return null}var bd="syntro_experiments";var QE=720*60*60,nl=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=`${bd}=; 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)),n=`${bd}=${t}; max-age=${QE}; path=/; SameSite=Lax`;document.cookie=n}};function eC(){let r=Date.now();return{page:{url:typeof window<"u"?window.location.href:"",title:typeof document<"u"?document.title:void 0},session:{sessionId:"",startTs:r,pageHistory:[]},viewport:{width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0}}}function xd(r,e){if(!e)return;let t;try{t=new URL(r).pathname}catch{t=r}if(t.startsWith("/")||(t=`/${t}`),e.exclude){for(let n of e.exclude)if(wy(t,n))return}if(e.include){for(let n of e.include)if(wy(t,n))return n;return}return t}function wy(r,e){let t=r.replace(/\/$/,"")||"/",n=e.replace(/\/$/,"")||"/";if(t===n)return!0;let i=n.replace(/:[^/]+/g,"[^/]+").replace(/\*/g,".*");return new RegExp(`^${i}$`).test(t)}var il=class{constructor(e){this.listeners=new Set;this.cleanupFns=[];if(this.telemetry=e.telemetry,this.routes=e.routes,this.navigation=e.navigation,this.context=eC(),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=xd(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=xd(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 n=this.navigation.subscribe(()=>this.updatePage());this.cleanupFns.push(n)}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,n=xd(e,this.routes),i={url:e,title:t,routeId:n};(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()},n=[...this.context.session.pageHistory||[],t];n.length>50&&n.shift(),this.context.session.pageHistory=n}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 wd(r){return new il(r)}function ky(r,e){let{context:t,state:n,events:i}=e;switch(r.type){case"page_url":{let{url:s}=r,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===r.routeId;case"anchor_visible":{let s=t.anchors?.find(o=>o.anchorId===r.anchorId);switch(r.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=r.withinMs??6e4;return i.hasRecentEvent(r.eventName,s)}case"state_equals":return n?.getValue?n.getValue(r.key)===r.value:!1;case"viewport":{let{width:s,height:o}=t.viewport;return!(r.minWidth!==void 0&&s<r.minWidth||r.maxWidth!==void 0&&s>r.maxWidth||r.minHeight!==void 0&&o<r.minHeight||r.maxHeight!==void 0&&o>r.maxHeight)}case"session_metric":{let s=e.sessionMetrics?e.sessionMetrics.get(r.key):n?.getSessionMetric(r.key);if(s===void 0)return!1;let{operator:o,threshold:a}=r;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(!n)return r.inverted??!1;let s=n.isDismissed(r.key);return r.inverted?!s:s}case"cooldown_active":{if(!n)return r.inverted??!1;let s=n.isCooldownActive(r.key);return r.inverted?!s:s}case"frequency_limit":{if(!n)return r.inverted??!1;let o=n.getFrequencyCount(r.key)>=r.limit;return r.inverted?!o:o}case"event_count":{if(!e.accumulator)return!1;let s=r,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:",r.type),!1}}function Sy(r,e){let t=[];for(let n of r.conditions){let i=ky(n,e);if(t.push({condition:n,result:i}),!i)return{matched:!1,conditionResults:t}}return{matched:!0,conditionResults:t}}function sl(r,e){for(let t=0;t<r.rules.length;t++){let n=r.rules[t],{matched:i,conditionResults:s}=Sy(n,e);if(i)return{value:n.value,isFallback:!1,matchInfo:{strategyType:"rules",matchedRuleIndex:t,evaluatedConditions:s}}}return{value:r.default,isFallback:!0,matchInfo:{strategyType:"rules"}}}function ol(r,e){let{context:t}=e,n=t.augmented?.[r.field];return n===void 0||typeof n!="number"?{value:r.below,isFallback:!0,matchInfo:{strategyType:"score"}}:{value:n>=r.threshold?r.above:r.below,isFallback:!1,matchInfo:{strategyType:"score"}}}function Ey(r,e){let{state:t,events:n,sessionMetrics:i,accumulator:s}=e;return{context:r,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:n?{hasRecentEvent:(o,a)=>n.hasRecentEvent(o,a)}:void 0,accumulator:s?{getCount:(o,a)=>s.getCount(o,a)}:void 0}}async function Cy(r,e,t={}){let n=Ey(e,t);switch(r.type){case"rules":return sl(r,n);case"score":return ol(r,n);case"model":return{value:r.default,isFallback:!0,matchInfo:{strategyType:"model"}};case"external":return{value:r.default,isFallback:!0,matchInfo:{strategyType:"external"}};default:return console.warn("[DecisionEngine] Unknown strategy type:",r.type),{value:void 0,isFallback:!0,matchInfo:{strategyType:r.type}}}}function Ay(r,e,t={}){let n=Ey(e,t);switch(r.type){case"rules":return sl(r,n);case"score":return ol(r,n);case"model":case"external":return{value:r.default,isFallback:!0,matchInfo:{strategyType:r.type}};default:return{value:void 0,isFallback:!0,matchInfo:{strategyType:r.type}}}}function kd(r){return{evaluate:(e,t)=>Cy(e,t,r),evaluateSync:(e,t)=>Ay(e,t,r)}}function Sd(r){let{eventBus:e,stateStore:t}=r,n=new Map,i=new Set,s=null,o=t.ns("accumulator");function a(c){let u=!1;for(let p of n.values()){if(!p.predicate(c))continue;let h=o.get(p.stateKey)||{count:0};h.count++,p.needsTimestamps&&(h.timestamps||(h.timestamps=[]),h.timestamps.push(c.ts),h.timestamps.length>200&&(h.timestamps=h.timestamps.slice(-200))),o.set(p.stateKey,h),u=!0}if(u)for(let p of i)try{p()}catch(h){console.error("[EventAccumulator] Subscriber error:",h)}}function l(){s||n.size===0||(s=e.subscribe(a))}return{register(c,u,p=!1){let h=`ev:${c}`,f=n.get(h);if(f){p&&!f.needsTimestamps&&(f.needsTimestamps=!0);return}n.set(h,{stateKey:h,needsTimestamps:p,predicate:u}),l()},getCount(c,u){let p=`ev:${c}`,h=o.get(p);if(!h)return 0;if(u===void 0||!h.timestamps)return h.count;let f=Date.now()-u;return h.timestamps.filter(v=>v>=f).length},subscribe(c){return i.add(c),()=>{i.delete(c)}},destroy(){s&&(s(),s=null),n.clear(),i.clear()}}}var Hs=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 n of this.listeners)try{n(e,t)}catch{}}isNativeFunction(e){try{return Function.prototype.toString.call(e).includes("[native code]")}catch{return!1}}};var Ed="cooldown:";function Ry(r){return{set(e,t){let n=Ed+e,i=Date.now()+t;r.set(n,i)},isActive(e){return this.remaining(e)>0},remaining(e){let t=Ed+e,n=r.get(t);if(n===void 0)return 0;let i=n-Date.now();return i<=0?(r.remove(t),0):i},clear(e){let t=Ed+e;r.remove(t)}}}var Bs="dismissed:";function Ty(r,e){return{mark(t,n=!1){let i=Bs+t;(n?e:r).set(i,!0)},isDismissed(t){let n=Bs+t;return r.has(n)||e.has(n)},clear(t){let n=Bs+t;r.remove(n),e.remove(n)},clearAll(){for(let t of r.keys())t.startsWith(Bs)&&r.remove(t);for(let t of e.keys())t.startsWith(Bs)&&e.remove(t)}}}var Cd="freq:";function Iy(r){function e(t){let n=Cd+t,i=r.get(n);if(i){if(i.resetAt&&Date.now()>=i.resetAt){r.remove(n);return}return i}}return{increment(t,n){let i=Cd+t,s=e(t),o=(s?.count??0)+1,a={count:o,resetAt:s?.resetAt??(n?Date.now()+n:void 0)};return r.set(i,a),o},count(t){return e(t)?.count??0},reset(t){let n=Cd+t;r.remove(n)},hasReachedLimit(t,n){return this.count(t)>=n}}}var tC="syntro";function Ad(r,e){let t=`${e}:`;return{get(n){if(r)try{let i=r.getItem(t+n);if(!i)return;let s=JSON.parse(i);if(s.expiresAt&&Date.now()>=s.expiresAt){r.removeItem(t+n);return}return s.value}catch{return}},set(n,i,s){if(r)try{let o={value:i,expiresAt:s?Date.now()+s:void 0};r.setItem(t+n,JSON.stringify(o))}catch(o){console.warn("[StateStore] Failed to save:",o)}},remove(n){r&&r.removeItem(t+n)},has(n){return r?this.get(n)!==void 0:!1},keys(){if(!r)return[];let n=[];for(let i=0;i<r.length;i++){let s=r.key(i);s?.startsWith(t)&&n.push(s.slice(t.length))}return n},clear(){if(!r)return;let n=this.keys();for(let i of n)r.removeItem(t+i)}}}function Vs(r){let e=new Map,t=`${r}:`;return{get(n){let i=e.get(t+n);if(i){if(i.expiresAt&&Date.now()>=i.expiresAt){e.delete(t+n);return}return i.value}},set(n,i,s){e.set(t+n,{value:i,expiresAt:s?Date.now()+s:void 0})},remove(n){e.delete(t+n)},has(n){return this.get(n)!==void 0},keys(){let n=[];for(let i of e.keys())i.startsWith(t)&&n.push(i.slice(t.length));return n},clear(){for(let n of e.keys())n.startsWith(t)&&e.delete(n)}}}var al=class{constructor(e={}){this.namespacedStorages=new Map;this.namespace=e.namespace??tC;let t=n=>typeof n=="object"&&n!==null&&typeof n.setItem=="function";typeof window<"u"?(this.session=t(window.sessionStorage)?Ad(window.sessionStorage,this.namespace):Vs(this.namespace),this.user=t(window.localStorage)?Ad(window.localStorage,this.namespace):Vs(this.namespace)):(this.session=Vs(this.namespace),this.user=Vs(this.namespace)),this.dismissals=Ty(this.session,this.user),this.cooldowns=Ry(this.user),this.frequency=Iy(this.session)}ns(e){let t=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(t)){let n=typeof window<"u"&&typeof sessionStorage<"u"?Ad(sessionStorage,t):Vs(t);this.namespacedStorages.set(t,n)}return this.namespacedStorages.get(t)}};function Rd(r={}){return new al(r)}function js(r){return r.startsWith("inline:")?"inline":r.startsWith("adjacent:")?"adjacent":"static"}function ll(r){return r.startsWith("inline:")?r.slice(7):r.startsWith("adjacent:")?r.slice(9):null}var $y={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"}},Ws={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:[]},My={duration:200,easing:"cubic-bezier(0.16, 1, 0.3, 1)",fill:"forwards"};function Td(r,e,t){let n=$y[e];Object.assign(r.style,n),t&&(t.maxWidth&&(r.style.maxWidth=t.maxWidth),t.maxHeight&&(r.style.maxHeight=t.maxHeight),t.minWidth&&(r.style.minWidth=t.minWidth),t.minHeight&&(r.style.minHeight=t.minHeight))}function Id(r,e,t){let n=t.placement==="auto"?"bottom":t.placement,i=[No(t.offset?{mainAxis:t.offset.y,crossAxis:t.offset.x}:8)];return t.flip!==!1&&i.push(Fo()),t.shift!==!1&&i.push(Lo({padding:8})),r.style.position="absolute",r.style.zIndex="2147483646",Po(e,r,async()=>{let{x:o,y:a,strategy:l}=await Do(e,r,{placement:n,middleware:i});Object.assign(r.style,{position:l,left:`${o}px`,top:`${a}px`})})}function $d(r,e,t="append"){return r.style.position="relative",r.style.display="inline-block",t==="prepend"?e.insertBefore(r,e.firstChild):e.appendChild(r),()=>{r.remove()}}function Md(r,e){return e==="none"||Ws[e].length===0?null:r.animate(Ws[e],My)}function Od(r,e){if(e==="none"||Ws[e].length===0)return Promise.resolve();let t=[...Ws[e]].reverse(),n=r.animate(t,My);return new Promise(i=>{n.onfinish=()=>i(),n.oncancel=()=>i()})}function Pd(r,e){let t=document.createElement("div");return t.setAttribute("data-syntro-surface",r),t.setAttribute("data-syntro-mount-id",e),t.className="syntro-surface",Object.assign(t.style,{pointerEvents:"auto",boxSizing:"border-box",overflow:"auto"}),t}function Nd(r){switch(js(r)){case"static":return r.startsWith("drawer")?2147483640:r.startsWith("overlay")?2147483642:r.startsWith("toast")?2147483644:2147483640;case"inline":return 1;case"adjacent":return 2147483638;default:return 2147483640}}function Oy(r){if(typeof window.Sanitizer=="function")try{let l=new window.Sanitizer({}).sanitizeToFragment(r),c=document.createElement("div");return c.append(l),c.innerHTML}catch{}let t=document.createElement("template");t.innerHTML=r;let n=t.content,i=document.createTreeWalker(n,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(),p=c.value.trim().toLowerCase(),h=u.startsWith("on"),f=(u==="href"||u==="src")&&p.startsWith("javascript:");(h||f)&&a.removeAttribute(c.name)}}for(let a of o){for(;a.firstChild;)a.parentNode?.insertBefore(a.firstChild,a);a.remove()}return t.innerHTML=(n.firstChild,t.innerHTML)}var rC=0;function Ld(r){let{overlayRoot:e,eventBus:t,anchorResolver:n,defaultAnimation:i="fade",widgetRegistry:s}=r,o=new Map,a=new Map,l=new Map;function c(){return`mount-${++rC}`}function u(_,w){t&&t.publish(_,w)}function p(_){let w=l.get(_);if(w){let R=g(_);for(let b of w)try{b(R)}catch(A){console.error("[Surfaces] State callback error:",A)}}}let h=new Map;function f(_,w,R){switch(w.type){case"html":_.innerHTML=Oy(w.content);return;case"widget":{if(s?.has(w.widgetId)){let b=s.mount(w.widgetId,_,w.config);return R&&h.set(R,b),()=>{b.unmount(),R&&h.delete(R)}}console.warn(`[Surfaces] Widget not found: ${w.widgetId}`),_.innerHTML=`<div data-widget-id="${w.widgetId}" data-widget-missing="true">Widget: ${w.widgetId}</div>`;return}case"custom":return w.mount(_);case"react":_.innerHTML="<div data-react-component>React Component</div>";return;default:console.warn("[Surfaces] Unknown content type");return}}function v(_,w,R){let b=c(),A=js(_),$=R?.priority??0,N=R?.animation??i,M=R?.exclusive??!0,K=o.get(_);if(K&&M){if(K.options.priority>$)throw new Error(`Slot ${_} is occupied by higher priority content (${K.options.priority} > ${$})`);m(K)}let L=Pd(_,b);L.style.zIndex=String(Nd(_));let O;if(A==="static")Td(L,_,R?.constraints),e.appendChild(L);else if(A==="inline"){let C=ll(_);if(!C)throw new Error(`Invalid inline slot: ${_}`);if(!n)throw new Error("Anchor resolver required for inline slots");let P=n({selector:C,route:"**"});if(!P)throw new Error(`Anchor not found for inline slot: ${C}`);O=$d(L,P)}else if(A==="adjacent"){let C=ll(_);if(!C)throw new Error(`Invalid adjacent slot: ${_}`);if(!n)throw new Error("Anchor resolver required for adjacent slots");let P=n({selector:C,route:"**"});if(!P)throw new Error(`Anchor not found for adjacent slot: ${C}`);e.appendChild(L),O=Id(L,P,R?.position??{placement:"bottom"})}let q=f(L,w,b);Md(L,N);let Y={id:b,slot:_,content:w,options:{priority:$,exclusive:M,animation:N,position:R?.position??{placement:"auto"},constraints:R?.constraints??{},adaptiveId:R?.adaptiveId,autoUnmountOnRouteChange:R?.autoUnmountOnRouteChange??!0},container:L,cleanup:()=>{O?.(),q?.()},mountedAt:Date.now()};return o.set(_,Y),a.set(_,(a.get(_)??0)+1),u("surface.mounted",{slot:_,id:b,adaptiveId:R?.adaptiveId}),p(_),{id:b,update(C){let P=o.get(_);if(!P||P.id!==b)throw new Error("Mount no longer active");let G=h.get(b);if(G){if(C.type==="widget"){G.update(C.config),P.content=C;return}G.unmount(),h.delete(b)}P.container.innerHTML="";let pe=f(P.container,C,b);if(P.content=C,pe){let ce=P.cleanup;P.cleanup=()=>{ce?.(),pe()}}},setOptions(C){let P=o.get(_);if(!P||P.id!==b)throw new Error("Mount no longer active");C.priority!==void 0&&(P.options.priority=C.priority),C.animation!==void 0&&(P.options.animation=C.animation),C.constraints&&A==="static"&&(C.constraints.maxWidth&&(P.container.style.maxWidth=C.constraints.maxWidth),C.constraints.maxHeight&&(P.container.style.maxHeight=C.constraints.maxHeight),C.constraints.minWidth&&(P.container.style.minWidth=C.constraints.minWidth),C.constraints.minHeight&&(P.container.style.minHeight=C.constraints.minHeight)),p(_)},async unmount(){let C=o.get(_);!C||C.id!==b||await m(C)},isMounted(){return o.get(_)?.id===b},getContainer(){let C=o.get(_);return C?.id===b?C.container:null}}}async function m(_){_.container.isConnected&&await Od(_.container,_.options.animation);try{_.cleanup?.()}catch(w){console.warn("[Surfaces] Cleanup error during unmount, ignoring:",w)}try{_.container.remove()}catch{}o.delete(_.slot),u("surface.unmounted",{slot:_.slot,id:_.id}),p(_.slot)}function g(_){let w=o.get(_);return{slot:_,occupied:!!w,currentPriority:w?.options.priority,currentAdaptiveId:w?.options.adaptiveId,mountCount:a.get(_)??0,currentMountId:w?.id}}function y(_,w){let R=l.get(_);return R||(R=new Set,l.set(_,R)),R.add(w),()=>{R?.delete(w),R?.size===0&&l.delete(_)}}function x(_,w){let R=o.get(_);return R?w!==void 0?w>=R.options.priority:!1:!0}function k(){for(let _ of o.values())try{_.cleanup?.(),_.container.remove()}catch(w){console.error("[Surfaces] Error during cleanup:",w)}o.clear(),l.clear()}return{mount:v,getState:g,onStateChange:y,canMount:x,destroy:k}}var cl=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,n="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:n,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,n]of this.widgets.entries())n.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,n){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={...n,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 p={...c,runtime:this.runtimeRef},h=i.widget.mount(t,p);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(n){console.error("[WidgetRegistry] Listener error:",n)}}destroy(){for(let[e,t]of this.mountedWidgets.entries())t.cleanup?.(),t.container.innerHTML="";this.mountedWidgets.clear()}},Fd=new cl;var Ny="2.0.0";function nC(r,e){if(!e)return!0;let t;try{t=new URL(r).pathname}catch{t=r}t.startsWith("/")||(t=`/${t}`);let n=t.replace(/\/$/,"")||"/";if(e.exclude){for(let i of e.exclude)if(Dd(n,i))return!1}if(e.include&&e.include.length>0){for(let i of e.include)if(Dd(n,i))return!0;return!1}return!0}function Dd(r,e){let t=e.replace(/\/$/,"")||"/";if(r===t)return!0;let n=t.replace(/\*\*/g,"\0GLOBSTAR\0").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\0GLOBSTAR\0/g,".*").replace(/:[^/]+/g,"[^/]+");return new RegExp(`^${n}$`).test(r)}function Py(r){let t=(typeof window<"u"?window.location.pathname:"/").replace(/\/$/,"")||"/";return(Array.isArray(r.route)?r.route:[r.route]).some(i=>{let s=i;if(/^https?:\/\//.test(s))try{s=new URL(s).pathname}catch{}return Dd(t,s)})}function Hd(r={}){let{telemetry:e,sessionMetrics:t,routes:n,mode:i="production",namespace:s}=r,o=r.widgets??Fd,a=r.executors??sr,l=r.apps??Xi,c=new Hs,u=wd({telemetry:e,routes:n,navigation:c}),p=r.events??$s(),h=Rd({namespace:s}),f=Sd({eventBus:p,stateStore:h}),v=kd({state:h,events:p,sessionMetrics:t,accumulator:f}),m=bv(),g=Vu(),y=M=>Py(M)?g.resolve(M.selector):null,x=async(M,K)=>{if(!Py(M))return null;try{return await g.waitFor(M.selector,K)}catch{return null}},k=Ld({overlayRoot:m,eventBus:p,anchorResolver:y,widgetRegistry:o}),_=Fu({overlayRoot:m,eventBus:p,surfaces:k,anchorResolver:y,waitForAnchor:x,executorRegistry:a,subscribeNavigation:M=>c.subscribe(M),runtime:{evaluateSync:M=>v.evaluateSync(M,u.get()),context:u,accumulator:f,sessionMetrics:t,events:p?{subscribe:M=>p.subscribe(()=>M())}:void 0}}),w;if(t){let M=t;M.increment("page_views");let K=typeof window<"u"?window.location.pathname:"/";w=c.subscribe((L,O)=>{if(O!=="replaceState")try{let q=new URL(L).pathname;q!==K&&(K=q,M.increment("page_views"),R=0,M.set("time_on_page",0),M.set("scroll_depth",0))}catch{}})}let R=0,b,A;if(t){let M=t;b=setInterval(()=>{R++},1e3),A=setInterval(()=>{M.set("time_on_page",R)},5e3)}let $;if(t&&p){let M=t;$=p.subscribe({names:["ui.scroll"]},K=>{let L=K.props?.scrollPercentage;typeof L=="number"&&L>M.get("scroll_depth")&&M.set("scroll_depth",L)})}let N={telemetry:e,context:u,events:p,state:h,sessionMetrics:t,actions:_,surfaces:k,widgets:o,executors:a,apps:l,accumulator:f,anchorResolver:g,navigation:c,version:Ny,mode:i,async evaluate(M){return v.evaluate(M,u.get())},evaluateSync(M){return v.evaluateSync(M,u.get())},async filterTiles(M){let K=u.get().page.url,L=[];for(let O of M){let q=O.activation;if(!q){L.push(O);continue}if(nC(K,q.routes)){if(q.onlyIfPopulated){let Y=O.props?.actions??[];if(Y.length>0&&!Y.some(C=>C.triggerWhen?v.evaluateSync(C.triggerWhen,u.get()).value:!0))continue}L.push(O)}}return L},setRoutes(M){u.setRoutes(M)},destroy(){l.unbind().catch(M=>{console.error("[Runtime] Error unbinding apps registry:",M)}),w?.(),$?.(),b&&clearInterval(b),A&&clearInterval(A),g.destroy(),f.destroy(),c.destroy(),u.destroy(),_.destroy(),k.destroy()}};return l.bind(N),o.bindRuntime(N),N}var Us=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,n){this.telemetry.track?.("syntro_intervention_interacted",{variant_id:this.variantId,intervention_id:e,intervention_kind:t,interaction_type:n})}resetPage(){this.seenSet.clear(),this.triggeredSet.clear()}};function iC(){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="";for(let t=0;t<16;t++)e+=r[Math.floor(Math.random()*r.length)];return e}var Bd=class{constructor(){this.sessionId=iC(),console.log(`[Syntro Telemetry] Using noop adapter (no telemetry configured). sessionId=${this.sessionId}`)}trackCanvasOpened(e){}trackCanvasClosed(e){}trackRectangleViewed(e,t){}trackAction(e,t,n){}register(e){}getSessionId(){return this.sessionId}startSessionRecording(){}trackExperiment(e,t,n){}setPersonProperties(e){}setPersonPropertiesOnce(e){}getDistinctId(){return"demo-user"}getAllFeatureFlags(){return{}}getSegmentFlags(){return{}}track(e,t){}};function Vd(){return new Bd}var E=typeof window<"u"?window:void 0,Ze=typeof globalThis<"u"?globalThis:E;typeof self>"u"&&(Ze.self=Ze),typeof File>"u"&&(Ze.File=function(){});var $_=Array.prototype,Ly=$_.forEach,Fy=$_.indexOf,dt=Ze?.navigator,D=Ze?.document,qe=Ze?.location,sp=Ze?.fetch,op=Ze!=null&&Ze.XMLHttpRequest&&"withCredentials"in new Ze.XMLHttpRequest?Ze.XMLHttpRequest:void 0,Dy=Ze?.AbortController,st=dt?.userAgent,X=E??{},ur={DEBUG:!1,LIB_VERSION:"1.341.0"};function Hy(r,e,t,n,i,s,o){try{var a=r[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(n,i)}function yi(r){return function(){var e=this,t=arguments;return new Promise((function(n,i){var s=r.apply(e,t);function o(l){Hy(s,n,i,o,a,"next",l)}function a(l){Hy(s,n,i,o,a,"throw",l)}o(void 0)}))}}function V(){return V=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},V.apply(null,arguments)}function M_(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}var sC=["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"],By=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return sC.concat(e).some((n=>{var i=n.toLowerCase();return t.indexOf(i)!==-1}))},oC=["$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 le(r,e){return r.indexOf(e)!==-1}var Hl=function(r){return r.trim()},ap=function(r){return r.replace(/^\$/,"")},aC=Array.isArray,O_=Object.prototype,P_=O_.hasOwnProperty,Bl=O_.toString,fe=aC||function(r){return Bl.call(r)==="[object Array]"},Vr=r=>typeof r=="function",Pe=r=>r===Object(r)&&!fe(r),_i=r=>{if(Pe(r)){for(var e in r)if(P_.call(r,e))return!1;return!0}return!1},H=r=>r===void 0,Ne=r=>Bl.call(r)=="[object String]",lp=r=>Ne(r)&&r.trim().length===0,Nt=r=>r===null,ue=r=>H(r)||Nt(r),mr=r=>Bl.call(r)=="[object Number]"&&r==r,mi=r=>mr(r)&&r>0,gr=r=>Bl.call(r)==="[object Boolean]",lC=r=>r instanceof FormData,cC=r=>le(oC,r);function cp(r){return r===null||typeof r!="object"}function vl(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function N_(r){return!H(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(r,Event)}var uC=[!0,"true",1,"1","yes"],jd=r=>le(uC,r),dC=[!1,"false",0,"0","no"];function qt(r,e,t,n,i){return e>t&&(n.warn("min cannot be greater than max."),e=t),mr(r)?r>t?(n.warn(" cannot be greater than max: "+t+". Using max value instead."),t):r<e?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):r:(n.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+i),qt(i||t,e,t,n))}var up=class{constructor(e){this.t={},this.i=e.i,this.o=qt(e.bucketSize,0,100,e.h),this.m=qt(e.refillRate,0,this.o,e.h),this.$=qt(e.refillInterval,0,864e5,e.h)}S(e,t){var n=t-e.lastAccess,i=Math.floor(n/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,n=Date.now(),i=String(e),s=this.t[i];return s?this.S(s,n):(s={tokens:this.o,lastAccess:n},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={}}},xt="Mobile",yl="iOS",fr="Android",po="Tablet",L_=fr+" "+po,F_="iPad",D_="Apple",H_=D_+" Watch",ho="Safari",ki="BlackBerry",B_="Samsung",V_=B_+"Browser",j_=B_+" Internet",Pn="Chrome",pC=Pn+" OS",W_=Pn+" "+yl,yh="Internet Explorer",U_=yh+" "+xt,_h="Opera",hC=_h+" Mini",bh="Edge",z_="Microsoft "+bh,xi="Firefox",q_=xi+" "+yl,fo="Nintendo",go="PlayStation",wi="Xbox",Z_=fr+" "+xt,G_=xt+" "+ho,eo="Windows",dp=eo+" Phone",Vy="Nokia",pp="Ouya",K_="Generic",fC=K_+" "+xt.toLowerCase(),Y_=K_+" "+po.toLowerCase(),hp="Konqueror",Qe="(\\d+(\\.\\d+)?)",Wd=new RegExp("Version/"+Qe),gC=new RegExp(wi,"i"),mC=new RegExp(go+" \\w+","i"),vC=new RegExp(fo+" \\w+","i"),xh=new RegExp(ki+"|PlayBook|BB10","i"),yC={"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"},ul,jy,Ud,_C=(r,e)=>e&&le(e,D_)||(function(t){return le(t,ho)&&!le(t,Pn)&&!le(t,fr)})(r),X_=function(r,e){return e=e||"",le(r," OPR/")&&le(r,"Mini")?hC:le(r," OPR/")?_h:xh.test(r)?ki:le(r,"IE"+xt)||le(r,"WPDesktop")?U_:le(r,V_)?j_:le(r,bh)||le(r,"Edg/")?z_:le(r,"FBIOS")?"Facebook "+xt:le(r,"UCWEB")||le(r,"UCBrowser")?"UC Browser":le(r,"CriOS")?W_:le(r,"CrMo")||le(r,Pn)?Pn:le(r,fr)&&le(r,ho)?Z_:le(r,"FxiOS")?q_:le(r.toLowerCase(),hp.toLowerCase())?hp:_C(r,e)?le(r,xt)?G_:ho:le(r,xi)?xi:le(r,"MSIE")||le(r,"Trident/")?yh:le(r,"Gecko")?xi:""},bC={[U_]:[new RegExp("rv:"+Qe)],[z_]:[new RegExp(bh+"?\\/"+Qe)],[Pn]:[new RegExp("("+Pn+"|CrMo)\\/"+Qe)],[W_]:[new RegExp("CriOS\\/"+Qe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Qe)],[ho]:[Wd],[G_]:[Wd],[_h]:[new RegExp("(Opera|OPR)\\/"+Qe)],[xi]:[new RegExp(xi+"\\/"+Qe)],[q_]:[new RegExp("FxiOS\\/"+Qe)],[hp]:[new RegExp("Konqueror[:/]?"+Qe,"i")],[ki]:[new RegExp(ki+" "+Qe),Wd],[Z_]:[new RegExp("android\\s"+Qe,"i")],[j_]:[new RegExp(V_+"\\/"+Qe)],[yh]:[new RegExp("(rv:|MSIE )"+Qe)],Mozilla:[new RegExp("rv:"+Qe)]},xC=function(r,e){var t=X_(r,e),n=bC[t];if(H(n))return null;for(var i=0;i<n.length;i++){var s=n[i],o=r.match(s);if(o)return parseFloat(o[o.length-2])}return null},Wy=[[new RegExp(wi+"; "+wi+" (.*?)[);]","i"),r=>[wi,r&&r[1]||""]],[new RegExp(fo,"i"),[fo,""]],[new RegExp(go,"i"),[go,""]],[xh,[ki,""]],[new RegExp(eo,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[dp,""];if(new RegExp(xt).test(e)&&!/IEMobile\b/.test(e))return[eo+" "+xt,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],i=yC[n]||"";return/arm/i.test(e)&&(i="RT"),[eo,i]}return[eo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[yl,e.join(".")]}return[yl,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=H(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+fr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+fr+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[fr,e.join(".")]}return[fr,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[pC,""]],[/Linux|debian/i,["Linux",""]]],Uy=function(r){return vC.test(r)?fo:mC.test(r)?go:gC.test(r)?wi:new RegExp(pp,"i").test(r)?pp:new RegExp("("+dp+"|WPDesktop)","i").test(r)?dp:/iPad/.test(r)?F_:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?H_:xh.test(r)?ki:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(Vy,"i").test(r)?Vy:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r)||/(kf[a-z]+)( bui|\)).+silk\//i.test(r)?"Kindle Fire":/(Android|ZTE)/i.test(r)?new RegExp(xt).test(r)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r)||/pixel[\daxl ]{1,6}/i.test(r)&&!/pixel c/i.test(r)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r)||/lmy47v/i.test(r)&&!/QTAQZ3/i.test(r)?fr:L_:new RegExp("(pda|"+xt+")","i").test(r)?fC:new RegExp(po,"i").test(r)&&!new RegExp(po+" pc","i").test(r)?Y_:""},wC=r=>r instanceof Error;function kC(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return Ud&&t.length===jy||(jy=t.length,Ud=t.reduce(((n,i)=>{ul||(ul={});var s=ul[i];if(s)n[s[0]]=s[1];else for(var o=r(i),a=o.length-1;a>=0;a--){var l=o[a],c=l?.filename,u=e[i];if(c&&u){n[c]=u,ul[i]=[c,u];break}}return n}),{})),Ud}}var fp=class{constructor(e,t,n){n===void 0&&(n=[]),this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t){t===void 0&&(t={});var n=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,t,0).apply(e),s=this.buildParsingContext(),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,n),$exception_level:"error"}}modifyFrames(e){var t=this;return yi((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&fe(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.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 n,i;return e.cause!=null&&(n=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),V({},e,{cause:n,stack:i})}applyChunkIds(e,t){return e.map((n=>(n.filename&&t&&(n.chunk_id=t[n.filename]),n)))}applyCoercers(e,t){for(var n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return yi((function*(){var n=e;for(var i of t.modifiers)n=yield i(n);return n}))()}convertToExceptionList(e,t){var n,i,s,o={type:e.type,value:e.value,mechanism:{type:(n=t.type)!==null&&n!==void 0?n:"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,V({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:kC(this.stackParser)}}buildCoercingContext(e,t,n){n===void 0&&(n=0);var i=(s,o)=>{if(o<=4){var a=this.buildCoercingContext(e,t,o);return this.applyCoercers(s,a)}};return V({},t,{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:s=>i(s,n),next:s=>i(s,n+1)})}},Si="?";function gp(r,e,t,n,i){var s={platform:r,filename:e,function:t==="<anonymous>"?Si:t,in_app:!0};return H(n)||(s.lineno=n),H(i)||(s.colno=i),s}var J_=(r,e)=>{var t=r.indexOf("safari-extension")!==-1,n=r.indexOf("safari-web-extension")!==-1;return t||n?[r.indexOf("@")!==-1?r.split("@")[0]:Si,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},SC=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,EC=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,CC=/\((\S*)(?::(\d+))(?::(\d+))\)/,AC=(r,e)=>{var t=SC.exec(r);if(t){var[,n,i,s]=t;return gp(e,n,Si,+i,+s)}var o=EC.exec(r);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=CC.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=J_(o[1]||Si,o[2]);return gp(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},RC=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,TC=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,IC=(r,e)=>{var t=RC.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=TC.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var i=t[3],s=t[1]||Si;return[s,i]=J_(s,i),gp(e,i,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},zy=/\(error: (.*)\)/,qy=50;function $C(){return(function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return function(i,s){s===void 0&&(s=0);for(var o=[],a=i.split(`
1008
1008
  `),l=s;l<a.length;l++){var c=a[l];if(!(c.length>1024)){var u=zy.test(c)?c.replace(zy,"$1"):c;if(!u.match(/\S*Error: /)){for(var p of t){var h=p(u,r);if(h){o.push(h);break}}if(o.length>=qy)break}}}return(function(f){if(!f.length)return[];var v=Array.from(f);return v.reverse(),v.slice(0,qy).map((m=>{return V({},m,{filename:m.filename||(g=v,g[g.length-1]||{}).filename,function:m.function||Si});var g}))})(o)}})("web:javascript",AC,IC)}var mp=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=Ne(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?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 vl(e,"DOMException")}isDOMError(e){return vl(e,"DOMError")}},vp=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 n=e.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(e){return e.stacktrace||e.stack||void 0}},yp=class{constructor(){}match(e){return vl(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var n,i=t.apply(e.error);return i||{type:"ErrorEvent",value:e.message,stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},MC=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,_p=class{match(e){return typeof e=="string"}coerce(e,t){var n,[i,s]=this.getInfos(e);return{type:i??"Error",value:s??e,stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}getInfos(e){var t="Error",n=e,i=e.match(MC);return i&&(t=i[1],n=i[2]),[t,n]}},OC=["fatal","error","warning","log","info","debug"];function Q_(r,e){e===void 0&&(e=40);var t=Object.keys(r);if(t.sort(),!t.length)return"[object has no keys]";for(var n=t.length;n>0;n--){var i=t.slice(0,n).join(", ");if(!(i.length>e))return n===t.length||i.length<=e?i:i.slice(0,e)+"..."}return""}var bp=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var n,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(n=t.syntheticException)==null?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return N_(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 n=this.getObjectClassName(e);return(n&&n!=="Object"?"'"+n+"'":"Object")+" captured as exception with keys: "+Q_(e)}isSeverityLevel(e){return Ne(e)&&!lp(e)&&OC.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];if(wC(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},xp=class{match(e){return N_(e)}coerce(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Q_(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},wp=class{match(e){return cp(e)}coerce(e,t){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},kp=class{match(e){return vl(e,"PromiseRejectionEvent")}coerce(e,t){var n,i=this.getUnhandledRejectionReason(e);return cp(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){if(cp(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}},eb=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,n={k:function(i){if(E&&(ur.DEBUG||X.POSTHOG_DEBUG||t)&&!H(E.console)&&E.console){for(var s=("__rrweb_original__"in E.console[i])?E.console[i].__rrweb_original__:E.console[i],o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];s(r,...a)}},info:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];n.k("log",...s)},warn:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];n.k("warn",...s)},error:function(){for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];n.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(r,...s)},uninitializedWarning:i=>{n.error("You must initialize PostHog before calling "+i)},createLogger:(i,s)=>eb(r+" "+i,s)};return n},B=eb("[PostHog.js]"),Te=B.createLogger,PC=Te("[ExternalScriptsLoader]"),Zy=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return PC.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var n=D?.querySelectorAll("script");if(n){for(var i,s=function(){if(n[o].src===e){var l=n[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<n.length;o++)if(i=s())return i.v}var a=()=>{if(!D)return t("document not found");var l=D.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=p=>{l.__posthog_loading_callback_fired=!0,t(void 0,p)},l.onerror=p=>t(p),r.config.prepare_external_dependency_script&&(l=r.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(r.config.external_scripts_inject_target==="head")D.head.appendChild(l);else{var c,u=D.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):D.body.appendChild(l)}};D!=null&&D.body?a():D?.addEventListener("DOMContentLoaded",a)};X.__PosthogExtensions__=X.__PosthogExtensions__||{},X.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var n="/static/"+e+".js?v="+r.version;if(e==="remote-config"&&(n="/array/"+r.config.token+"/config.js"),e==="toolbar"){var i=3e5;n=n+"&t="+Math.floor(Date.now()/i)*i}var s=r.requestRouter.endpointFor("assets",n);Zy(r,s,t)},X.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var n=r.requestRouter.endpointFor("api",e);Zy(r,n,t)};var _l={};function jr(r,e,t){if(fe(r)){if(Ly&&r.forEach===Ly)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var n=0,i=r.length;n<i;n++)if(n in r&&e.call(t,r[n],n)===_l)return}}}function xe(r,e,t){if(!ue(r)){if(fe(r))return jr(r,e,t);if(lC(r)){for(var n of r.entries())if(e.call(t,n[1],n[0])===_l)return}else for(var i in r)if(P_.call(r,i)&&e.call(t,r[i],i)===_l)return}}var $e=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return jr(t,(function(i){for(var s in i)i[s]!==void 0&&(r[s]=i[s])})),r},Ci=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return jr(t,(function(i){jr(i,(function(s){r.push(s)}))})),r};function gl(r){for(var e=Object.keys(r),t=e.length,n=new Array(t);t--;)n[t]=[e[t],r[e[t]]];return n}var Gy=function(r){try{return r()}catch{return}},NC=function(r){return function(){try{for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.apply(this,t)}catch(i){B.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),B.critical(i)}}},wh=function(r){var e={};return xe(r,(function(t,n){(Ne(t)&&t.length>0||mr(t))&&(e[n]=t)})),e};function LC(r,e){return t=r,n=s=>Ne(s)&&!Nt(e)?s.slice(0,e):s,i=new Set,(function s(o,a){return o!==Object(o)?n?n(o,a):o:i.has(o)?void 0:(i.add(o),fe(o)?(l=[],jr(o,(c=>{l.push(s(c))}))):(l={},xe(o,((c,u)=>{i.has(c)||(l[u]=s(c,u))}))),l);var l})(t);var t,n,i}var FC=["herokuapp.com","vercel.app","netlify.app"];function DC(r){var e=r?.hostname;if(!Ne(e))return!1;var t=e.split(".").slice(-2).join(".");for(var n of FC)if(t===n)return!1;return!0}function tb(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function Oe(r,e,t,n){var{capture:i=!1,passive:s=!0}=n??{};r?.addEventListener(e,t,{capture:i,passive:s})}var rb="$people_distinct_id",to="__alias",ro="__timers",Ky="$autocapture_disabled_server_side",Sp="$heatmaps_enabled_server_side",Yy="$exception_capture_enabled_server_side",Ep="$error_tracking_suppression_rules",Xy="$error_tracking_capture_extension_exceptions",Jy="$web_vitals_enabled_server_side",nb="$dead_clicks_enabled_server_side",Qy="$product_tours_enabled_server_side",e_="$web_vitals_allowed_metrics",zd="$session_recording_remote_config",bl="$sesid",ib="$session_is_sampled",bi="$enabled_feature_flags",no="$early_access_features",Cp="$feature_flag_details",io="$stored_person_properties",On="$stored_group_properties",Ap="$surveys",xl="$flag_call_reported",dr="$user_state",Rp="$client_session_props",Tp="$capture_rate_limit",Ip="$initial_campaign_params",$p="$initial_referrer_info",wl="$initial_person_info",kl="$epp",sb="__POSTHOG_TOOLBAR__",zs="$posthog_cookieless",HC=[rb,to,"__cmpns",ro,"$session_recording_enabled_server_side",Sp,bl,bi,Ep,dr,no,Cp,On,io,Ap,xl,Rp,Tp,Ip,$p,kl,wl,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function t_(r){return r instanceof Element&&(r.id===sb||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function Vl(r){return!!r&&r.nodeType===1}function Wr(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function ob(r){return!!r&&r.nodeType===3}function ab(r){return!!r&&r.nodeType===11}function kh(r){return r?Hl(r).split(/\s+/):[]}function r_(r){var e=E?.location.href;return!!(e&&r&&r.some((t=>e.match(t))))}function Sl(r){var e="";switch(typeof r.className){case"string":e=r.className;break;case"object":e=(r.className&&"baseVal"in r.className?r.className.baseVal:null)||r.getAttribute("class")||"";break;default:e=""}return kh(e)}function lb(r){return ue(r)?null:Hl(r).split(/(\s+)/).filter((e=>mo(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function yo(r){var e="";return Mp(r)&&!hb(r)&&r.childNodes&&r.childNodes.length&&xe(r.childNodes,(function(t){var n;ob(t)&&t.textContent&&(e+=(n=lb(t.textContent))!==null&&n!==void 0?n:"")})),Hl(e)}function cb(r){return H(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var Sh=["a","button","form","input","select","textarea","label"];function ub(r,e){if(H(e))return!0;var t,n=function(s){if(e.some((o=>s.matches(o))))return{v:!0}};for(var i of r)if(t=n(i))return t.v;return!1}function db(r){var e=r.parentNode;return!(!e||!Vl(e))&&e}var BC=["next","previous","prev",">","<"],n_=10,i_=[".ph-no-rageclick",".ph-no-capture"];function VC(r,e){if(!E||Eh(r))return!1;var t,n,i;if(gr(e)?(t=!!e&&i_,n=void 0):(t=(i=e?.css_selector_ignorelist)!==null&&i!==void 0?i:i_,n=e?.content_ignorelist),t===!1)return!1;var{targetElementList:s}=pb(r,!1);return!(function(o,a){if(o===!1||H(o))return!1;var l;if(o===!0)l=BC;else{if(!fe(o))return!1;if(o.length>n_)return B.error("[PostHog] content_ignorelist array cannot exceed "+n_+" items. Use css_selector_ignorelist for more complex matching."),!1;l=o.map((c=>c.toLowerCase()))}return a.some((c=>{var{safeText:u,ariaLabel:p}=c;return l.some((h=>u.includes(h)||p.includes(h)))}))})(n,s.map((o=>{var a;return{safeText:yo(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!ub(s,t)}var Eh=r=>!r||Wr(r,"html")||!Vl(r),pb=(r,e)=>{if(!E||Eh(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,n=[r],i=r;i.parentNode&&!Wr(i,"body");)if(ab(i.parentNode))n.push(i.parentNode.host),i=i.parentNode.host;else{var s=db(i);if(!s)break;if(e||Sh.indexOf(s.tagName.toLowerCase())>-1)t=!0;else{var o=E.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(t=!0)}n.push(s),i=s}return{parentIsUsefulElement:t,targetElementList:n}};function jC(r,e,t,n,i){var s,o,a,l;if(t===void 0&&(t=void 0),!E||Eh(r)||(s=t)!=null&&s.url_allowlist&&!r_(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&r_(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:p}=pb(r,n);if(!(function(v,m){var g=m?.element_allowlist;if(H(g))return!0;var y,x=function(_){if(g.some((w=>_.tagName.toLowerCase()===w)))return{v:!0}};for(var k of v)if(y=x(k))return y.v;return!1})(p,t)||!ub(p,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var h=E.getComputedStyle(r);if(h&&h.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var f=r.tagName.toLowerCase();switch(f){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&&(Sh.indexOf(f)>-1||r.getAttribute("contenteditable")==="true")}}function Mp(r){for(var e=r;e.parentNode&&!Wr(e,"body");e=e.parentNode){var t=Sl(e);if(le(t,"ph-sensitive")||le(t,"ph-no-capture"))return!1}if(le(Sl(r),"ph-include"))return!0;var n=r.type||"";if(Ne(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var i=r.name||r.id||"";return!(Ne(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 hb(r){return!!(Wr(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Wr(r,"select")||Wr(r,"textarea")||r.getAttribute("contenteditable")==="true")}var fb="(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})",WC=new RegExp("^(?:"+fb+")$"),UC=new RegExp(fb),gb="\\d{3}-?\\d{2}-?\\d{4}",zC=new RegExp("^("+gb+")$"),qC=new RegExp("("+gb+")");function mo(r,e){return e===void 0&&(e=!0),!(ue(r)||Ne(r)&&(r=Hl(r),(e?WC:UC).test((r||"").replace(/[- ]/g,""))||(e?zC:qC).test(r)))}function mb(r){var e=yo(r);return mo(e=(e+" "+vb(r)).trim())?e:""}function vb(r){var e="";return r&&r.childNodes&&r.childNodes.length&&xe(r.childNodes,(function(t){var n;if(t&&((n=t.tagName)==null?void 0:n.toLowerCase())==="span")try{var i=yo(t);e=(e+" "+i).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+vb(t)).trim())}catch(s){B.error("[AutoCapture]",s)}})),e}function ZC(r){return(function(e){var t=e.map((n=>{var i,s,o="";if(n.tag_name&&(o+=n.tag_name),n.attr_class)for(var a of(n.attr_class.sort(),n.attr_class))o+="."+a.replace(/"/g,"");var l=V({},n.text?{text:n.text}:{},{"nth-child":(i=n.nth_child)!==null&&i!==void 0?i:0,"nth-of-type":(s=n.nth_of_type)!==null&&s!==void 0?s:0},n.href?{href:n.href}:{},n.attr_id?{attr_id:n.attr_id}:{},n.attributes),c={};return gl(l).sort(((u,p)=>{var[h]=u,[f]=p;return h.localeCompare(f)})).forEach((u=>{var[p,h]=u;return c[s_(p.toString())]=s_(h.toString())})),o+=":",o+=gl(c).map((u=>{var[p,h]=u;return p+'="'+h+'"'})).join("")}));return t.join(";")})((function(e){return e.map((t=>{var n,i,s={text:(n=t.$el_text)==null?void 0:n.slice(0,400),tag_name:t.tag_name,href:(i=t.attr__href)==null?void 0:i.slice(0,2048),attr_class:GC(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return gl(t).filter((o=>{var[a]=o;return a.indexOf("attr__")===0})).forEach((o=>{var[a,l]=o;return s.attributes[a]=l})),s}))})(r))}function s_(r){return r.replace(/"|\\"/g,'\\"')}function GC(r){var e=r.attr__class;return e?fe(e)?e:kh(e):void 0}var El=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,n){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&&n-i.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}},Cl=r=>{var e=D?.createElement("a");return H(e)?null:(e.href=r,e)},KC=function(r,e){var t,n;e===void 0&&(e="&");var i=[];return xe(r,(function(s,o){H(s)||H(o)||o==="undefined"||(t=encodeURIComponent((a=>a instanceof File)(s)?s.name:s.toString()),n=encodeURIComponent(o),i[i.length]=n+"="+t)})),i.join(e)},Al=function(r,e){for(var t,n=((r.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<n.length;i++){var s=n[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{B.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},_o=function(r,e,t){if(!r||!e||!e.length)return r;for(var n=r.split("#"),i=n[0]||"",s=n[1],o=i.split("?"),a=o[1],l=o[0],c=(a||"").split("&"),u=[],p=0;p<c.length;p++){var h=c[p].split("=");fe(h)&&(e.includes(h[0])?u.push(h[0]+"="+t):u.push(c[p]))}var f=l;return a!=null&&(f+="?"+u.join("&")),s!=null&&(f+="#"+s),f},Rl=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},qd="$copy_autocapture",o_=Te("[AutoCapture]");function Zd(r,e){return e.length>r?e.slice(0,r)+"...":e}function YC(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!Vl(e));return e}function XC(r,e,t,n){var i=r.tagName.toLowerCase(),s={tag_name:i};Sh.indexOf(i)>-1&&!t&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=Zd(1024,mb(r)):s.$el_text=Zd(1024,yo(r)));var o=Sl(r);o.length>0&&(s.classes=o.filter((function(u){return u!==""}))),xe(r.attributes,(function(u){var p;if((!hb(r)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(n==null||!n.includes(u.name))&&!e&&mo(u.value)&&(p=u.name,!Ne(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var h=u.value;u.name==="class"&&(h=kh(h).join(" ")),s["attr__"+u.name]=Zd(1024,h)}}));for(var a=1,l=1,c=r;c=YC(c);)a++,c.tagName===r.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function JC(r,e){for(var t,n,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[r],u=r;u.parentNode&&!Wr(u,"body");)ab(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var p,h=[],f={},v=!1,m=!1;if(xe(c,(_=>{var w=Mp(_);_.tagName.toLowerCase()==="a"&&(v=_.getAttribute("href"),v=w&&v&&mo(v)&&v),le(Sl(_),"ph-no-capture")&&(m=!0),h.push(XC(_,s,o,a));var R=(function(b){if(!Mp(b))return{};var A={};return xe(b.attributes,(function($){if($.name&&$.name.indexOf("data-ph-capture-attribute")===0){var N=$.name.replace("data-ph-capture-attribute-",""),M=$.value;N&&M&&mo(M)&&(A[N]=M)}})),A})(_);$e(f,R)})),m)return{props:{},explicitNoCapture:m};if(o||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?h[0].$el_text=mb(r):h[0].$el_text=yo(r)),v){var g,y;h[0].attr__href=v;var x=(g=Cl(v))==null?void 0:g.host,k=E==null||(y=E.location)==null?void 0:y.host;x&&k&&x!==k&&(p=v)}return{props:$e({$event_type:i.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:ZC(h)},(t=h[0])!=null&&t.$el_text?{$el_text:(n=h[0])==null?void 0:n.$el_text}:{},p&&i.type==="click"?{$external_click_url:p}:{},f)}}var Op=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new El(e.config.rageclick),this.C=null}get R(){var e,t,n=Pe(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),n}F(){if(this.isBrowserSupported()){if(E&&D){var e=n=>{n=n||E?.event;try{this.O(n)}catch(i){o_.error("Failed to capture event",i)}};if(Oe(D,"submit",e,{capture:!0}),Oe(D,"change",e,{capture:!0}),Oe(D,"click",e,{capture:!0}),this.R.capture_copied_text){var t=n=>{n=n||E?.event,this.O(n,qd)};Oe(D,"copy",t,{capture:!0}),Oe(D,"cut",t,{capture:!0})}}}else o_.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({[Ky]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,n=[];return(t=this.C)==null||t.forEach((i=>{var s=D?.querySelectorAll(i);s?.forEach((o=>{e===o&&n.push(i)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[Ky],i=this.T;if(Nt(i)&&!gr(n)&&!this.instance.M())return!1;var s=(t=this.T)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!s}O(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,i=cb(e);ob(i)&&(i=i.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&VC(i,this.instance.config.rageclick)&&this.O(e,"$rageclick");var s=t===qd;if(i&&jC(i,e,this.R,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=JC(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===qd){var c,u=lb(E==null||(c=E.getSelection())==null?void 0:c.toString()),p=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=p}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return Vr(D?.querySelectorAll)}};Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return mr(r)&&isFinite(r)&&Math.floor(r)===r});var a_="0123456789abcdef",Pp=class r{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,n,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||e<0||t<0||n<0||i<0||e>0xffffffffffff||t>4095||n>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|n>>>24,s[9]=n>>>16,s[10]=n>>>8,s[11]=n,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new r(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+a_.charAt(this.bytes[t]>>>4)+a_.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 r(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}},Np=class{constructor(){this.A=0,this.j=0,this.D=new Lp}generate(){var e=this.generateOrAbort();if(H(e)){this.A=0;var t=this.generateOrAbort();if(H(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 Pp.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())}},l_,yb=r=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<r.length;e++)r[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return r};E&&!H(E.crypto)&&crypto.getRandomValues&&(yb=r=>crypto.getRandomValues(r));var Lp=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(yb(this.N),this.U=0),this.N[this.U++]}},Br=()=>QC().toString(),QC=()=>(l_||(l_=new Np)).generate(),qs="",e1=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function t1(r,e){if(e){var t=(function(i,s){if(s===void 0&&(s=D),qs)return qs;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),l="dmn_chk_"+Br();!qs&&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",qs=c)}return qs})(r);if(!t){var n=(i=>{var s=i.match(e1);return s?s[0]:""})(r);n!==t&&B.info("Warning: cookie subdomain discovery mismatch",n,t),t=n}return t?"; domain=."+t:""}return""}var zt={H:()=>!!D,B:function(r){B.error("cookieStore error: "+r)},q:function(r){if(D){try{for(var e=r+"=",t=D.cookie.split(";").filter((s=>s.length)),n=0;n<t.length;n++){for(var i=t[n];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(r){var e;try{e=JSON.parse(zt.q(r))||{}}catch{}return e},G:function(r,e,t,n,i){if(D)try{var s="",o="",a=t1(D.location.hostname,n);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),s="; expires="+l.toUTCString()}i&&(o="; secure");var c=r+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&B.warn("cookieStore warning: large cookie, len="+c.length),D.cookie=c,c}catch{return}},V:function(r,e){if(D!=null&&D.cookie)try{zt.G(r,"",-1,e)}catch{return}}},Gd=null,Ae={H:function(){if(!Nt(Gd))return Gd;var r=!0;if(H(E))r=!1;else try{var e="__mplssupport__";Ae.G(e,"xyz"),Ae.q(e)!=='"xyz"'&&(r=!1),Ae.V(e)}catch{r=!1}return r||B.error("localStorage unsupported; falling back to cookie store"),Gd=r,r},B:function(r){B.error("localStorage error: "+r)},q:function(r){try{return E?.localStorage.getItem(r)}catch(e){Ae.B(e)}return null},W:function(r){try{return JSON.parse(Ae.q(r))||{}}catch{}return null},G:function(r,e){try{E?.localStorage.setItem(r,JSON.stringify(e))}catch(t){Ae.B(t)}},V:function(r){try{E?.localStorage.removeItem(r)}catch(e){Ae.B(e)}}},r1=["$device_id","distinct_id",bl,ib,kl,wl],dl={},n1={H:function(){return!0},B:function(r){B.error("memoryStorage error: "+r)},q:function(r){return dl[r]||null},W:function(r){return dl[r]||null},G:function(r,e){dl[r]=e},V:function(r){delete dl[r]}},$n=null,ze={H:function(){if(!Nt($n))return $n;if($n=!0,H(E))$n=!1;else try{var r="__support__";ze.G(r,"xyz"),ze.q(r)!=='"xyz"'&&($n=!1),ze.V(r)}catch{$n=!1}return $n},B:function(r){B.error("sessionStorage error: ",r)},q:function(r){try{return E?.sessionStorage.getItem(r)}catch(e){ze.B(e)}return null},W:function(r){try{return JSON.parse(ze.q(r))||null}catch{}return null},G:function(r,e){try{E?.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){ze.B(t)}},V:function(r){try{E?.sessionStorage.removeItem(r)}catch(e){ze.B(e)}}},pr=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({}),Fp=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?pr.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===pr.DENIED||this.consent===pr.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===pr.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:n}=this._instance.config;return n||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return jd(e)?pr.GRANTED:le(dC,e)?pr.DENIED:pr.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?Ae:zt;var t=e==="localStorage"?zt:Ae;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(jd(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!tb([dt?.doNotTrack,dt?.msDoNotTrack,X.doNotTrack],(e=>jd(e)))}},pl=Te("[Dead Clicks]"),i1=()=>!0,s1=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(nb)),n=r.instance.config.capture_dead_clicks;return gr(n)?n:!!Pe(n)||t},Tl=class{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[nb]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?pl.error("failed to load script",i):e()}))}et(){var e;if(D){if(!this.tt&&(e=X.__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=X.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(D),pl.info("starting...")}}else pl.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,pl.info("stopping..."))}},Zs=Te("[ExceptionAutocapture]"),Dp=class{constructor(e){var t,n,i;this.rt=()=>{var s;if(E&&this.isEnabled&&(s=X.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=X.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=X.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=X.__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){Zs.error("failed to start",c),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[Yy]),this.dt=new up({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10,refillInterval:1e4,h:Zs}),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=V({},t,e):(H(e)?this.ht:e)&&(t=V({},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?(Zs.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Zs.error("failed to load script",i);e()}))}ut(){var e,t,n;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(n=this.ot)==null||n.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ht=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[Yy]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(e){var t,n,i=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.dt.consumeRateLimit(i)?Zs.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}};function c_(r,e,t){try{if(!(e in r))return()=>{};var n=r[e],i=t(n);return Vr(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=i,()=>{r[e]=n}}catch{return()=>{}}}var Hp=class{constructor(e){var t;this._instance=e,this.ct=(E==null||(t=E.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(B.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,B.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(E&&E.history){var n=this;(e=E.history.pushState)!=null&&e.__posthog_wrapped__||c_(E.history,"pushState",(i=>function(s,o,a){i.call(this,s,o,a),n._t("pushState")})),(t=E.history.replaceState)!=null&&t.__posthog_wrapped__||c_(E.history,"replaceState",(i=>function(s,o,a){i.call(this,s,o,a),n._t("replaceState")})),this.bt()}}_t(e){try{var t,n=E==null||(t=E.location)==null?void 0:t.pathname;if(!n)return;n!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ct=n}catch(i){B.error("Error capturing "+e+" pageview",i)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};Oe(E,"popstate",e),this.ft=()=>{E&&E.removeEventListener("popstate",e)}}}},Kd=Te("[SegmentIntegration]");function o1(r,e){var t=r.config.segment;if(!t)return e();(function(n,i){var s=n.config.segment;if(!s)return i();var o=l=>{var c=()=>l.anonymousId()||Br();n.config.get_device_id=c,l.id()&&(n.register({distinct_id:l.id(),$device_id:c()}),n.persistence.set_property(dr,"identified")),i()},a=s.user();"then"in a&&Vr(a.then)?a.then(o):o(a)})(r,(()=>{t.register((n=>{Promise&&Promise.resolve||Kd.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===n.get_distinct_id()||(Kd.info("No userId set, resetting PostHog"),n.reset()),s.event.userId&&s.event.userId!==n.get_distinct_id()&&(Kd.info("UserId set, identifying with PostHog"),n.identify(s.event.userId));var a=n.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")}})(r)).then((()=>{e()}))}))}var _b="posthog-js";function bb(r,e){var{organization:t,projectId:n,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,c,u,p,h;if(!(s==="*"||s.includes(a.level))||!r.__loaded)return a;a.tags||(a.tags={});var f=r.requestRouter.endpointFor("ui","/project/"+r.config.token+"/person/"+r.get_distinct_id());a.tags["PostHog Person URL"]=f,r.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=r.get_session_replay_url({withTimestamp:!0}));var v=((l=a.exception)==null?void 0:l.values)||[],m=v.map((y=>V({},y,{stacktrace:y.stacktrace?V({},y.stacktrace,{type:"raw",frames:(y.stacktrace.frames||[]).map((x=>V({},x,{platform:"web:javascript"})))}):void 0}))),g={$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:m,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((p=v[0])==null?void 0:p.value)||a.message,$sentry_exception_type:(h=v[0])==null?void 0:h.type,$sentry_tags:a.tags};return t&&n&&(g.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+a.event_id),o&&r.exceptions.sendExceptionEvent(g),a}}var Bp=class{constructor(e,t,n,i,s,o){this.name=_b,this.setupOnce=function(a){a(bb(e,{organization:t,projectId:n,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}},a1=E!=null&&E.location?Rl(E.location.hash,"__posthog")||Rl(location.hash,"state"):null,u_="_postHogToolbarParams",d_=Te("[Toolbar]"),Hr=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(Hr||{}),Vp=class{constructor(e){this.instance=e}yt(e){X.ph_toolbar_state=e}wt(){var e;return(e=X.ph_toolbar_state)!==null&&e!==void 0?e:Hr.UNINITIALIZED}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),!E||!D)return!1;e=e??E.location,n=n??E.history;try{if(!t){try{E.localStorage.setItem("test","test"),E.localStorage.removeItem("test")}catch{return!1}t=E?.localStorage}var i,s=a1||Rl(e.hash,"__posthog")||Rl(e.hash,"state"),o=s?Gy((()=>JSON.parse(atob(decodeURIComponent(s)))))||Gy((()=>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:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(u_)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}xt(e){var t=X.ph_load_toolbar||X.ph_load_editor;!ue(t)&&Vr(t)?t(e,this.instance):d_.warn("No toolbar load function found")}loadToolbar(e){var t=!(D==null||!D.getElementById(sb));if(!E||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=V({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(E.localStorage.setItem(u_,JSON.stringify(V({},i,{source:void 0}))),this.wt()===Hr.LOADED)this.xt(i);else if(this.wt()===Hr.UNINITIALIZED){var s;this.yt(Hr.LOADING),(s=X.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return d_.error("[Toolbar] Failed to load",o),void this.yt(Hr.UNINITIALIZED);this.yt(Hr.LOADED),this.xt(i)})),Oe(E,"turbolinks:load",(()=>{this.yt(Hr.UNINITIALIZED),this.loadToolbar(i)}))}return!0}Et(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}},l1=Te("[TracingHeaders]"),jp=class{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,n;H(this.$t)&&((t=X.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),H(this.St)&&((n=X.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return l1.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)}},hl="https?://(.*)",Ai=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],c1=Ci(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Ai),bo="<masked>",u1=["li_fat_id"];function xb(r,e,t){if(!D)return{};var n,i=e?Ci([],Ai,t||[]):[],s=wb(_o(D.URL,i,bo),r),o=(n={},xe(u1,(function(a){var l=zt.q(a);n[a]=l||null})),n);return $e(o,s)}function wb(r,e){var t=c1.concat(e||[]),n={};return xe(t,(function(i){var s=Al(r,i);n[i]=s||null})),n}function kb(r){var e=(function(s){return s?s.search(hl+"google.([^/?]*)")===0?"google":s.search(hl+"bing.com")===0?"bing":s.search(hl+"yahoo.com")===0?"yahoo":s.search(hl+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",n={};if(!Nt(e)){n.$search_engine=e;var i=D?Al(D.referrer,t):"";i.length&&(n.ph_keyword=i)}return n}function p_(){return navigator.language||navigator.userLanguage}function Sb(){return D?.referrer||"$direct"}function Eb(r,e){var t=r?Ci([],Ai,e||[]):[],n=qe?.href.substring(0,1e3);return{r:Sb().substring(0,1e3),u:n?_o(n,t,bo):void 0}}function Cb(r){var e,{r:t,u:n}=r,i={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Cl(t))==null?void 0:e.host};if(n){i.$current_url=n;var s=Cl(n);i.$host=s?.host,i.$pathname=s?.pathname;var o=wb(n);$e(i,o)}if(t){var a=kb(t);$e(i,a)}return i}function Ab(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function d1(){try{return new Date().getTimezoneOffset()}catch{return}}function p1(r,e){if(!st)return{};var t,n,i,s=r?Ci([],Ai,e||[]):[],[o,a]=(function(l){for(var c=0;c<Wy.length;c++){var[u,p]=Wy[c],h=u.exec(l),f=h&&(Vr(p)?p(h,l):p);if(f)return f}return["",""]})(st);return $e(wh({$os:o,$os_version:a,$browser:X_(st,navigator.vendor),$device:Uy(st),$device_type:(n=st,i=Uy(n),i===F_||i===L_||i==="Kobo"||i==="Kindle Fire"||i===Y_?po:i===fo||i===wi||i===go||i===pp?"Console":i===H_?"Wearable":i?xt:"Desktop"),$timezone:Ab(),$timezone_offset:d1()}),{$current_url:_o(qe?.href,s,bo),$host:qe?.host,$pathname:qe?.pathname,$raw_user_agent:st.length>1e3?st.substring(0,997)+"...":st,$browser_version:xC(st,navigator.vendor),$browser_language:p_(),$browser_language_prefix:(t=p_(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:E?.screen.height,$screen_width:E?.screen.width,$viewport_height:E?.innerHeight,$viewport_width:E?.innerWidth,$lib:"web",$lib_version:ur.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Lr=Te("[Web Vitals]"),h_=9e5,Wp=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(((n,i)=>V({},n,{["$web_vitals_"+i.name+"_event"]:V({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=n=>{var i,s=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0);if(H(s))Lr.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Ct();H(o)||(ue(n?.name)||ue(n?.value)?Lr.error("Invalid metric received",n):this.Rt&&n.value>=this.Rt?Lr.error("Ignoring metric with value >= "+this.Rt,n):(this.N.url!==o&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),H(this.N.url)&&(this.N.url=o),this.N.firstMetricTimestamp=H(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.N.metrics.push(V({},n,{$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 n,i,s,o,a=X.__PosthogExtensions__;H(a)||H(a.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:i,onFCP:s,onINP:o}=a.postHogWebVitalsCallbacks),n&&i&&s&&o?(this.allowedMetrics.indexOf("LCP")>-1&&n(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):Lr.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[Jy]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=Pe(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return ue(n)?((t=this._instance.persistence)==null?void 0:t.props[e_])||["CLS","FCP","INP","LCP"]:n}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)&&mr(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:h_;return 0<e&&e<=6e4?h_:e}get isEnabled(){var e=qe?.protocol;if(e!=="http:"&&e!=="https:")return Lr.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:gr(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return gr(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Lr.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=Pe(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Pe(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Jy]:t}),this._instance.persistence.register({[e_]:n})),this.kt=t,this.startIfEnabled()}it(e){var t,n;if((t=X.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var i=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,i,(s=>{s?Lr.error("failed to load script",s):e()}))}}Ct(){var e=E?E.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,n=this._instance.config.custom_personal_data_properties,i=t?Ci([],Ai,n||[]):[];return _o(e,i,bo)}Lr.error("Could not determine current URL")}},h1=Te("[Heatmaps]");function f_(r){return Pe(r)&&"clientX"in r&&"clientY"in r&&mr(r.clientX)&&mr(r.clientY)}var Up=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[Sp]),this.rageclicks=new El(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;h1.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({[Sp]: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"})(D)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){E&&D&&(this.Nt=this.Lt.bind(this),Oe(E,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||E?.event),Oe(D,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||E?.event),Oe(D,"mousemove",this.zt,{capture:!0}),this.Bt=new Tl(this.instance,i1,this.jt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Mt.bind(this),Oe(D,"visibilitychange",this.qt),this.P=!0)}At(){var e;E&&D&&(this.Nt&&E.removeEventListener("beforeunload",this.Nt),this.Ut&&D.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&D.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&D.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),(e=this.Bt)==null||e.stop(),this.P=!1)}Gt(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=(function(a,l,c){for(var u=a;u&&Vl(u)&&!Wr(u,"body");){if(u===c)return!1;if(le(l,E?.getComputedStyle(u).position))return!0;u=db(u)}return!1})(cb(e),["fixed","sticky"],s);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:n),target_fixed:o,type:t}}Dt(e,t){var n;if(t===void 0&&(t="click"),!t_(e.target)&&f_(e)){var i=this.Gt(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(V({},i,{type:"rageclick"})),this.Vt(i)}}Ht(e){!t_(e.target)&&f_(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout((()=>{this.Vt(this.Gt(e,"mousemove"))}),500))}Vt(e){if(E){var t=E.location.href,n=this.instance.config.mask_personal_data_properties,i=this.instance.config.custom_personal_data_properties,s=n?Ci([],Ai,i||[]):[],o=_o(t,s,bo);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!_i(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},Il=class{constructor(e){this.Jt=(t,n,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(B.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 n,i=this.Qt(e,t);return this.Kt={pathname:(n=E?.location.pathname)!==null&&n!==void 0?n:"",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 n=this.Kt;if(!n)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:n.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:p}=s;if(!(H(o)||H(a)||H(l)||H(c)||H(u)||H(p))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),p=Math.ceil(p);var h=o<=1?1:qt(a/o,0,1,B),f=o<=1?1:qt(l/o,0,1,B),v=c<=1?1:qt(u/c,0,1,B),m=c<=1?1:qt(p/c,0,1,B);i=$e(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:p,$prev_pageview_max_content_percentage:m})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}};var hr=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),wt=Uint8Array,et=Uint16Array,Ei=Uint32Array,Ch=new wt([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]),Ah=new wt([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]),g_=new wt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Rb=function(r,e){for(var t=new et(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];var i=new Ei(t[30]);for(n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)i[s]=s-t[n]<<5|n;return[t,i]},Tb=Rb(Ch,2),f1=Tb[0],zp=Tb[1];f1[28]=258,zp[258]=28;for(qp=Rb(Ah,0)[1],$l=new et(32768),we=0;we<32768;++we)Fr=(43690&we)>>>1|(21845&we)<<1,Fr=(61680&(Fr=(52428&Fr)>>>2|(13107&Fr)<<2))>>>4|(3855&Fr)<<4,$l[we]=((65280&Fr)>>>8|(255&Fr)<<8)>>>1;var Fr,qp,$l,we,lo=function(r,e,t){for(var n=r.length,i=0,s=new et(e);i<n;++i)++s[r[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<n;++i)if(r[i])for(var c=i<<4|r[i],u=e-r[i],p=a[r[i]-1]++<<u,h=p|(1<<u)-1;p<=h;++p)o[$l[p]>>>l]=c}else for(o=new et(n),i=0;i<n;++i)o[i]=$l[a[r[i]-1]++]>>>15-r[i];return o},Nn=new wt(288);for(we=0;we<144;++we)Nn[we]=8;for(we=144;we<256;++we)Nn[we]=9;for(we=256;we<280;++we)Nn[we]=7;for(we=280;we<288;++we)Nn[we]=8;var Ml=new wt(32);for(we=0;we<32;++we)Ml[we]=5;var g1=lo(Nn,9,0),m1=lo(Ml,5,0),Ib=function(r){return(r/8>>0)+(7&r&&1)},$b=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var n=new(r instanceof et?et:r instanceof Ei?Ei:wt)(t-e);return n.set(r.subarray(e,t)),n},lr=function(r,e,t){t<<=7&e;var n=e/8>>0;r[n]|=t,r[n+1]|=t>>>8},Gs=function(r,e,t){t<<=7&e;var n=e/8>>0;r[n]|=t,r[n+1]|=t>>>8,r[n+2]|=t>>>16},Yd=function(r,e){for(var t=[],n=0;n<r.length;++n)r[n]&&t.push({s:n,f:r[n]});var i=t.length,s=t.slice();if(!i)return[new wt(0),0];if(i==1){var o=new wt(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(w,R){return w.f-R.f})),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,u=1,p=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=t[t[c].f<t[p].f?c++:p++],l=t[c!=u&&t[c].f<t[p].f?c++:p++],t[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=s[0].s;for(n=1;n<i;++n)s[n].s>h&&(h=s[n].s);var f=new et(h+1),v=Zp(t[u-1],f,0);if(v>e){n=0;var m=0,g=v-e,y=1<<g;for(s.sort((function(w,R){return f[R.s]-f[w.s]||w.f-R.f}));n<i;++n){var x=s[n].s;if(!(f[x]>e))break;m+=y-(1<<v-f[x]),f[x]=e}for(m>>>=g;m>0;){var k=s[n].s;f[k]<e?m-=1<<e-f[k]++-1:++n}for(;n>=0&&m;--n){var _=s[n].s;f[_]==e&&(--f[_],++m)}v=e}return[new wt(f),v]},Zp=function(r,e,t){return r.s==-1?Math.max(Zp(r.l,e,t+1),Zp(r.r,e,t+1)):e[r.s]=t},m_=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new et(++e),n=0,i=r[0],s=1,o=function(l){t[n++]=l},a=1;a<=e;++a)if(r[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=r[a]}return[t.subarray(0,n),e]},Ks=function(r,e){for(var t=0,n=0;n<e.length;++n)t+=r[n]*e[n];return t},Gp=function(r,e,t){var n=t.length,i=Ib(e+2);r[i]=255&n,r[i+1]=n>>>8,r[i+2]=255^r[i],r[i+3]=255^r[i+1];for(var s=0;s<n;++s)r[i+s+4]=t[s];return 8*(i+4+n)},v_=function(r,e,t,n,i,s,o,a,l,c,u){lr(e,u++,t),++i[256];for(var p=Yd(i,15),h=p[0],f=p[1],v=Yd(s,15),m=v[0],g=v[1],y=m_(h),x=y[0],k=y[1],_=m_(m),w=_[0],R=_[1],b=new et(19),A=0;A<x.length;++A)b[31&x[A]]++;for(A=0;A<w.length;++A)b[31&w[A]]++;for(var $=Yd(b,7),N=$[0],M=$[1],K=19;K>4&&!N[g_[K-1]];--K);var L,O,q,Y,se=c+5<<3,C=Ks(i,Nn)+Ks(s,Ml)+o,P=Ks(i,h)+Ks(s,m)+o+14+3*K+Ks(b,N)+(2*b[16]+3*b[17]+7*b[18]);if(se<=C&&se<=P)return Gp(e,u,r.subarray(l,l+c));if(lr(e,u,1+(P<C)),u+=2,P<C){L=lo(h,f,0),O=h,q=lo(m,g,0),Y=m;var G=lo(N,M,0);for(lr(e,u,k-257),lr(e,u+5,R-1),lr(e,u+10,K-4),u+=14,A=0;A<K;++A)lr(e,u+3*A,N[g_[A]]);u+=3*K;for(var pe=[x,w],ce=0;ce<2;++ce){var Be=pe[ce];for(A=0;A<Be.length;++A){var Ee=31&Be[A];lr(e,u,G[Ee]),u+=N[Ee],Ee>15&&(lr(e,u,Be[A]>>>5&127),u+=Be[A]>>>12)}}}else L=g1,O=Nn,q=m1,Y=Ml;for(A=0;A<a;++A)if(n[A]>255){Ee=n[A]>>>18&31,Gs(e,u,L[Ee+257]),u+=O[Ee+257],Ee>7&&(lr(e,u,n[A]>>>23&31),u+=Ch[Ee]);var kt=31&n[A];Gs(e,u,q[kt]),u+=Y[kt],kt>3&&(Gs(e,u,n[A]>>>5&8191),u+=Ah[kt])}else Gs(e,u,L[n[A]]),u+=O[n[A]];return Gs(e,u,L[256]),u+O[256]},v1=new Ei([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),y1=(function(){for(var r=new Ei(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),_1=function(r,e,t,n,i){return(function(s,o,a,l,c,u){var p=s.length,h=new wt(l+p+5*(1+Math.floor(p/7e3))+c),f=h.subarray(l,h.length-c),v=0;if(!o||p<8)for(var m=0;m<=p;m+=65535){var g=m+65535;g<p?v=Gp(f,v,s.subarray(m,g)):(f[m]=u,v=Gp(f,v,s.subarray(m,p)))}else{for(var y=v1[o-1],x=y>>>13,k=8191&y,_=(1<<a)-1,w=new et(32768),R=new et(_+1),b=Math.ceil(a/3),A=2*b,$=function(Ul){return(s[Ul]^s[Ul+1]<<b^s[Ul+2]<<A)&_},N=new Ei(25e3),M=new et(288),K=new et(32),L=0,O=0,q=(m=0,0),Y=0,se=0;m<p;++m){var C=$(m),P=32767&m,G=R[C];if(w[P]=G,R[C]=P,Y<=m){var pe=p-m;if((L>7e3||q>24576)&&pe>423){v=v_(s,f,0,N,M,K,O,q,se,m-se,v),q=L=O=0,se=m;for(var ce=0;ce<286;++ce)M[ce]=0;for(ce=0;ce<30;++ce)K[ce]=0}var Be=2,Ee=0,kt=k,St=P-G&32767;if(pe>2&&C==$(m-St))for(var jl=Math.min(x,pe)-1,Ri=Math.min(32767,m),Me=Math.min(258,pe);St<=Ri&&--kt&&P!=G;){if(s[m+Be]==s[m+Be-St]){for(var Lt=0;Lt<Me&&s[m+Lt]==s[m+Lt-St];++Lt);if(Lt>Be){if(Be=Lt,Ee=St,Lt>jl)break;var zb=Math.min(St,Lt-2),Ph=0;for(ce=0;ce<zb;++ce){var Wl=m-St+ce+32768&32767,Nh=Wl-w[Wl]+32768&32767;Nh>Ph&&(Ph=Nh,G=Wl)}}}St+=(P=G)-(G=w[P])+32768&32767}if(Ee){N[q++]=268435456|zp[Be]<<18|qp[Ee];var Lh=31&zp[Be],Fh=31&qp[Ee];O+=Ch[Lh]+Ah[Fh],++M[257+Lh],++K[Fh],Y=m+Be,++L}else N[q++]=s[m],++M[s[m]]}}v=v_(s,f,u,N,M,K,O,q,se,m-se,v)}return $b(h,0,l+Ib(v)+c)})(r,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+e.mem,t,n,!0)},Xd=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function b1(r,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=y1[255&c^l[u]]^c>>>8;a=c},d:function(){return 4294967295^a}}})(),n=r.length;t.p(r);var i,s=_1(r,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&&Xd(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),Xd(s,o-8,t.d()),Xd(s,o-4,n),s}var x1=function(r){var e,t,n,i,s="";for(e=t=0,n=(r=(r+"").replace(/\r\n/g,`
1009
1009
  `).replace(/\r/g,`
1010
- `)).length,i=0;i<n;i++){var o=r.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),Nt(a)||(t>e&&(s+=r.substring(e,t)),s+=a,e=t=i+1)}return t>e&&(s+=r.substring(e,r.length)),s},w1=!!op||!!sp,y_="text/plain",Ol=function(r,e,t){var n;t===void 0&&(t=!0);var[i,s]=r.split("?"),o=V({},e),a=(n=s?.split("&").map((c=>{var u,[p,h]=c.split("="),f=t&&(u=o[p])!==null&&u!==void 0?u:h;return delete o[p],p+"="+f})))!==null&&n!==void 0?n:[],l=KC(o);return l&&a.push(l),i+"?"+a.join("&")},so=(r,e)=>JSON.stringify(r,((t,n)=>typeof n=="bigint"?n.toString():n),e),Jd=r=>{var{data:e,compression:t}=r;if(e){if(t===hr.GZipJS){var n=b1((function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var p=new wt(l.length+(l.length>>>1)),h=0,f=function(y){p[h++]=y},v=0;v<u;++v){if(h+5>p.length){var m=new wt(h+8+(u-v<<1));m.set(p),p=m}var g=l.charCodeAt(v);g<128||c?f(g):g<2048?(f(192|g>>>6),f(128|63&g)):g>55295&&g<57344?(f(240|(g=65536+(1047552&g)|1023&l.charCodeAt(++v))>>>18),f(128|g>>>12&63),f(128|g>>>6&63),f(128|63&g)):(f(224|g>>>12),f(128|g>>>6&63),f(128|63&g))}return $b(p,0,h)})(so(e)),{mtime:0}),i=new Blob([n],{type:y_});return{contentType:y_,body:i,estimatedSize:i.size}}if(t===hr.Base64){var s=(function(l){var c,u,p,h,f,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,g=0,y="",x=[];if(!l)return l;l=x1(l);do c=(f=l.charCodeAt(m++)<<16|l.charCodeAt(m++)<<8|l.charCodeAt(m++))>>18&63,u=f>>12&63,p=f>>6&63,h=63&f,x[g++]=v.charAt(c)+v.charAt(u)+v.charAt(p)+v.charAt(h);while(m<l.length);switch(y=x.join(""),l.length%3){case 1:y=y.slice(0,-2)+"==";break;case 2:y=y.slice(0,-1)+"="}return y})(so(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:so(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=so(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},ml=[];sp&&ml.push({transport:"fetch",method:r=>{var e,t,{contentType:n,body:i,estimatedSize:s}=(e=Jd(r))!==null&&e!==void 0?e:{},o=new Headers;xe(r.headers,(function(u,p){o.append(p,u)})),n&&o.append("Content-Type",n);var a=r.url,l=null;if(Dy){var c=new Dy;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),r.timeout)}}sp(a,V({method:r?.method||"GET",headers:o,keepalive:r.method==="POST"&&(s||0)<52428.8,body:i,signal:(t=l)==null?void 0:t.signal},r.fetchOptions)).then((u=>u.text().then((p=>{var h={statusCode:u.status,text:p};if(u.status===200)try{h.json=JSON.parse(p)}catch(f){B.error(f)}r.callback==null||r.callback(h)})))).catch((u=>{B.error(u),r.callback==null||r.callback({statusCode:0,text:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),op&&ml.push({transport:"XHR",method:r=>{var e,t=new op;t.open(r.method||"GET",r.url,!0);var{contentType:n,body:i}=(e=Jd(r))!==null&&e!==void 0?e:{};xe(r.headers,(function(s,o){t.setRequestHeader(o,s)})),n&&t.setRequestHeader("Content-Type",n),r.timeout&&(t.timeout=r.timeout),r.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{}r.callback==null||r.callback(s)}},t.send(i)}}),dt!=null&&dt.sendBeacon&&ml.push({transport:"sendBeacon",method:r=>{var e=Ol(r.url,{beacon:"1"});try{var t,{contentType:n,body:i}=(t=Jd(r))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:n}):i;dt.sendBeacon(e,s)}catch{}}});var Pl=function(r,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}};function __(r,e,t){return so({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Mb={exact:(r,e)=>e.some((t=>r.some((n=>t===n)))),is_not:(r,e)=>e.every((t=>r.every((n=>t!==n)))),regex:(r,e)=>e.some((t=>r.some((n=>Pl(t,n))))),not_regex:(r,e)=>e.every((t=>r.every((n=>!Pl(t,n))))),icontains:(r,e)=>e.map(fl).some((t=>r.map(fl).some((n=>t.includes(n))))),not_icontains:(r,e)=>e.map(fl).every((t=>r.map(fl).every((n=>!t.includes(n))))),gt:(r,e)=>e.some((t=>{var n=parseFloat(t);return!isNaN(n)&&r.some((i=>n>parseFloat(i)))})),lt:(r,e)=>e.some((t=>{var n=parseFloat(t);return!isNaN(n)&&r.some((i=>n<parseFloat(i)))}))},fl=r=>r.toLowerCase();function Ob(r,e){return!r||Object.entries(r).every((t=>{var[n,i]=t,s=e?.[n];if(H(s)||Nt(s))return!1;var o=[String(s)],a=Mb[i.operator];return!!a&&a(i.values,o)}))}var Qd=Te("[Error tracking]"),Kp=class{constructor(e){var t,n;this.Zt=[],this.ti=new fp([new mp,new kp,new yp,new vp,new xp,new bp,new _p,new wp],$C()),this._instance=e,this.Zt=(t=(n=this._instance.persistence)==null?void 0:n.get_property(Ep))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,n,i,s=(t=(n=e.errorTracking)==null?void 0:n.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({[Ep]:this.Zt,[Xy]:o})}get ii(){var e,t=!!this._instance.get_property(Xy),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??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 Qd.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void Qd.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void Qd.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(((n,i)=>{var{type:s,value:o}=i;return Ne(s)&&s.length>0&&n.$exception_types.push(s),Ne(o)&&o.length>0&&n.$exception_values.push(o),n}),{$exception_types:[],$exception_values:[]});return this.Zt.some((n=>{var i=n.values.map((s=>{var o,a=Mb[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 n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}si(e){return e.flatMap((t=>{var n,i;return(n=(i=t.stacktrace)==null?void 0:i.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ni(e){if(e.length>0){var t,n,i,s,o=(t=(n=e[0].stacktrace)==null?void 0:n.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)}},ut=Te("[FeatureFlags]"),Ys=Te("[FeatureFlags]",{debugEnabled:!0}),ep="$active_feature_flags",fi="$override_feature_flags",b_="$feature_flag_payloads",Xs="$override_feature_flag_payloads",x_="$feature_flag_request_id",w_="$feature_flag_evaluated_at",k_=r=>{var e={};for(var[t,n]of gl(r||{}))n&&(e[t]=n);return e},k1=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var n;return[t,(n=e[t].variant)!==null&&n!==void 0?n:e[t].enabled]}))),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var n;return(n=e[t].metadata)==null?void 0:n.payload})).map((t=>{var n;return[t,(n=e[t].metadata)==null?void 0:n.payload]})))):ut.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},S1=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({}),Yp=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||(ut.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((n=>{var i=n&&typeof n=="string"&&n.trim().length>0;return i||ut.error("Invalid evaluation context found:",n,"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(Cp),t=this._instance.get_property(fi),n=this._instance.get_property(Xs);if(!n&&!t)return e||{};var i=$e({},e||{}),s=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of s){var a,l,c=i[o],u=t?.[o],p=H(u)?(a=c?.enabled)!==null&&a!==void 0&&a:!!u,h=H(u)?c.variant:typeof u=="string"?u:void 0,f=n?.[o],v=V({},c,{enabled:p,variant:p?h??c?.variant:void 0});p!==c?.enabled&&(v.original_enabled=c?.enabled),h!==c?.variant&&(v.original_variant=c?.variant),f&&(v.metadata=V({},c?.metadata,{payload:f,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),i[o]=v}return this.oi||(ut.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(bi),t=this._instance.get_property(fi);if(!t)return e||{};for(var n=$e({},e),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(ut.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.oi=!0),n}getFlagPayloads(){var e=this._instance.get_property(b_),t=this._instance.get_property(Xs);if(!t)return e||{};for(var n=$e({},e||{}),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(ut.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.oi=!0),n}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 n=this._instance.config.token,i=this._instance.get_property("$device_id"),s={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:V({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(io)||{}),group_properties:this._instance.get_property(On)};Nt(i)||H(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=Ab()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:s,compression:this._instance.config.disable_compression?void 0:hr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:u=>{var p,h,f=!0;if(u.statusCode===200&&(this.hi||(this.$anon_distinct_id=void 0),f=!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=!f,u.json&&(p=u.json.quotaLimited)!=null&&p.includes(S1.FeatureFlags))ut.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:{},f),this.hi&&(this.hi=!1,this.mi())}}})}}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlagResult(e,t);return(n=i?.variant)!==null&&n!==void 0?n:i?.enabled}ut.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 n=this.getFlagVariants(),i=e in n,s=n[e],o=this.getFlagPayloads()[e],a=String(s),l=this._instance.get_property(x_)||void 0,c=this._instance.get_property(w_)||void 0,u=this._instance.get_property(xl)||{};if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){var p,h,f,v,m,g,y,x,k;fe(u[e])?u[e].push(a):u[e]=[a],(p=this._instance.persistence)==null||p.register({[xl]:u});var _=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:((f=this._instance.config.bootstrap)==null||(f=f.featureFlagPayloads)==null?void 0:f[e])||null,$used_bootstrap_value:!this.vi};H(_==null||(v=_.metadata)==null?void 0:v.version)||(w.$feature_flag_version=_.metadata.version);var R,b=(m=_==null||(g=_.reason)==null?void 0:g.description)!==null&&m!==void 0?m:_==null||(y=_.reason)==null?void 0:y.code;b&&(w.$feature_flag_reason=b),_!=null&&(x=_.metadata)!=null&&x.id&&(w.$feature_flag_id=_.metadata.id),H(_?.original_variant)&&H(_?.original_enabled)||(w.$feature_flag_original_response=H(_.original_variant)?_.original_enabled:_.original_variant),_!=null&&(k=_.metadata)!=null&&k.original_payload&&(w.$feature_flag_original_payload=_==null||(R=_.metadata)==null?void 0:R.original_payload),this._instance.capture("$feature_flag_called",w)}if(i){var A=o;if(!H(o))try{A=JSON.parse(o)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:A}}}else ut.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var n=this._instance.config.token,i={distinct_id:this._instance.get_distinct_id(),token:n};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:hr.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 n=this.getFeatureFlag(e,t);return H(n)?void 0:!!n}ut.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 n=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 p=k1(o),h=p.flags,f=p.featureFlags,v=p.featureFlagPayloads;if(f){var m=o.requestId,g=o.evaluatedAt;if(fe(f)){ut.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var y={};if(f)for(var x=0;x<f.length;x++)y[f[x]]=!0;a&&a.register({[ep]:f,[bi]:y})}else{var k=f,_=v,w=h;if(o.errorsWhileComputingFlags)if(h){var R=new Set(Object.keys(h).filter((b=>{var A;return!((A=h[b])!=null&&A.failed)})));k=V({},l,Object.fromEntries(Object.entries(k).filter((b=>{var[A]=b;return R.has(A)})))),_=V({},c,Object.fromEntries(Object.entries(_||{}).filter((b=>{var[A]=b;return R.has(A)})))),w=V({},u,Object.fromEntries(Object.entries(w||{}).filter((b=>{var[A]=b;return R.has(A)}))))}else k=V({},l,k),_=V({},c,_),w=V({},u,w);a&&a.register(V({[ep]:Object.keys(k_(k)),[bi]:k||{},[b_]:_||{},[Cp]:w||{}},m?{[x_]:m}:{},g?{[w_]:g}:{}))}}})(e,this._instance.persistence,n,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),ut.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return ut.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(fi),this._instance.persistence.unregister(Xs),this.wi(),Ys.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;if(this.oi=!!((t=n.suppressWarning)!==null&&t!==void 0&&t),"flags"in n){if(n.flags===!1)this._instance.persistence.unregister(fi),Ys.info("Flag overrides cleared");else if(n.flags){if(fe(n.flags)){for(var i={},s=0;s<n.flags.length;s++)i[n.flags[s]]=!0;this._instance.persistence.register({[fi]:i})}else this._instance.persistence.register({[fi]:n.flags});Ys.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(Xs),Ys.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[Xs]:n.payloads}),Ys.info("Payload overrides set",{payloads:n.payloads}))),void this.wi()}this.wi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:n}=this.xi();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i,s=(this._instance.get_property(no)||[]).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),n&&(a.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=V({},this.getFlagVariants(),{[e]:t});(i=this._instance.persistence)==null||i.register({[ep]:Object.keys(k_(l)),[bi]:l}),this.wi()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this._instance.get_property(no),s=n?"&"+n.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(no),(l=this._instance.persistence)==null||l.register({[no]:c}),e(c)}}})}xi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,i)=>(n[i]=t[i],n)),{})}}wi(e){var{flags:t,flagVariants:n}=this.xi();this.featureFlagEventHandlers.forEach((i=>i(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(io)||{};this._instance.register({[io]:V({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(io)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(On)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=V({},n[i],e[i]),delete e[i]})),this._instance.register({[On]:V({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(On)||{};this._instance.register({[On]:V({},t,{[e]:{}})})}else this._instance.unregister(On)}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}},E1=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],co=class{constructor(e,t){this.R=e,this.props={},this.Ei=!1,this.$i=(n=>{var i="";return n.token&&(i=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+i+"_posthog"})(e),this.Y=this.Si(e),this.load(),e.debug&&B.info("Persistence loaded",e.persistence,V({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){E1.indexOf(e.persistence.toLowerCase())===-1&&(B.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=[...r1,...i];return V({},Ae,{W:function(o){try{var a={};try{a=zt.W(o)||{}}catch{}var l=$e(a,JSON.parse(Ae.q(o)||"{}"));return Ae.G(o,l),l}catch{}return null},G:function(o,a,l,c,u,p){try{Ae.G(o,a,void 0,void 0,p);var h={};s.forEach((f=>{a[f]&&(h[f]=a[f])})),Object.keys(h).length&&zt.G(o,h,l,c,u,p)}catch(f){Ae.B(f)}},V:function(o,a){try{E?.localStorage.removeItem(o),zt.V(o,a)}catch(l){Ae.B(l)}}})})(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return n==="localstorage"&&Ae.H()?Ae:n==="localstorage+cookie"&&t.H()?t:n==="sessionstorage"&&ze.H()?ze:n==="memory"?n1:n==="cookie"?zt:t.H()?t:zt}properties(){var e={};return xe(this.props,(function(t,n){if(n===bi&&Pe(t))for(var i=Object.keys(t),s=0;s<i.length;s++)e["$feature/"+i[s]]=t[i[s]];else a=n,l=!1,(Nt(o=HC)?l:Fy&&o.indexOf===Fy?o.indexOf(a)!=-1:(xe(o,(function(c){if(l||(l=c===a))return _l})),l))||(e[n]=t);var o,a,l})),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=$e({},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,n){if(Pe(e)){H(t)&&(t="None"),this.Pi=H(n)?this.Ci:n;var i=!1;if(xe(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=H(t)?this.Ci:t;var n=!1;if(xe(e,((i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,n=!0)})),n)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=xb(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);_i(wh(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=D?.referrer)?kb(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Sb(),$referring_domain:D!=null&&D.referrer&&((e=Cl(D.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Ip]||this.props[$p]||this.register_once({[wl]:Eb(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};xe([$p,Ip],(o=>{var a=this.props[o];a&&xe(a,(function(l,c){e["$initial_"+ap(c)]=l}))}));var t,n,i=this.props[wl];if(i){var s=(t=Cb(i),n={},xe(t,(function(o,a){n["$initial_"+ap(a)]=o})),n);$e(e,s)}return e}safe_merge(e){return xe(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(e,t,n){if(this.Ci=this.Pi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),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,p)=>u===c[p]))})(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 n=this.props[ro]||{};n[e]=t,this.props[ro]=n,this.save()}remove_event_timer(e){var t=(this.props[ro]||{})[e];return H(t)||(delete this.props[ro][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},S_=Te("[Product Tours]"),tp="ph_product_tours",Xp=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[Qy]:!(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(Qy)||this.it((()=>this.Oi()))}it(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?S_.error("Could not load product tours script",i):e()}))}Oi(){var e;!this.Ri&&(e=X.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=X.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!fe(this.Fi)||t){var n=this._instance.persistence;if(n){var i=n.props[tp];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 S_.error(a),void e([],{isLoaded:!1,error:a})}var l=fe(s.json.product_tours)?s.json.product_tours:[];this.Fi=l,n&&n.register({[tp]: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(tp)}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)}},Js=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),qP=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),ZP=(function(r){return r.TopLeft="top_left",r.TopRight="top_right",r.TopCenter="top_center",r.MiddleLeft="middle_left",r.MiddleRight="middle_right",r.MiddleCenter="middle_center",r.Left="left",r.Center="center",r.Right="right",r.NextToTrigger="next_to_trigger",r})({}),GP=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),rp=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),KP=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),YP=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),XP=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),oo=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),np=(function(r){return r.SURVEY_ID="$survey_id",r.SURVEY_NAME="$survey_name",r.SURVEY_RESPONSE="$survey_response",r.SURVEY_ITERATION="$survey_iteration",r.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",r.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",r.SURVEY_SUBMISSION_ID="$survey_submission_id",r.SURVEY_QUESTIONS="$survey_questions",r.SURVEY_COMPLETED="$survey_completed",r.PRODUCT_TOUR_ID="$product_tour_id",r.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",r})({}),Jp=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),be=Te("[Surveys]"),Pb="seenSurvey_",C1=(r,e)=>{var t="$survey_"+e+"/"+r.id;return r.current_iteration&&r.current_iteration>0&&(t="$survey_"+e+"/"+r.id+"/"+r.current_iteration),t},E_=r=>((e,t)=>{var n=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=""+e+t.id+"_"+t.current_iteration),n})(Pb,r),A1=[rp.Popover,rp.Widget,rp.API],R1={ignoreConditions:!1,ignoreDelay:!1,displayType:Jp.Popover},vo=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((n=>n!==t))}}emit(e,t){for(var n of this.Mi[e]||[])n(t);for(var i of this.Mi["*"]||[])i(e,t)}};function gi(r,e,t){if(ue(r))return!1;switch(t){case"exact":return r===e;case"contains":var n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(n,"i").test(r);case"regex":try{return new RegExp(e).test(r)}catch{return!1}default:return!1}}var Qp=class{constructor(e){this.Ai=new vo,this.ji=(t,n)=>this.Di(t,n)&&this.Li(t,n)&&this.Ni(t,n)&&this.Ui(t,n),this.Di=(t,n)=>n==null||!n.event||t?.event===n?.event,this._instance=e,this.zi=new Set,this.Hi=new Set}init(){var e;if(!H((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook(((n,i)=>{this.on(n,i)}))}}register(e){var t,n;if(!H((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||"")}))})),(n=this._instance)!=null&&n.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 n;t!=null&&e.length!=0&&(this.zi.has(e)||this.zi.has(t?.event))&&this.Hi&&((n=this.Hi)==null?void 0:n.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 n of t.steps)if(this.ji(e,n))return!0;return!1}onAction(e,t){return this.Ai.on(e,t)}Li(e,t){if(t!=null&&t.url){var n,i=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!i||typeof i!="string"||!gi(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 n;if(t==null||!t.href)return!0;var i=this.Ji(e);if(i.length>0)return i.some((a=>gi(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!o&&gi((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}Gi(e,t){var n;if(t==null||!t.text)return!0;var i=this.Ji(e);if(i.length>0)return i.some((c=>gi(c.text,t.text,t.text_matching||"exact")||gi(c.$el_text,t.text,t.text_matching||"exact")));var s,o,a,l=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!l&&(s=(function(c){for(var u,p=[],h=/(?::|")text="(.*?)"/g;!ue(u=h.exec(c));)p.includes(u[1])||p.push(u[1]);return p})(l),o=t.text,a=t.text_matching||"exact",s.some((c=>gi(c,o,a))))}Vi(e,t){var n,i;if(t==null||!t.selector)return!0;var s=e==null||(n=e.properties)==null?void 0:n.$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||Ob(t.properties.reduce(((n,i)=>{var s=fe(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return n[i.key]={values:s,operator:i.operator||"exact"},n}),{}),e?.properties)}},eh=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&Ob(e.propertyFilters,t?.properties)}Zi(e,t){var n=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=n.get(o.name)||[];a.push(i.id),n.set(o.name,a)}}))})),n}te(e,t,n){var i=(n===Js.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[n])==null||(a=a.values)==null?void 0:a.find((c=>c.name===e));return this.Qi(l,t)}))}register(e){var t;H((t=this._instance)==null?void 0:t._addCaptureHook)||(this.ee(e),this.re(e))}re(e){var t=e.filter((n=>{var i,s;return((i=n.conditions)==null?void 0:i.actions)&&((s=n.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));t.length!==0&&(this.se==null&&(this.se=new Qp(this._instance),this.se.init(),this.se.qi((n=>{this.onAction(n)}))),t.forEach((n=>{var i,s,o,a,l;n.conditions&&(i=n.conditions)!=null&&i.actions&&(s=n.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.se)==null||a.register(n.conditions.actions.values),(l=n.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(n.id),this.Xi.set(c.name,u||[n.id])}})))})))}ee(e){var t,n=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}));(n.length!==0||i.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((s,o)=>{this.onEvent(s,o)})),this.Ki=this.Zi(e,Js.Activation),this.Yi=this.Zi(e,Js.Cancellation))}onEvent(e,t){var n,i=this.ne(),s=this.oe(),o=this.ae(),a=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.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 p=a.indexOf(u);p>=0&&(a.splice(p,1),this.le(a))}}else{if(this.Yi.has(e)){var h=this.te(e,t,Js.Cancellation);h.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map((v=>v.id))}),h.forEach((v=>{var m=a.indexOf(v.id);m>=0&&a.splice(m,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 f=this.te(e,t,Js.Activation);this.le(a.concat(f.map((v=>v.id))||[]))}}}onAction(e){var t,n=this.oe(),i=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[];this.Xi.has(e)&&this.le(i.concat(this.Xi.get(e)||[]))}le(e){var t,n=this.ne(),i=this.oe(),s=[...new Set(e)].filter((o=>!this.he(o)));n.info("updating activated items",{activatedItems:s}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[i]:s})}getActivatedIds(){var e,t=this.oe(),n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return n||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}},th=class extends eh{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return oo.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 be}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},rh=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 be.warn("Flags not loaded yet. Not loading surveys.");var n=fe(t);this.ve=n?t.length>0:t,be.info("flags response received, isSurveysEnabled: "+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(Pb)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)be.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)be.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())be.info("Not loading surveys in cookieless mode without consent.");else{var e=X?.__PosthogExtensions__;if(e){if(!H(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var n=e.generateSurveys;if(n)return void this.ge(n,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 be.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new th(this._instance),be.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){be.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 be.info("Disabled. Not loading surveys."),e([]);var n,i=this._instance.get_property(Ap);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=>{n=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;be.error(l);var c={isLoaded:!1,error:l};return e([],c),void(n==null||n({surveys:[],context:c}))}var u,p=s.json.surveys||[],h=p.filter((v=>(function(m){return!(!m.start_date||m.end_date)})(v)&&((function(m){var g;return!((g=m.conditions)==null||(g=g.events)==null||(g=g.values)==null||!g.length)})(v)||(function(m){var g;return!((g=m.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(v))));h.length>0&&((u=this._surveyEventReceiver)==null||u.register(h)),(o=this._instance.persistence)==null||o.register({[Ap]:p});var f={isLoaded:!0};e(p,f),n?.({surveys:p,context:f})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){be.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ue(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);be.warn("init was not called")}be(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.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 be.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)?(be.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((n=>{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);n({visible:a.eligible,disabledReason:a.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(ue(this._surveyManager))be.warn("init was not called");else{var s=typeof e=="string"?this.be(e):e;if(s!=null&&s.id)if(A1.includes(s.type)){var o=D?.querySelector(t);if(o)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(be.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;be.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,n),be.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);be.warn("Survey element not found")}else be.warn("Surveys of type "+s.type+" cannot be rendered in the app");else be.warn("Survey not found")}}displaySurvey(e,t){var n;if(ue(this._surveyManager))be.warn("init was not called");else{var i=this.be(e);if(i){var s=i;if((n=i.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=V({},i,{appearance:V({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Jp.Popover&&t.initialResponses&&be.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 be.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Jp.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else be.warn("Survey not found")}}cancelPendingSurvey(e){ue(this._surveyManager)?be.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},cr=Te("[Conversations]"),nh=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)||(gr(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=X?.__PosthogExtensions__;if(e&&!H(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 n=e.loadExternalDependency;if(!n)return void this.Se("PostHog loadExternalDependency extension not found.");n(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 cr.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),cr.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else cr.error("Cannot complete initialization: remote config is null")}Se(e,t){cr.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():cr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!Nt(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var i=this;return yi((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(cr.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var n=this;return yi((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(cr.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return yi((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(cr.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return yi((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(cr.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}},ih=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,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!ue(n)&&n&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=Te("[logs]"),t=X?.__PosthogExtensions__;if(t){var n=t.loadExternalDependency;n?n(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.")}}},C_=Te("[RateLimiter]"),sh=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var n=t.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach((i=>{C_.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void C_.warn('could not rate limit - continuing. Error: "'+i?.message+'"',{text:n})}},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,n,i;e===void 0&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(n=this.instance.persistence)==null?void 0:n.get_property(Tp))!==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(Tp,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Mn=Te("[RemoteConfig]"),oh=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=X._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(Mn.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 Mn.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void Mn.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return Mn.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){Mn.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()):Mn.info("__preview_remote_config is disabled. Logging config instead",e):Mn.error("Failed to fetch remote config from PostHog.")}},ah=3e3,lh=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=qt(t?.flush_interval_ms||ah,250,5e3,B.createLogger("flush interval"),ah),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((n=>n.url.indexOf("/e")===0)),...t.filter((n=>n.url.indexOf("/e")!==0))].map((n=>{this.Oe(V({},n,{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(),n=function(){var s=t[i],o=new Date().getTime();s.data&&fe(s.data)&&xe(s.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.Oe(s)};for(var i in t)n()}}),this.Fe))}je(){clearTimeout(this.Me),this.Me=void 0}De(){var e={};return xe(this.Re,(t=>{var n,i=t,s=(i?i.batchKey:null)||i.url;H(e[s])&&(e[s]=V({},i,{data:[]})),(n=e[s].data)==null||n.push(i.data)})),this.Re=[],e}},T1=["retriesPerformedSoFar"],ch=class{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!H(E)&&"onLine"in E.navigator&&(this.Ue=E.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},Oe(E,"online",this.ze),Oe(E,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=M_(e,T1);mi(t)&&(n.url=Ol(n.url,{retry_count:t})),this._instance._send_request(V({},n,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(t??0)<10?this.Be(V({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(i)}}))}Be(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=(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()+n;this.Re.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+n;navigator.onLine||(s+=" (Browser is offline)"),B.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=[],n=this.Re.filter((s=>s.retryAt<e||(t.push(s),!1)));if(this.Re=t,n.length>0)for(var{requestOptions:i}of n)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.We&&(clearTimeout(this.We),this.We=void 0),this.Le=!1,H(E)||(this.ze&&(E.removeEventListener("online",this.ze),this.ze=void 0),this.He&&(E.removeEventListener("offline",this.He),this.He=void 0)),this.Re))try{this._instance._send_request(V({},e,{transport:"sendBeacon"}))}catch(t){B.error(t)}this.Re=[]}},uh=class{constructor(e){this.Ge=()=>{var t,n,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,(n=this.Ve.maxScrollHeight)!==null&&n!==void 0?n: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(E,"scroll",this.Ge,{capture:!0}),Oe(E,"scrollend",this.Ge,{capture:!0}),Oe(E,"resize",this.Ge)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E?.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 n=E?.document.querySelector(t);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return E&&(E.scrollY||E.pageYOffset||E.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return E&&(E.scrollX||E.pageXOffset||E.document.documentElement.scrollLeft)||0}},I1=r=>Eb(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties),Nl=class{constructor(e,t,n,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({[Rp]:a})}},this._instance=e,this.Qe=t,this.Xe=n,this.Ye=i||I1,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[Rp]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?Cb(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 xe(wh(this.getSetOnceProps()),((t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+ap(n)]=t})),e}},ip=Te("[SessionId]"),Ll=class{on(e,t){return this.Ze.on(e,t)}constructor(e,t,n){var i;if(this.tr=[],this.ir=void 0,this.Ze=new vo,this.er=(u,p)=>!(!mi(u)||!mi(p))&&Math.abs(u-p)>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||Br,this.ar=n||Br;var s=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*qt(o,60,36e3,ip.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=ze.W(this.ur),l=ze.W(this.hr);a&&!l?this.rr=a:ze.V(this.ur),ze.G(this.hr,!0)}if((i=this.R.bootstrap)!=null&&i.sessionID)try{var c=(u=>{var p=u.replace(/-/g,"");if(p.length!==32)throw new Error("Not a valid UUID");if(p[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(p.substring(0,12),16)})(this.R.bootstrap.sessionID);this.vr(this.R.bootstrap.sessionID,new Date().getTime(),c)}catch(u){ip.error("Invalid sessionID in bootstrap",u)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return H(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&&ze.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&ze.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?ze.W(this.ur):null}vr(e,t,n){e===this.sr&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.sr=e,this.Xe.register({[bl]:[t,e,n]}))}_r(){var e=this.Xe.props[bl];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&&E&&(E.removeEventListener("beforeunload",this.ir,{capture:!1}),this.ir=void 0),this.tr=[]}cr(){this.ir=()=>{this.dr()&&ze.V(this.hr)},Oe(E,"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 n=t||new Date().getTime(),[i,s,o]=this._r(),a=this.gr(),l=mi(o)&&Math.abs(n-o)>864e5,c=!1,u=!s,p=!u&&!e&&this.er(n,i);u||p||l?(s=this.nr(),a=this.ar(),ip.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:u,activityTimeout:p,sessionPastMaximumLength:l}}),o=n,c=!0):a||(a=this.ar(),c=!0);var h=mi(i)&&e&&!l?i:n,f=mi(o)?o:new Date().getTime();return this.pr(a),this.vr(s,h,f),e||this.lr(),c&&this.tr.forEach((v=>v(s,a,c?{noSessionId:u,activityTimeout:p,sessionPastMaximumLength:l}:void 0))),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:c?{noSessionId:u,activityTimeout:p,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)}},$1=["$set_once","$set"],Dr=Te("[SiteApps]"),dh=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 n=this.globalsForEvent(t);this.br.push(n),this.br.length>1e3&&(this.br=this.br.slice(10))}}get siteAppLoaders(){var e;return(e=X._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,n,i,s,o,a,l;if(!e)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],p=this._instance.get_property("$stored_group_properties")||{};for(var[h,f]of Object.entries(p))c[h]={id:u[h],type:h,properties:f};var{$set_once:v,$set:m}=e;return{event:V({},M_(e,$1),{properties:V({},e.properties,m?{$set:V({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},m)}:{},v?{$set_once:V({},(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],n=()=>{var a;!t.errored&&this.br.length&&(Dr.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,Dr.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),i&&n()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{s(a)}});o&&(t.processEvent=o),i=!0}catch(a){Dr.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&t.loaded)try{n()}catch(a){Dr.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 n of e)this.setupSiteApp(n)}$r(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(i){Dr.error("Error while processing event "+e.event+" for site app "+n.id,i)}}}onRemoteConfig(e){var t,n,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 Dr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.wr)==null||n.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var o=function(c){var u;X["__$$ph_site_app_"+c]=s._instance,(u=X.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,l,(p=>{if(p)return Dr.error("Error while initializing PostHog app with config id "+c,p)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else Dr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},Nb=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&By(t,e))return!0;try{var n=r?.userAgentData;if(n!=null&&n.brands&&n.brands.some((i=>By(i?.brand,e))))return!0}catch{}return!!r.webdriver},ao=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),A_="i.posthog.com",ph=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("."+A_,".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]=ao.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=ao.EU:this.Sr[this.apiHost]=ao.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===ao.CUSTOM)return this.apiHost+t;var n=A_+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}},M1={icontains:(r,e)=>!!E&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!E&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!E&&Pl(e.href,r),not_regex:(r,e)=>!!E&&!Pl(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r},hh=class r{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),t.getWebExperiments((i=>{r.kr("retrieved web experiments from the server"),t.Pr=new Map,i.forEach((s=>{if(s.feature_flag_key){var o;t.Pr&&(r.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);Ne(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];r.Ir(c)&&t.Tr(s.name,l,c.transforms)}}))}),n)},this._instance=e,this._instance.onFeatureFlags((n=>{this.onFeatureFlags(n)}))}onFeatureFlags(e){if(this._is_bot())r.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();r.kr("applying feature flags",e),e.forEach((t=>{var n;if(this.Pr&&(n=this.Pr)!=null&&n.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=r.getWindowLocation();if(e!=null&&e.search){var t=Al(e?.search,"__experiment_id"),n=Al(e?.search,"__experiment_variant");t&&n&&(r.kr("previewing web experiments "+t+" && "+n),this.getWebExperiments((i=>{this.Cr(parseInt(t),n,i)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)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,n){var i=n.filter((s=>s.id===e));i&&i.length>0&&(r.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)&&r.Rr(e)&&r.Fr(e)}static Rr(e){var t;if(ue(e.conditions)||ue((t=e.conditions)==null?void 0:t.url))return!0;var n,i,s,o=r.getWindowLocation();return!!o&&((n=e.conditions)==null||!n.url||M1[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return E?.location}static Fr(e){var t;if(ue(e.conditions)||ue((t=e.conditions)==null?void 0:t.utm))return!0;var n=xb();if(n.utm_source){var i,s,o,a,l,c,u,p,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)==n.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==n.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)==n.utm_medium,m=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((p=e.conditions)==null||(p=p.utm)==null?void 0:p.utm_term)==n.utm_term;return h&&v&&m&&f}return!1}static kr(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];B.info("[WebExperiments] "+e,n)}Tr(e,t,n){this._is_bot()?r.kr("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?n.forEach((i=>{if(i.selector){var s;r.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)}))}})):r.kr("Control variants leave the page unmodified.")}_is_bot(){return dt&&this._instance?Nb(dt,this._instance.config.custom_blocked_useragents):void 0}},O1=Te("[PostHog ExternalIntegrations]"),P1={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},fh=class{constructor(e){this._instance=e}it(e,t){var n;(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(i=>{if(i)return O1.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!i||(a=X.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(P1[o],(()=>{var u;(u=X.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)})),!i&&(l=X.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=X.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.stop())};for(var[n,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;t(n)}}},gh="[SessionRecording]",Qs=Te(gh),Fl=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 Qs.error("started without valid sessionManager"),new Error(gh+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(gh+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(zd))==null||!e.enabled),n=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return E&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!this.Ar||(t=this.Or)==null||!t.isStarted){var n=!H(Object.assign)&&!H(Array.from);this.Ar&&n?(this.Dr(e),Qs.info("starting")):this.stopRecording()}}Dr(e){var t,n,i;this.Ar&&(X!=null&&(t=X.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=X.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Lr(e):(i=X.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Nr,(s=>{if(s)return Qs.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(ib)}zr(e){if(this._instance.persistence){var t,n,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({[zd]:V({enabled:!!o},o,{networkPayloadCapture:V({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:H(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=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.zr(e),this.Mr=!0,this.startIfEnabledOrStop()):this.Mr=!0:Qs.info("skipping remote config with no sessionRecording",e)}log(e,t){var n;t===void 0&&(t="log"),(n=this.Or)!=null&&n.log?this.Or.log(e,t):Qs.warn("log called before recorder was ready")}get Nr(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(zd);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Lr(e){var t,n;if((t=X.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Or||(this.Or=(n=X.__PosthogExtensions__)==null?void 0:n.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,n;this.Or||(n=this._instance.persistence)==null||n.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 n;return!((n=this.Or)==null||!n.tryAddCustomEvent(e,t))}},uo={},mh=()=>{},vi="posthog",Lb=!w1&&st?.indexOf("MSIE")===-1&&st?.indexOf("Mozilla")===-1,R_=r=>{var e;return V({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:DC(D?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:mh,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:r??"unset",__preview_deferred_init_extensions:!1,debug:qe&&Ne(qe?.search)&&qe.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:(E==null||(e=E.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 n="Bad HTTP status: "+t.statusCode+" "+t.text;B.error(n)},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:ah},error_tracking:{},_onCapture:mh,__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}))(r))},T_=r=>{var e={};H(r.process_person)||(e.person_profiles=r.process_person),H(r.xhr_headers)||(e.request_headers=r.xhr_headers),H(r.cookie_name)||(e.persistence_name=r.cookie_name),H(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),H(r.store_google)||(e.save_campaign_params=r.store_google),H(r.verbose)||(e.debug=r.verbose);var t=$e({},e,r);return fe(r.property_blacklist)&&(H(r.property_denylist)?t.property_denylist=r.property_blacklist:fe(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:B.error("Invalid value for property_denylist config: "+r.property_denylist)),t},vh=class{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){B.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Dl=class r{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 vh,this.Br=!1,this.version=ur.LIB_VERSION,this.qr=new vo,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=R_(),this.SentryIntegration=Bp,this.sentryIntegration=e=>(function(t,n){var i=bb(t,n);return{name:_b,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 Yp(this),this.toolbar=new Vp(this),this.scrollManager=new uh(this),this.pageViewManager=new Il(this),this.surveys=new rh(this),this.conversations=new nh(this),this.logs=new ih(this),this.experiments=new hh(this),this.exceptions=new Kp(this),this.rateLimiter=new sh(this),this.requestRouter=new ph(this),this.consent=new Fp(this),this.externalIntegrations=new fh(this),this.people={set:(e,t,n)=>{var i=Ne(e)?{[e]:t}:e;this.setPersonProperties(i),n?.({})},set_once:(e,t,n)=>{var i=Ne(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),n?.({})}},this.on("eventCaptured",(e=>B.info('send "'+e?.event+'"',e)))}init(e,t,n){if(n&&n!==vi){var i,s=(i=uo[n])!==null&&i!==void 0?i:new r;return s._init(e,t,n),uo[n]=s,uo[vi][n]=s,s}return this._init(e,t,n)}_init(e,t,n){var i;if(t===void 0&&(t={}),H(e)||lp(e))return B.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($e({},R_(t.defaults),T_(t),{name:n,token:e})),this.config.on_xhr_error&&B.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:hr.GZipJS;var s=this.Qr();this.persistence=new co(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new co(V({},this.config,{persistence:"sessionStorage"}),s);var o=V({},this.persistence.props),a=V({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new lh((x=>this.ts(x)),this.config.request_queue_config),this.es=new ch(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 Ll(this),this.sessionPropsManager=new Nl(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(B.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(B.info("Initializing extensions synchronously"),this.rs(l)),ur.DEBUG=ur.DEBUG||this.config.debug,ur.DEBUG&&B.info("Starting in debug mode",{this:this,config:t,thisC:V({},this.config),p:o,s:a}),((i=t.bootstrap)==null?void 0:i.distinctID)!==void 0){var c,u,p=this.config.get_device_id(Br()),h=(c=t.bootstrap)!=null&&c.isIdentifiedID?p:t.bootstrap.distinctID;this.persistence.set_property(dr,(u=t.bootstrap)!=null&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:h})}if(this.ss()){var f,v,m=Object.keys(((f=t.bootstrap)==null?void 0:f.featureFlags)||{}).filter((x=>{var k;return!((k=t.bootstrap)==null||(k=k.featureFlags)==null||!k[x])})).reduce(((x,k)=>{var _;return x[k]=((_=t.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[k])||!1,x}),{}),g=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter((x=>m[x])).reduce(((x,k)=>{var _,w;return(_=t.bootstrap)!=null&&(_=_.featureFlagPayloads)!=null&&_[k]&&(x[k]=(w=t.bootstrap)==null||(w=w.featureFlagPayloads)==null?void 0:w[k]),x}),{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:g})}if(l)this.register_once({distinct_id:zs,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(Br());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(dr,"anonymous")}return Oe(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?o1(this,(()=>this.ns())):this.ns(),Vr(this.config._onCapture)&&this.config._onCapture!==mh&&(B.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(x=>this.config._onCapture(x.event,x)))),this.config.ip&&B.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 Hp(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new jp(this).startIfEnabledOrStop()})),n.push((()=>{var i;this.siteApps=new dh(this),(i=this.siteApps)==null||i.init()})),e||n.push((()=>{this.sessionRecording=new Fl(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new Op(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.logs.loadIfEnabled()})),n.push((()=>{this.conversations.loadIfEnabled()})),n.push((()=>{this.productTours=new Xp(this),this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new Up(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new Wp(this)})),n.push((()=>{this.exceptionObserver=new Dp(this),this.exceptionObserver.startIfEnabledOrStop()})),n.push((()=>{this.deadClicksAutocapture=new Tl(this,s1),this.deadClicksAutocapture.startIfEnabled()})),n.push((()=>{if(this.os){var i=this.os;this.os=void 0,this.yi(i)}})),this.ls(n,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 n=e.shift();if(n)try{n()}catch(s){B.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&&B.info("PostHog extensions initialized ("+i+"ms)")}yi(e){var t,n,i,s,o,a,l,c,u;if(!D||!D.body)return B.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=le(e.supportedCompression,hr.GZipJS)?hr.GZipJS:le(e.supportedCompression,hr.Base64)?hr.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"}),(n=this.siteApps)==null||n.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(n){B.critical("`loaded` function failed",n)}if(this.us(),this.config.internal_or_test_user_hostname&&qe!=null&&qe.hostname){var e=qe.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 oh(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()&&jr(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&&(Lb?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ol(e.url,{ip:this.config.ip?1:0}),e.headers=V({},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 n,i,s,o=V({},t);o.timeout=o.timeout||6e4,o.url=Ol(o.url,{_:new Date().getTime().toString(),ver:ur.LIB_VERSION,compression:o.compression});var a=(n=o.transport)!==null&&n!==void 0?n:"fetch",l=ml.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(i=(s=tb(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)})(V({},e,{callback:t=>{var n,i;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((n=(i=this.config).on_request_error)==null||n.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,n=[],i=[],s=[];jr(e,(a=>{a&&(t=a[0],fe(t)?s.push(a):Vr(a)?a.call(this):fe(a)&&t==="alias"?n.push(a):fe(a)&&t.indexOf("capture")!==-1&&Vr(this[t])?s.push(a):i.push(a))}));var o=function(a,l){jr(a,(function(c){if(fe(c[0])){var u=l;xe(c,(function(p){u=u[p[0]].apply(u,p.slice(1))}))}else this[c[0]].apply(this,c.slice(1))}),l)};o(n,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,n){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zr){if(this.is_capturing())if(!H(e)&&Ne(e)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var o=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!Ne(t?.$current_url)&&(B.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=n?.timestamp||a,c=Br(),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),n?.$set&&(u.$set=n?.$set);var p,h=e!=="$groupidentify",f=this.vs(n?.$set_once,h);if(f&&(u.$set_once=f),(u=LC(u,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,H(n?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===oo.DISMISSED||e===oo.SENT){var v=t?.[np.SURVEY_ID],m=t?.[np.SURVEY_ITERATION];p={id:v,current_iteration:m},localStorage.getItem(E_(p))||localStorage.setItem(E_(p),"true"),u.$set=V({},u.$set,{[C1({id:v,current_iteration:m},e===oo.SENT?"responded":"dismissed")]:!0})}else e===oo.SHOWN&&(u.$set=V({},u.$set,{[np.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var g=V({},u.properties.$set,u.$set);if(_i(g)||this.setPersonPropertiesForFlags(g),!ue(this.config.before_send)){var y=this.cs(u);if(!y)return;u=y}this.qr.emit("eventCaptured",u);var x={method:"POST",url:(i=n?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:n?._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.ts(x):this.Zr.enqueue(x),u}B.critical("This capture call is ignored due to client rate limiting.")}}else B.error("No event name provided to posthog.capture")}else B.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,n,i,s){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var o=s?void 0:this.persistence.remove_event_timer(e),a=V({},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=V({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!Ne(a.distinct_id)&&!mr(a.distinct_id)||lp(a.distinct_id))&&B.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=p1(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:p,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,n.getTime());a.$session_id=p,a.$window_id=h}this.sessionPropsManager&&$e(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&$e(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.es)==null?void 0:f.length}catch(y){a.$sdk_debug_error_capturing_properties=String(y)}if(this.requestRouter.region===ao.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||s?e!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),a=$e(a,c),e==="$pageview"&&D&&(a.title=D.title),!H(o)){var v=n.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=$e({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),fe(this.config.property_denylist)?xe(this.config.property_denylist,(function(y){delete a[y]})):B.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(B.error("sanitize_properties is deprecated. Use before_send instead"),a=m(a,e));var g=this.fs();return a.$process_person_profile=g,g&&!s&&this.ps("_calculate_event_properties"),a}vs(e,t){var n;if(t===void 0&&(t=!0),!this.persistence||!this.fs()||this.Br)return e;var i=this.persistence.get_initial_props(),s=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),o=$e({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(B.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.Br=!0),_i(o)?void 0:o}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var i;(i=this.persistence)==null||i.register_once(e,t,n)}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,n){var i=n!=null&&n.merge?this.featureFlags.getFlagVariants():{},s=n!=null&&n.merge?this.featureFlags.getFlagPayloads():{},o=V({},i,e),a=V({},s,t),l={};for(var[c,u]of Object.entries(o)){var p=typeof u=="string";l[c]={key:c,enabled:!!p||!!u,variant:p?u:void 0,reason:void 0,metadata:H(a?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:a[c]}}}this.featureFlags.receivedFeatureFlags({flags:l})}updateEarlyAccessFeatureEnrollment(e,t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}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,n;return(t=(n=this.sessionManager)==null?void 0:n.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=R1),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,n){if(!this.__loaded||!this.persistence)return B.uninitializedWarning("posthog.identify");if(mr(e)&&(e=e.toString(),B.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()))B.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!==zs){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(to)&&(this.unregister(to),this.register({distinct_id:e}));var o=(this.persistence.get_property(dr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(dr,"identified"),this.setPersonPropertiesForFlags(V({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.Jr=__(e,t,n),this.featureFlags.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(xl))}}else B.critical('The string "'+zs+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else B.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var n=__(this.get_distinct_id(),e,t);this.Jr!==n?(this.setPersonPropertiesForFlags(V({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=n):B.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,n){if(e&&t){var i=this.getGroups();i[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:V({},i,{[e]:t})}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),i[e]===t||n||this.reloadFeatureFlags()}else B.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,n,i,s;if(B.info("reset"),!this.__loaded)return B.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(dr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:zs,$device_id:null},"");else{var a=this.config.get_device_id(Br());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:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&n){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!n)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0)}return i}alias(e,t){return e===this.get_property(rb)?(B.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(H(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(to,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(B.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=V({},this.config);if(Pe(e)){var n,i,s,o,a,l,c;$e(this.config,T_(e));var u=this.Qr();(n=this.persistence)==null||n.update_config(this.config,t,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new co(V({},this.config,{persistence:"sessionStorage"}),u);var p=this.Kr(this.config.debug);gr(p)&&(this.config.debug=p),gr(this.config.debug)&&(this.config.debug?(ur.DEBUG=!0,Ae.H()&&Ae.G("ph_debug","true"),B.info("set_config",{config:e,oldConfig:t,newConfig:V({},this.config)})):(ur.DEBUG=!1,Ae.H()&&Ae.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,n={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(n).some(Boolean)){var i,s,o,a,l;(i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),n.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),n.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),n.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),n.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 n=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(V({},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:vi;return t!==vi&&(t=vi+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(dr))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(dr))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&_i(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[to])&&((t=this.persistence)==null||(t=t.props)==null||!t[kl]))}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"?(B.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(kl,!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,n,i,s=this.Qr();return((e=this.persistence)==null?void 0:e.ki)!==s&&((n=this.persistence)==null||n.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 n,i,s;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(n=this.sessionManager)==null||n.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new Ll(this),this.pageViewManager=new Il(this),this.persistence&&(this.sessionPropsManager=new Nl(this,this.sessionManager,this.persistence)),this.sessionRecording=new Fl(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(),(H(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 B.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,n;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:zs,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(n=this.sessionRecording)==null||n.stopRecording(),this.sessionRecording=void 0,this.hs())):B.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===pr.GRANTED?"granted":e===pr.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 dt?Nb(dt,this.config.custom_blocked_useragents):void 0}hs(){D&&(D.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:D.title},{send_instantly:!0}),this.Gr&&(D.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),Oe(D,"visibilitychange",this.Gr)))}debug(e){e===!1?(E?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(E?.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,n,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?(B.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):(n="advanced_disable_decide",i=!1,s=B,o=(t="advanced_disable_flags")in(e=l)&&!ue(e[t]),a=n in e&&!ue(e[n]),o?e[t]:a?(s&&s.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]):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],n=e;for(var i of t){if(n=i(n),ue(n)){var s="Event '"+e.event+"' was rejected in beforeSend function";return cC(e.event)?B.warn(s+". This can cause unexpected behavior."):B.info(s),null}n.properties&&!_i(n.properties)||B.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return n}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,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}Kr(e){var t=gr(e)&&!e,n=Ae.H()&&Ae.q("ph_debug")==="true";return!t&&(!!n||e)}};(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=NC(r.prototype[e[t]])})(Dl,["identify"]);var I_;var Fb=(I_=uo[vi]=new Dl,(function(){function r(){r.done||(r.done=!0,Lb=!1,xe(uo,(function(e){e._dom_loaded()})))}D!=null&&D.addEventListener?D.readyState==="complete"?r():Oe(D,"DOMContentLoaded",r,{capture:!1}):E&&B.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),I_);var Rh=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,n=`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=Fb.init(e.apiKey,o,n);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,p=typeof c=="string"?void 0:c?.properties;typeof u=="string"&&this.captureCallback?.(u,p)}),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 n=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){n=a;break}}if(!n){e>0&&setTimeout(()=>this.setupRRWebIntercept(e-1),500);return}let s=n.onRRwebEmit.bind(n);n.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[n,i]of Object.entries(e))n.startsWith("in_segment_")&&(t[n]=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,n){this.track("shadow_canvas_action",{action:e,rectangleId:t,surface:n})}register(e){this.client?.register?.(e)}getSessionId(){return this.client?.get_session_id?.()}startSessionRecording(){this.client?.startSessionRecording?.()}trackExperiment(e,t,n){let i=`$experiment_${e}`;this.register({[i]:n??`variation_${t}`,[`${i}_id`]:t}),this.track("$experiment_started",{$experiment_key:e,$experiment_variation_id:t,$experiment_variation_name:n??`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 Th(r={}){return new Rh(r)}var Db={posthog:r=>Th(r),noop:()=>Vd()};function Hb(r,e){let t=Db[r];if(!t)throw new Error(`Unknown telemetry provider: ${r}. Supported: ${Object.keys(Db).join(", ")}`);return t(e)}async function Bb(r){lu(),z("Syntro Bootstrap","====== INIT ======"),z("Syntro Bootstrap","Options:",{hasToken:!!r.token,tokenPrefix:`${r.token?.slice(0,15)}...`,hasCanvasOptions:!!r.canvas});let e=Pa();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",Ts()),console.log("[DIAG] editorConf:",Oa()),z("Syntro Bootstrap","SDK mode:",e??"normal"),!e&&typeof window<"u"){let C=!!window.__SYNTRO_EDITOR_PARAMS__,P=!!window.__SYNTRO_AUDIT_LEGEND__,G=!!window.__SYNTRO_REVIEW_DATA__;if(C||P||G){let pe=[C&&"__SYNTRO_EDITOR_PARAMS__",P&&"__SYNTRO_AUDIT_LEGEND__",G&&"__SYNTRO_REVIEW_DATA__"].filter(Boolean);console.warn(`[Syntro Bootstrap] \u26A0 Mode detection returned null but mode-specific globals found: ${pe.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=${r.token?r.token.slice(0,15)+"...":"null"}`);let t=r.token;if(!t&&e){let P=Oa()?.syntro_token;P?.startsWith("syn_")&&(t=P,z("Syntro Bootstrap",`\u2713 Using syntro_token from editor_conf (${e} mode)`))}let n;if(t)if(t.startsWith("syn_"))z("Syntro Bootstrap","Token starts with syn_, decoding..."),n=Is(t),lu(n.d);else if(e)z("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw xa("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),xa("Syntro Bootstrap","Token received:",t),new Error("Invalid Syntro token: must start with 'syn_'");else if(e)z("Syntro Bootstrap",`\u2713 No token, but ${e} mode - proceeding`);else throw xa("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=bt("NEXT_PUBLIC_SYNTRO_EXPERIMENT_HOST")||bt("VITE_SYNTRO_EXPERIMENT_HOST")||n?.eh,s=bt("NEXT_PUBLIC_SYNTRO_TELEMETRY_HOST")||bt("VITE_SYNTRO_TELEMETRY_HOST")||n?.th,o=bt("NEXT_PUBLIC_SYNTRO_EDITOR_URL")||bt("VITE_SYNTRO_EDITOR_URL")||r.canvas?.editorUrl,a=n?.g||bt("NEXT_PUBLIC_SYNTRO_GEO_HOST")||bt("VITE_SYNTRO_GEO_HOST")||Cv,l=kv(),c=Zu(),u=r.appSignalsInit??{},p={...c,...l,...u};z("Syntro Bootstrap","Phase 1: Browser metadata:",c),z("Syntro Bootstrap","Phase 1: Cached segment attributes:",l),Object.keys(u).length>0&&z("Syntro Bootstrap","Phase 1: App signals:",u);let h=Gu(a),f=(()=>{try{if(typeof window>"u"||window.self===window.top)return Promise.resolve(null)}catch{}return new Promise(C=>{let P=setTimeout(()=>{window.removeEventListener("message",G),C(null)},500);function G(pe){let ce=pe.data;ce?.jsonrpc==="2.0"&&ce?.id===1&&ce?.result?.hostInfo&&(clearTimeout(P),window.removeEventListener("message",G),C(ce.result.hostInfo))}window.addEventListener("message",G);try{window.parent.postMessage({jsonrpc:"2.0",id:1,method:"ui/initialize",params:{capabilities:{}}},"*")}catch{clearTimeout(P),window.removeEventListener("message",G),C(null)}})})(),v,m=r.debug||r.testMode,g=$s({debug:r.debug,history:m?new Ms(r.testMode?0:100):void 0,testMode:r.testMode});console.log("[Syntro Bootstrap] EventBus created");let y=nu({elementResolver:typeof window<"u"?(C,P)=>{let G=document.elementFromPoint(C,P);if(!G)return null;let pe={tag_name:G.tagName.toLowerCase()};G.id&&(pe.attr__id=G.id),G.className&&typeof G.className=="string"&&(pe.classes=G.className.split(" ").filter(Boolean));for(let ce of G.attributes)ce.name.startsWith("data-")&&(pe[`attr__${ce.name}`]=ce.value);return pe}:void 0});y.onEvent(C=>g.publishEvent(C)),typeof window<"u"&&(setInterval(()=>y.tick(Date.now()),1e3),document.addEventListener("click",C=>{let P=[],G=C.target;for(;G&&G!==document.body;){let pe={tag_name:G.tagName.toLowerCase()};for(let ce of G.attributes)(ce.name.startsWith("data-")||ce.name==="id"||ce.name==="class"||ce.name==="aria-label")&&(pe[`attr__${ce.name}`]=ce.value);P.push(pe),G=G.parentElement}y.enrichClickAttributes(Date.now(),P)},!0));let x=xy(),k,_=C=>{z("Syntro Bootstrap","Phase 2: PostHog feature flags loaded");let P=Ev(C);if(z("Syntro Bootstrap","Segment flags from PostHog:",P),Sv(P),v){let G=R?.getAll?.()??{},pe={...c,...G,...P,...u};z("Syntro Bootstrap","Updating GrowthBook with attributes:",pe),v.setAttributes?.(pe)}if(k&&w?.getDistinctId){let G=w.getDistinctId();G&&s&&n?.t&&k.updateContext({distinctId:G,telemetryHost:s,telemetryKey:n.t})}},w;if(n?.t){let C=n.t==="noop"?"noop":"posthog";w=Hb(C,{apiKey:n.t,apiHost:s,enableFeatureFlags:!0,sessionRecording:!0,onFeatureFlagsLoaded:_,onCapture:(G,pe)=>{y.ingest({kind:"posthog",event:G,properties:pe,timestamp:Date.now()})},onRRWebEvent:G=>{y.ingest(G)}}),console.log(`[Syntro Bootstrap] Telemetry client created (${C}) with EventBus wiring`),Object.keys(u).length>0&&(w.track?.("app_signals_init",u),z("Syntro Bootstrap","Tracked app signals event:",u));let P=w;if(g.setPosthogCapture((G,pe)=>{P.track?.(G,pe)}),x?.name==="shopify"&&s)try{k=new nl({distinctId:w.getDistinctId?.()??"",telemetryHost:s,telemetryKey:n.t}),z("Syntro Bootstrap","ShopifyPixelBridge initialized for checkout attribution")}catch(G){Je("Syntro Bootstrap","ShopifyPixelBridge init failed",G)}}let R;n?.e&&(v=gy("growthbook",{clientKey:n.e,apiHost:i,attributes:p,onExperimentViewed:w?.trackExperiment?(C,P,G)=>{w.trackExperiment(C,P,G)}:void 0})),R=_d({experiments:v,onMetricChange:(C,P)=>{z("Syntro Bootstrap",`Session metric changed: ${C} = ${P}`)}}),z("Syntro Bootstrap","SessionMetricTracker created");let b="production";e==="editor"?b="editor":e==="audit"?b="audit":bt("NODE_ENV")==="development"&&(b="development");let A=Hd({telemetry:w,sessionMetrics:R,mode:b,events:g});z("Syntro Bootstrap","Runtime created:",{version:A.version,mode:A.mode,hasContext:!!A.context,hasEvents:!!A.events,hasState:!!A.state}),z("Syntro Bootstrap","Core app executors already registered");let $=r.cdnBase||bt("NEXT_PUBLIC_SYNTRO_CDN_BASE")||bt("VITE_SYNTRO_CDN_BASE")||Av()||"https://cdn.syntrologie.com",N=wc({cdnBase:$,registry:A.apps,onLoadStart:C=>{z("Syntro Bootstrap",`Loading app from CDN: ${C}`)},onLoadEnd:(C,P,G)=>{P?z("Syntro Bootstrap",`App loaded successfully: ${C}`):Je("Syntro Bootstrap",`Failed to load app: ${C}`,G)}});typeof window<"u"&&(window.SynOS={...window.SynOS,appRegistry:A.apps,appLoader:N,runtime:A,version:A.version},z("Syntro Bootstrap","Global SynOS object exposed")),typeof window<"u"&&window.parent!==window&&N.loadApp("adaptive-mcp").catch(C=>{z("Syntro Bootstrap","auto-load of adaptive-mcp failed (non-fatal):",C)});let M=A.apps.list?.()??[];console.log(`[DIAG] Activation loop: ${M.length} apps in registry:`,M.map(C=>`${C.manifest.id}(${C.state})`).join(", "));for(let C of M)if(C.state==="registered")try{await A.apps.activate(C.manifest.id),console.log(`[DIAG] Activated: ${C.manifest.id} \u2192 widgets: [${A.widgets.list().join(", ")}]`)}catch(P){console.error(`[DIAG] FAILED to activate: ${C.manifest.id}`,P),Je("Syntro Bootstrap",`Failed to auto-activate built-in app: ${C.manifest.id}`,P)}if(console.log(`[DIAG] Activation complete. Total widgets: [${A.widgets.list().join(", ")}]`),v?.refreshFeatures)try{await v.refreshFeatures(),z("Syntro Bootstrap","GrowthBook features loaded")}catch(C){Je("Syntro Bootstrap","Failed to load GrowthBook features:",C)}let K=await h;if(v&&Object.keys(K).length>0){let C={...c,...K,...u};z("Syntro Bootstrap","Merging geo data into GrowthBook attributes:",K),v.setAttributes?.(C)}let L=await f;L&&v&&(c.surface_type="mcp-app",c.surface_host=L.name,v.setAttributes?.({...c,...K}),z("Syntro Bootstrap","MCP App detected:",L.name));let O;if(r.fetcher)O=r.fetcher;else if(n?.f){let C=_y(n.f,n.o??{});O=async()=>{let P=await C.fetch();return{...P.config,tiles:P.config.tiles??[]}}}else v&&(O=ti({experiments:v}));let q=new Set,Y=O?async()=>{let C=await O(),P=C.tiles?.length??0,G=C.actions?.length??0,pe=C.meta?.variant_id;if((P>0||G>0)&&(pe||console.warn("[Syntro] Config has content but no meta.variant_id \u2014 intervention tracking disabled")),w&&pe){let Ee=new Us(w,pe);Ee.trackServed(P,G),typeof window<"u"&&(window.SynOS.interventionTracker=Ee),A.navigation.subscribe(()=>{Ee.resetPage()})}console.log("[Syntro Bootstrap] Config fetched:",`tiles=${C.tiles?.length??0},`,`actions=${C.actions?.length??0},`,`theme=${C.theme?.name??"none"}`),C.actions?.length>0&&console.log("[Syntro Bootstrap] Actions in config:",C.actions.map((Ee,kt)=>`[${kt}] ${Ee.kind}${Ee.anchorId?` anchor="${Ee.anchorId.selector}"`:""}${Ee.label?` "${Ee.label}"`:""}`).join(", "));let ce=C,Be=N.getRequiredApps(ce);return Be.length>0?console.log("[Syntro Bootstrap] Required external apps:",Be.join(", ")):z("Syntro Bootstrap","No external apps required (all executors are built-in)"),Be.length>0&&await N.loadAppsForConfig(ce).then(async kt=>{let St=kt.filter(Me=>Me.success),jl=kt.filter(Me=>!Me.success);St.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${St.map(Me=>Me.appId).join(", ")}`);let Ri=jl.filter(Me=>!q.has(Me.appId));Ri.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",Ri.map(Me=>`${Me.appId} (${Me.error})`).join(", ")),Ri.forEach(Me=>q.add(Me.appId)));for(let Me of Be)if(A.apps.has(Me))try{await A.apps.activate(Me),console.log(`[Syntro Bootstrap] App activated: ${Me}`)}catch(Lt){console.error(`[Syntro Bootstrap] Failed to activate app: ${Me}`,Lt)}else console.error(`[Syntro Bootstrap] App "${Me}" required by config but NOT registered.`,`Available apps: [${Array.from(A.apps.list?.()??[]).join(", ")}]`)}),C}:void 0;if(x){z("Syntro Bootstrap",`Detected platform: ${x.name}`);try{await x.onInit(),z("Syntro Bootstrap",`Platform adapter initialized: ${x.name}`)}catch(C){Je("Syntro Bootstrap",`Platform adapter init failed: ${x.name}`,C)}}return{canvas:await Uu({...r.canvas,fetcher:Y,integrations:{experiments:v,telemetry:w},editorUrl:o,runtime:A}),runtime:A,experiments:v,telemetry:w,sessionMetrics:R,appLoader:N}}async function N1(r){try{return await Bb(r)}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 L1(r,e={}){if(typeof window>"u")return;let t=window.SynOS?.runtime;t?.events?.publish&&t.events.publish({name:r,source:"custom",props:e})}async function F1(r){if(typeof window>"u")return{appId:r,success:!1,error:"no-window"};let e=window.SynOS?.appLoader;return e?e.loadApp(r):{appId:r,success:!1,error:"syntro-not-initialized"}}var Vb={init:N1,loadAdaptive:F1,encodeToken:qu,decodeToken:Is,events:{emit:L1}};typeof window<"u"&&(window.Syntro=Vb);function xo(r){let e=r.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function TN(r){let e=[],t=[];if(!r||typeof r!="object")return{valid:!1,errors:["Config must be an object"],warnings:e};let n=r;if(n.tiles||t.push("Config missing required field: tiles"),n.actions||t.push("Config missing required field: actions"),n.fetchedAt||t.push("Config missing required field: fetchedAt"),t.length>0)return{valid:!1,errors:t,warnings:e};let i=n.schemaVersion||"1.0",s=xo(i),o=xo(Ar);return s.major>o.major&&e.push(`Config schema v${i} is newer than SDK v${Ar}. Some features may not work. Update SDK to latest version.`),s.major<o.major||!n.schemaVersion?(e.push(`Config schema v${i} is older than SDK v${Ar}. Migrating config to current version.`),{valid:!0,warnings:e,errors:t,migratedConfig:D1(n,i)}):{valid:!0,warnings:e,errors:t}}function D1(r,e){let t={...r};return xo(e).major===1&&(t=H1(t)),t.schemaVersion=Ar,t}function H1(r){let e={schemaVersion:"2.0",tiles:[],actions:r.actions||[],fetchedAt:r.fetchedAt||new Date().toISOString()};return r.tiles&&Array.isArray(r.tiles)&&(e.tiles=r.tiles.map(t=>{let n={...t};return t.experiment&&delete n.experiment,n})),r.configVersion&&(e.configVersion=r.configVersion),r.canvasTitle&&(e.canvasTitle=r.canvasTitle),r.theme&&(e.theme=r.theme),r.launcher&&(e.launcher=r.launcher),e}function IN(r){if(!r||typeof r!="object")return!1;let e=r,t=e.schemaVersion||"1.0",n=xo(t),i=xo(Ar);return n.major<i.major||!e.schemaVersion}var B1=d.object({url:d.string(),routeId:d.string().optional(),title:d.string().optional(),locale:d.string().optional()}),V1=d.object({url:d.string(),ts:d.number()}),j1=d.object({sessionId:d.string(),startTs:d.number(),pageHistory:d.array(V1).optional()}),W1=d.object({width:d.number(),height:d.number()}),U1=d.object({x:d.number(),y:d.number(),w:d.number(),h:d.number()}),z1=d.object({anchorId:d.string(),present:d.boolean(),visible:d.boolean().optional(),boundingBox:U1.optional()}),q1=d.record(d.string(),d.union([d.number(),d.string(),d.boolean(),d.undefined()])),Z1=d.object({page:B1,session:j1,viewport:W1,anchors:d.array(z1).optional(),augmented:q1.optional()});function ON(r){return Z1.safeParse(r)}var Ih=class{constructor(e,t,n,i){this._isFallback=!0;this._isLoading=!0;this._cancelled=!1;this._host=e,this._runtime=t,this._strategy=n,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 $h=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 Mh=class{constructor(e,t,n,i){this._host=e,this._runtime=t,this._filter=n,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 jb=d.enum(["posthog","canvas","derived"]),G1=d.object({ts:d.number(),name:d.string(),source:jb,props:d.record(d.string(),d.unknown()).optional(),schemaVersion:d.string()}),K1=d.object({names:d.array(d.string()).optional(),patterns:d.array(d.string()).optional(),sources:d.array(jb).optional()});function nL(r){return G1.safeParse(r)}function iL(r){return K1.safeParse(r)}var Wb=d.union([d.object({type:d.literal("data"),key:d.string(),value:d.string().optional()}),d.object({type:d.literal("css"),value:d.string()}),d.object({type:d.literal("aria"),role:d.string().optional(),label:d.string().optional()}),d.object({type:d.literal("shadow-css"),value:d.string()}),d.object({type:d.literal("ref"),el:d.any()})]),Y1=d.object({kind:d.literal("tooltip"),id:d.string(),anchor:Wb,content:d.object({title:d.string().optional(),body:d.string()}),placement:d.enum(["top","bottom","left","right","auto"]).optional(),offsetPx:d.number().optional(),blocking:d.boolean().optional(),trigger:d.enum(["immediate","hover","click"]).optional(),dismiss:d.object({onEsc:d.boolean().optional(),closeButton:d.boolean().optional(),timeoutMs:d.number().optional()}).optional()}),X1=d.object({kind:d.literal("highlight"),id:d.string(),anchor:Wb,copy:d.string().optional(),ring:d.object({paddingPx:d.number().optional(),radiusPx:d.number().optional()}).optional(),scrim:d.object({opacity:d.number().optional()}).optional(),ringColor:d.string().optional(),blocking:d.boolean().optional(),dismiss:d.object({onClickOutside:d.boolean().optional(),onEsc:d.boolean().optional(),timeoutMs:d.number().optional()}).optional()}),Oh=d.object({id:d.string(),version:d.number(),routes:d.array(d.string()).optional(),steps:d.array(d.union([Y1,X1]))});function _L(r){return Oh.parse(r)}var kL=({configUri:r,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:n="include"}={})=>async()=>{let i=uu({configUri:r,experiments:e,featureKey:t});if(!i)throw new Error("SmartCanvas overlays: recipe URI missing (env + feature unset).");let s=await fetch(i,{credentials:n});if(!s.ok)throw new Error(`SmartCanvas overlays: failed to fetch recipe (${s.status})`);let o=await s.json();return Oh.parse(o)};var J1=d.object({value:d.unknown(),expiresAt:d.number().optional()}),Q1=d.object({count:d.number(),resetAt:d.number().optional()});function CL(r){return J1.safeParse(r)}function AL(r){return Q1.safeParse(r)}var Ub="2026-04-27T20:12:09.751Z (3f2dc3a5794)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${Ub} (Lit)`);let r=window.SynOS,e=r?.appRegistry||Xi;window.SynOS={...r,appRegistry:e,_runtimeBuild:Ub,_renderer:"lit"},Sa(),lm(e)}export{Ws as ANIMATION_KEYFRAMES,$a as ActivationConfigZ,Xm as AddClassZ,_t as AnchorIdZ,z1 as AnchorStateZ,Vc as AnchorVisibleConditionZ,Yi as AppRegistry,q1 as AugmentationZ,Bm as BadgePositionZ,nv as BadgeZ,U1 as BoundingBoxZ,xs as CanvasEvents,Oh as CanvasRecipeZ,Cr as ConditionZ,il as ContextManager,Zc as CooldownActiveConditionZ,as as CounterDefZ,Bu as CtaButtonZ,su as DEFAULT_COOLDOWN,Ih as DecisionController,hs as DecisionStrategyZ,qc as DismissedConditionZ,Ie as EVENT_SCHEMA_VERSION,La as EventBus,Kc as EventCountConditionZ,K1 as EventFilterZ,Ms as EventHistory,jc as EventOccurredConditionZ,jb as EventSourceZ,Aa as ExecutorRegistry,ps as ExternalStrategyZ,Q1 as FrequencyEntryZ,Gc as FrequencyLimitConditionZ,X1 as HighlightStepZ,Hm as HighlightStyleZ,tv as HighlightZ,ev as InsertHtmlZ,Um as InsertPositionZ,Us as InterventionTracker,iu as MAX_VISIBLE_TOASTS,os as MatchOpZ,Wm as ModalContentZ,sv as ModalZ,ds as ModelStrategyZ,lv as MountWidgetZ,av as NavigateZ,Hs as NavigationMonitor,G1 as NormalizedEventZ,bs as NotificationsController,B1 as PageContextZ,V1 as PageHistoryEntryZ,Hc as PageUrlConditionZ,dv as ParallelZ,Vm as PlacementZ,rv as PulseZ,Ub as RUNTIME_SDK_BUILD,Ny as RUNTIME_VERSION,Jm as RemoveClassZ,Bc as RouteConditionZ,Dm as RouteFilterZ,cs as RuleStrategyZ,ls as RuleZ,Z1 as RuntimeContextZ,$h as RuntimeController,Mh as RuntimeEventsController,Ar as SDK_SCHEMA_VERSION,cu as SDK_VERSION,$y as STATIC_SLOT_STYLES,us as ScoreStrategyZ,Gm as ScrollBehaviorZ,Hu as ScrollLogicalPositionZ,ov as ScrollToZ,Wb as SelectorZ,uv as SequenceZ,j1 as SessionContextZ,zc as SessionMetricConditionZ,el as SessionMetricTracker,Ym as SetAttrZ,Qm as SetStyleZ,Km as SetTextZ,du as SmartCanvasController,ni as SmartCanvasElementLit,Ue as StandardEvents,Wc as StateEqualsConditionZ,al as StateStore,J1 as StoredValueZ,Vb as Syntro,ws as ThemeController,jm as TooltipContentZ,Y1 as TooltipStepZ,zm as TooltipTriggerZ,iv as TooltipZ,Zm as TourStepForSchemaZ,pv as TourZ,oa as TriggerWhenZ,Uc as ViewportConditionZ,W1 as ViewportContextZ,cv as WaitZ,qm as WidgetConfigZ,cl as WidgetRegistry,Td as applyStaticSlotStyles,PS as coreActionStepSchemas,Fu as createActionEngine,Vu as createAnchorResolver,ti as createCanvasConfigFetcher,wd as createContextManager,kd as createDecisionEngine,Sd as createEventAccumulator,$s as createEventBus,md as createGrowthBookClient,Vd as createNoopClient,kL as createOverlayRecipeFetcher,Th as createPostHogClient,pm as createPostHogNormalizer,_d as createSessionMetricTracker,Uu as createSmartCanvas,ym as createSmartCanvasController,Hd as createSmartCanvasRuntime,Rd as createStateStore,Pd as createSurfaceContainer,Ld as createSurfaces,IM as decisionSchemas,Is as decodeToken,qu as encodeToken,Cy as evaluate,ky as evaluateCondition,Sy as evaluateRule,sl as evaluateRuleStrategy,ol as evaluateScoreStrategy,Ay as evaluateSync,sr as executorRegistry,NS as getAntiFlickerSnippet,wS as getExecutor,ll as getSlotAnchorId,js as getSlotType,Nd as getSlotZIndex,xu as hasExecutor,IN as needsMigration,ys as normalizePostHogEvent,xo as parseVersion,Md as playEnterAnimation,Od as playExitAnimation,ri as registerConfigPredicates,Sa as registerSmartCanvasElement,uu as resolveConfigUri,vS as runtimeContext,Id as setupAdjacentPositioning,$d as setupInlinePositioning,_s as shouldNormalizeEvent,jt as validateAction,Ia as validateActions,TM as validateActivationConfig,AM as validateCondition,TN as validateConfig,iL as validateEventFilter,Yu as validateEventName,AL as validateFrequencyEntry,nL as validateNormalizedEvent,Xu as validateProps,_L as validateRecipe,ON as validateRuntimeContext,CL as validateStoredValue,RM as validateStrategy,Fd as widgetRegistry};
1010
+ `)).length,i=0;i<n;i++){var o=r.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),Nt(a)||(t>e&&(s+=r.substring(e,t)),s+=a,e=t=i+1)}return t>e&&(s+=r.substring(e,r.length)),s},w1=!!op||!!sp,y_="text/plain",Ol=function(r,e,t){var n;t===void 0&&(t=!0);var[i,s]=r.split("?"),o=V({},e),a=(n=s?.split("&").map((c=>{var u,[p,h]=c.split("="),f=t&&(u=o[p])!==null&&u!==void 0?u:h;return delete o[p],p+"="+f})))!==null&&n!==void 0?n:[],l=KC(o);return l&&a.push(l),i+"?"+a.join("&")},so=(r,e)=>JSON.stringify(r,((t,n)=>typeof n=="bigint"?n.toString():n),e),Jd=r=>{var{data:e,compression:t}=r;if(e){if(t===hr.GZipJS){var n=b1((function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var p=new wt(l.length+(l.length>>>1)),h=0,f=function(y){p[h++]=y},v=0;v<u;++v){if(h+5>p.length){var m=new wt(h+8+(u-v<<1));m.set(p),p=m}var g=l.charCodeAt(v);g<128||c?f(g):g<2048?(f(192|g>>>6),f(128|63&g)):g>55295&&g<57344?(f(240|(g=65536+(1047552&g)|1023&l.charCodeAt(++v))>>>18),f(128|g>>>12&63),f(128|g>>>6&63),f(128|63&g)):(f(224|g>>>12),f(128|g>>>6&63),f(128|63&g))}return $b(p,0,h)})(so(e)),{mtime:0}),i=new Blob([n],{type:y_});return{contentType:y_,body:i,estimatedSize:i.size}}if(t===hr.Base64){var s=(function(l){var c,u,p,h,f,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,g=0,y="",x=[];if(!l)return l;l=x1(l);do c=(f=l.charCodeAt(m++)<<16|l.charCodeAt(m++)<<8|l.charCodeAt(m++))>>18&63,u=f>>12&63,p=f>>6&63,h=63&f,x[g++]=v.charAt(c)+v.charAt(u)+v.charAt(p)+v.charAt(h);while(m<l.length);switch(y=x.join(""),l.length%3){case 1:y=y.slice(0,-2)+"==";break;case 2:y=y.slice(0,-1)+"="}return y})(so(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:so(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=so(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},ml=[];sp&&ml.push({transport:"fetch",method:r=>{var e,t,{contentType:n,body:i,estimatedSize:s}=(e=Jd(r))!==null&&e!==void 0?e:{},o=new Headers;xe(r.headers,(function(u,p){o.append(p,u)})),n&&o.append("Content-Type",n);var a=r.url,l=null;if(Dy){var c=new Dy;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),r.timeout)}}sp(a,V({method:r?.method||"GET",headers:o,keepalive:r.method==="POST"&&(s||0)<52428.8,body:i,signal:(t=l)==null?void 0:t.signal},r.fetchOptions)).then((u=>u.text().then((p=>{var h={statusCode:u.status,text:p};if(u.status===200)try{h.json=JSON.parse(p)}catch(f){B.error(f)}r.callback==null||r.callback(h)})))).catch((u=>{B.error(u),r.callback==null||r.callback({statusCode:0,text:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),op&&ml.push({transport:"XHR",method:r=>{var e,t=new op;t.open(r.method||"GET",r.url,!0);var{contentType:n,body:i}=(e=Jd(r))!==null&&e!==void 0?e:{};xe(r.headers,(function(s,o){t.setRequestHeader(o,s)})),n&&t.setRequestHeader("Content-Type",n),r.timeout&&(t.timeout=r.timeout),r.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{}r.callback==null||r.callback(s)}},t.send(i)}}),dt!=null&&dt.sendBeacon&&ml.push({transport:"sendBeacon",method:r=>{var e=Ol(r.url,{beacon:"1"});try{var t,{contentType:n,body:i}=(t=Jd(r))!==null&&t!==void 0?t:{},s=typeof i=="string"?new Blob([i],{type:n}):i;dt.sendBeacon(e,s)}catch{}}});var Pl=function(r,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}};function __(r,e,t){return so({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Mb={exact:(r,e)=>e.some((t=>r.some((n=>t===n)))),is_not:(r,e)=>e.every((t=>r.every((n=>t!==n)))),regex:(r,e)=>e.some((t=>r.some((n=>Pl(t,n))))),not_regex:(r,e)=>e.every((t=>r.every((n=>!Pl(t,n))))),icontains:(r,e)=>e.map(fl).some((t=>r.map(fl).some((n=>t.includes(n))))),not_icontains:(r,e)=>e.map(fl).every((t=>r.map(fl).every((n=>!t.includes(n))))),gt:(r,e)=>e.some((t=>{var n=parseFloat(t);return!isNaN(n)&&r.some((i=>n>parseFloat(i)))})),lt:(r,e)=>e.some((t=>{var n=parseFloat(t);return!isNaN(n)&&r.some((i=>n<parseFloat(i)))}))},fl=r=>r.toLowerCase();function Ob(r,e){return!r||Object.entries(r).every((t=>{var[n,i]=t,s=e?.[n];if(H(s)||Nt(s))return!1;var o=[String(s)],a=Mb[i.operator];return!!a&&a(i.values,o)}))}var Qd=Te("[Error tracking]"),Kp=class{constructor(e){var t,n;this.Zt=[],this.ti=new fp([new mp,new kp,new yp,new vp,new xp,new bp,new _p,new wp],$C()),this._instance=e,this.Zt=(t=(n=this._instance.persistence)==null?void 0:n.get_property(Ep))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,n,i,s=(t=(n=e.errorTracking)==null?void 0:n.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({[Ep]:this.Zt,[Xy]:o})}get ii(){var e,t=!!this._instance.get_property(Xy),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??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 Qd.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void Qd.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void Qd.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(((n,i)=>{var{type:s,value:o}=i;return Ne(s)&&s.length>0&&n.$exception_types.push(s),Ne(o)&&o.length>0&&n.$exception_values.push(o),n}),{$exception_types:[],$exception_values:[]});return this.Zt.some((n=>{var i=n.values.map((s=>{var o,a=Mb[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 n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}si(e){return e.flatMap((t=>{var n,i;return(n=(i=t.stacktrace)==null?void 0:i.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ni(e){if(e.length>0){var t,n,i,s,o=(t=(n=e[0].stacktrace)==null?void 0:n.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)}},ut=Te("[FeatureFlags]"),Ys=Te("[FeatureFlags]",{debugEnabled:!0}),ep="$active_feature_flags",fi="$override_feature_flags",b_="$feature_flag_payloads",Xs="$override_feature_flag_payloads",x_="$feature_flag_request_id",w_="$feature_flag_evaluated_at",k_=r=>{var e={};for(var[t,n]of gl(r||{}))n&&(e[t]=n);return e},k1=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var n;return[t,(n=e[t].variant)!==null&&n!==void 0?n:e[t].enabled]}))),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var n;return(n=e[t].metadata)==null?void 0:n.payload})).map((t=>{var n;return[t,(n=e[t].metadata)==null?void 0:n.payload]})))):ut.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},S1=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({}),Yp=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||(ut.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((n=>{var i=n&&typeof n=="string"&&n.trim().length>0;return i||ut.error("Invalid evaluation context found:",n,"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(Cp),t=this._instance.get_property(fi),n=this._instance.get_property(Xs);if(!n&&!t)return e||{};var i=$e({},e||{}),s=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of s){var a,l,c=i[o],u=t?.[o],p=H(u)?(a=c?.enabled)!==null&&a!==void 0&&a:!!u,h=H(u)?c.variant:typeof u=="string"?u:void 0,f=n?.[o],v=V({},c,{enabled:p,variant:p?h??c?.variant:void 0});p!==c?.enabled&&(v.original_enabled=c?.enabled),h!==c?.variant&&(v.original_variant=c?.variant),f&&(v.metadata=V({},c?.metadata,{payload:f,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),i[o]=v}return this.oi||(ut.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.oi=!0),i}getFlagVariants(){var e=this._instance.get_property(bi),t=this._instance.get_property(fi);if(!t)return e||{};for(var n=$e({},e),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(ut.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.oi=!0),n}getFlagPayloads(){var e=this._instance.get_property(b_),t=this._instance.get_property(Xs);if(!t)return e||{};for(var n=$e({},e||{}),i=Object.keys(t),s=0;s<i.length;s++)n[i[s]]=t[i[s]];return this.oi||(ut.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.oi=!0),n}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 n=this._instance.config.token,i=this._instance.get_property("$device_id"),s={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:V({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(io)||{}),group_properties:this._instance.get_property(On)};Nt(i)||H(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=Ab()),this.li=!0,this._instance._send_request({method:"POST",url:c,data:s,compression:this._instance.config.disable_compression?void 0:hr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:u=>{var p,h,f=!0;if(u.statusCode===200&&(this.hi||(this.$anon_distinct_id=void 0),f=!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=!f,u.json&&(p=u.json.quotaLimited)!=null&&p.includes(S1.FeatureFlags))ut.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:{},f),this.hi&&(this.hi=!1,this.mi())}}})}}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlagResult(e,t);return(n=i?.variant)!==null&&n!==void 0?n:i?.enabled}ut.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 n=this.getFlagVariants(),i=e in n,s=n[e],o=this.getFlagPayloads()[e],a=String(s),l=this._instance.get_property(x_)||void 0,c=this._instance.get_property(w_)||void 0,u=this._instance.get_property(xl)||{};if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){var p,h,f,v,m,g,y,x,k;fe(u[e])?u[e].push(a):u[e]=[a],(p=this._instance.persistence)==null||p.register({[xl]:u});var _=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:((f=this._instance.config.bootstrap)==null||(f=f.featureFlagPayloads)==null?void 0:f[e])||null,$used_bootstrap_value:!this.vi};H(_==null||(v=_.metadata)==null?void 0:v.version)||(w.$feature_flag_version=_.metadata.version);var R,b=(m=_==null||(g=_.reason)==null?void 0:g.description)!==null&&m!==void 0?m:_==null||(y=_.reason)==null?void 0:y.code;b&&(w.$feature_flag_reason=b),_!=null&&(x=_.metadata)!=null&&x.id&&(w.$feature_flag_id=_.metadata.id),H(_?.original_variant)&&H(_?.original_enabled)||(w.$feature_flag_original_response=H(_.original_variant)?_.original_enabled:_.original_variant),_!=null&&(k=_.metadata)!=null&&k.original_payload&&(w.$feature_flag_original_payload=_==null||(R=_.metadata)==null?void 0:R.original_payload),this._instance.capture("$feature_flag_called",w)}if(i){var A=o;if(!H(o))try{A=JSON.parse(o)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:A}}}else ut.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var n=this._instance.config.token,i={distinct_id:this._instance.get_distinct_id(),token:n};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:hr.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 n=this.getFeatureFlag(e,t);return H(n)?void 0:!!n}ut.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 n=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 p=k1(o),h=p.flags,f=p.featureFlags,v=p.featureFlagPayloads;if(f){var m=o.requestId,g=o.evaluatedAt;if(fe(f)){ut.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var y={};if(f)for(var x=0;x<f.length;x++)y[f[x]]=!0;a&&a.register({[ep]:f,[bi]:y})}else{var k=f,_=v,w=h;if(o.errorsWhileComputingFlags)if(h){var R=new Set(Object.keys(h).filter((b=>{var A;return!((A=h[b])!=null&&A.failed)})));k=V({},l,Object.fromEntries(Object.entries(k).filter((b=>{var[A]=b;return R.has(A)})))),_=V({},c,Object.fromEntries(Object.entries(_||{}).filter((b=>{var[A]=b;return R.has(A)})))),w=V({},u,Object.fromEntries(Object.entries(w||{}).filter((b=>{var[A]=b;return R.has(A)}))))}else k=V({},l,k),_=V({},c,_),w=V({},u,w);a&&a.register(V({[ep]:Object.keys(k_(k)),[bi]:k||{},[b_]:_||{},[Cp]:w||{}},m?{[x_]:m}:{},g?{[w_]:g}:{}))}}})(e,this._instance.persistence,n,i,s),this.wi(t)}}override(e,t){t===void 0&&(t=!1),ut.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return ut.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(fi),this._instance.persistence.unregister(Xs),this.wi(),Ys.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;if(this.oi=!!((t=n.suppressWarning)!==null&&t!==void 0&&t),"flags"in n){if(n.flags===!1)this._instance.persistence.unregister(fi),Ys.info("Flag overrides cleared");else if(n.flags){if(fe(n.flags)){for(var i={},s=0;s<n.flags.length;s++)i[n.flags[s]]=!0;this._instance.persistence.register({[fi]:i})}else this._instance.persistence.register({[fi]:n.flags});Ys.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(Xs),Ys.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[Xs]:n.payloads}),Ys.info("Payload overrides set",{payloads:n.payloads}))),void this.wi()}this.wi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:n}=this.xi();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i,s=(this._instance.get_property(no)||[]).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),n&&(a.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=V({},this.getFlagVariants(),{[e]:t});(i=this._instance.persistence)==null||i.register({[ep]:Object.keys(k_(l)),[bi]:l}),this.wi()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this._instance.get_property(no),s=n?"&"+n.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(no),(l=this._instance.persistence)==null||l.register({[no]:c}),e(c)}}})}xi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,i)=>(n[i]=t[i],n)),{})}}wi(e){var{flags:t,flagVariants:n}=this.xi();this.featureFlagEventHandlers.forEach((i=>i(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(io)||{};this._instance.register({[io]:V({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(io)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(On)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=V({},n[i],e[i]),delete e[i]})),this._instance.register({[On]:V({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(On)||{};this._instance.register({[On]:V({},t,{[e]:{}})})}else this._instance.unregister(On)}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}},E1=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],co=class{constructor(e,t){this.R=e,this.props={},this.Ei=!1,this.$i=(n=>{var i="";return n.token&&(i=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+i+"_posthog"})(e),this.Y=this.Si(e),this.load(),e.debug&&B.info("Persistence loaded",e.persistence,V({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){E1.indexOf(e.persistence.toLowerCase())===-1&&(B.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=[...r1,...i];return V({},Ae,{W:function(o){try{var a={};try{a=zt.W(o)||{}}catch{}var l=$e(a,JSON.parse(Ae.q(o)||"{}"));return Ae.G(o,l),l}catch{}return null},G:function(o,a,l,c,u,p){try{Ae.G(o,a,void 0,void 0,p);var h={};s.forEach((f=>{a[f]&&(h[f]=a[f])})),Object.keys(h).length&&zt.G(o,h,l,c,u,p)}catch(f){Ae.B(f)}},V:function(o,a){try{E?.localStorage.removeItem(o),zt.V(o,a)}catch(l){Ae.B(l)}}})})(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return n==="localstorage"&&Ae.H()?Ae:n==="localstorage+cookie"&&t.H()?t:n==="sessionstorage"&&ze.H()?ze:n==="memory"?n1:n==="cookie"?zt:t.H()?t:zt}properties(){var e={};return xe(this.props,(function(t,n){if(n===bi&&Pe(t))for(var i=Object.keys(t),s=0;s<i.length;s++)e["$feature/"+i[s]]=t[i[s]];else a=n,l=!1,(Nt(o=HC)?l:Fy&&o.indexOf===Fy?o.indexOf(a)!=-1:(xe(o,(function(c){if(l||(l=c===a))return _l})),l))||(e[n]=t);var o,a,l})),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=$e({},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,n){if(Pe(e)){H(t)&&(t="None"),this.Pi=H(n)?this.Ci:n;var i=!1;if(xe(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=H(t)?this.Ci:t;var n=!1;if(xe(e,((i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,n=!0)})),n)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=xb(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);_i(wh(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=D?.referrer)?kb(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Sb(),$referring_domain:D!=null&&D.referrer&&((e=Cl(D.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Ip]||this.props[$p]||this.register_once({[wl]:Eb(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};xe([$p,Ip],(o=>{var a=this.props[o];a&&xe(a,(function(l,c){e["$initial_"+ap(c)]=l}))}));var t,n,i=this.props[wl];if(i){var s=(t=Cb(i),n={},xe(t,(function(o,a){n["$initial_"+ap(a)]=o})),n);$e(e,s)}return e}safe_merge(e){return xe(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(e,t,n){if(this.Ci=this.Pi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),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,p)=>u===c[p]))})(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 n=this.props[ro]||{};n[e]=t,this.props[ro]=n,this.save()}remove_event_timer(e){var t=(this.props[ro]||{})[e];return H(t)||(delete this.props[ro][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},S_=Te("[Product Tours]"),tp="ph_product_tours",Xp=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[Qy]:!(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(Qy)||this.it((()=>this.Oi()))}it(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?S_.error("Could not load product tours script",i):e()}))}Oi(){var e;!this.Ri&&(e=X.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=X.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!fe(this.Fi)||t){var n=this._instance.persistence;if(n){var i=n.props[tp];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 S_.error(a),void e([],{isLoaded:!1,error:a})}var l=fe(s.json.product_tours)?s.json.product_tours:[];this.Fi=l,n&&n.register({[tp]: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(tp)}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)}},Js=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),qP=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),ZP=(function(r){return r.TopLeft="top_left",r.TopRight="top_right",r.TopCenter="top_center",r.MiddleLeft="middle_left",r.MiddleRight="middle_right",r.MiddleCenter="middle_center",r.Left="left",r.Center="center",r.Right="right",r.NextToTrigger="next_to_trigger",r})({}),GP=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),rp=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),KP=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),YP=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),XP=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),oo=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),np=(function(r){return r.SURVEY_ID="$survey_id",r.SURVEY_NAME="$survey_name",r.SURVEY_RESPONSE="$survey_response",r.SURVEY_ITERATION="$survey_iteration",r.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",r.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",r.SURVEY_SUBMISSION_ID="$survey_submission_id",r.SURVEY_QUESTIONS="$survey_questions",r.SURVEY_COMPLETED="$survey_completed",r.PRODUCT_TOUR_ID="$product_tour_id",r.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",r})({}),Jp=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),be=Te("[Surveys]"),Pb="seenSurvey_",C1=(r,e)=>{var t="$survey_"+e+"/"+r.id;return r.current_iteration&&r.current_iteration>0&&(t="$survey_"+e+"/"+r.id+"/"+r.current_iteration),t},E_=r=>((e,t)=>{var n=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=""+e+t.id+"_"+t.current_iteration),n})(Pb,r),A1=[rp.Popover,rp.Widget,rp.API],R1={ignoreConditions:!1,ignoreDelay:!1,displayType:Jp.Popover},vo=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((n=>n!==t))}}emit(e,t){for(var n of this.Mi[e]||[])n(t);for(var i of this.Mi["*"]||[])i(e,t)}};function gi(r,e,t){if(ue(r))return!1;switch(t){case"exact":return r===e;case"contains":var n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(n,"i").test(r);case"regex":try{return new RegExp(e).test(r)}catch{return!1}default:return!1}}var Qp=class{constructor(e){this.Ai=new vo,this.ji=(t,n)=>this.Di(t,n)&&this.Li(t,n)&&this.Ni(t,n)&&this.Ui(t,n),this.Di=(t,n)=>n==null||!n.event||t?.event===n?.event,this._instance=e,this.zi=new Set,this.Hi=new Set}init(){var e;if(!H((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook(((n,i)=>{this.on(n,i)}))}}register(e){var t,n;if(!H((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||"")}))})),(n=this._instance)!=null&&n.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 n;t!=null&&e.length!=0&&(this.zi.has(e)||this.zi.has(t?.event))&&this.Hi&&((n=this.Hi)==null?void 0:n.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 n of t.steps)if(this.ji(e,n))return!0;return!1}onAction(e,t){return this.Ai.on(e,t)}Li(e,t){if(t!=null&&t.url){var n,i=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!i||typeof i!="string"||!gi(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 n;if(t==null||!t.href)return!0;var i=this.Ji(e);if(i.length>0)return i.some((a=>gi(a.href,t.href,t.href_matching||"exact")));var s,o=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!o&&gi((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}Gi(e,t){var n;if(t==null||!t.text)return!0;var i=this.Ji(e);if(i.length>0)return i.some((c=>gi(c.text,t.text,t.text_matching||"exact")||gi(c.$el_text,t.text,t.text_matching||"exact")));var s,o,a,l=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||"";return!!l&&(s=(function(c){for(var u,p=[],h=/(?::|")text="(.*?)"/g;!ue(u=h.exec(c));)p.includes(u[1])||p.push(u[1]);return p})(l),o=t.text,a=t.text_matching||"exact",s.some((c=>gi(c,o,a))))}Vi(e,t){var n,i;if(t==null||!t.selector)return!0;var s=e==null||(n=e.properties)==null?void 0:n.$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||Ob(t.properties.reduce(((n,i)=>{var s=fe(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return n[i.key]={values:s,operator:i.operator||"exact"},n}),{}),e?.properties)}},eh=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&Ob(e.propertyFilters,t?.properties)}Zi(e,t){var n=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=n.get(o.name)||[];a.push(i.id),n.set(o.name,a)}}))})),n}te(e,t,n){var i=(n===Js.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[n])==null||(a=a.values)==null?void 0:a.find((c=>c.name===e));return this.Qi(l,t)}))}register(e){var t;H((t=this._instance)==null?void 0:t._addCaptureHook)||(this.ee(e),this.re(e))}re(e){var t=e.filter((n=>{var i,s;return((i=n.conditions)==null?void 0:i.actions)&&((s=n.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));t.length!==0&&(this.se==null&&(this.se=new Qp(this._instance),this.se.init(),this.se.qi((n=>{this.onAction(n)}))),t.forEach((n=>{var i,s,o,a,l;n.conditions&&(i=n.conditions)!=null&&i.actions&&(s=n.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.se)==null||a.register(n.conditions.actions.values),(l=n.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(n.id),this.Xi.set(c.name,u||[n.id])}})))})))}ee(e){var t,n=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}));(n.length!==0||i.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((s,o)=>{this.onEvent(s,o)})),this.Ki=this.Zi(e,Js.Activation),this.Yi=this.Zi(e,Js.Cancellation))}onEvent(e,t){var n,i=this.ne(),s=this.oe(),o=this.ae(),a=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.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 p=a.indexOf(u);p>=0&&(a.splice(p,1),this.le(a))}}else{if(this.Yi.has(e)){var h=this.te(e,t,Js.Cancellation);h.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map((v=>v.id))}),h.forEach((v=>{var m=a.indexOf(v.id);m>=0&&a.splice(m,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 f=this.te(e,t,Js.Activation);this.le(a.concat(f.map((v=>v.id))||[]))}}}onAction(e){var t,n=this.oe(),i=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[];this.Xi.has(e)&&this.le(i.concat(this.Xi.get(e)||[]))}le(e){var t,n=this.ne(),i=this.oe(),s=[...new Set(e)].filter((o=>!this.he(o)));n.info("updating activated items",{activatedItems:s}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[i]:s})}getActivatedIds(){var e,t=this.oe(),n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return n||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}},th=class extends eh{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return oo.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 be}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},rh=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 be.warn("Flags not loaded yet. Not loading surveys.");var n=fe(t);this.ve=n?t.length>0:t,be.info("flags response received, isSurveysEnabled: "+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(Pb)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((i=>localStorage.removeItem(i)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)be.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)be.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())be.info("Not loading surveys in cookieless mode without consent.");else{var e=X?.__PosthogExtensions__;if(e){if(!H(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var n=e.generateSurveys;if(n)return void this.ge(n,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 be.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new th(this._instance),be.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){be.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 be.info("Disabled. Not loading surveys."),e([]);var n,i=this._instance.get_property(Ap);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=>{n=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;be.error(l);var c={isLoaded:!1,error:l};return e([],c),void(n==null||n({surveys:[],context:c}))}var u,p=s.json.surveys||[],h=p.filter((v=>(function(m){return!(!m.start_date||m.end_date)})(v)&&((function(m){var g;return!((g=m.conditions)==null||(g=g.events)==null||(g=g.values)==null||!g.length)})(v)||(function(m){var g;return!((g=m.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(v))));h.length>0&&((u=this._surveyEventReceiver)==null||u.register(h)),(o=this._instance.persistence)==null||o.register({[Ap]:p});var f={isLoaded:!0};e(p,f),n?.({surveys:p,context:f})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){be.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!ue(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);be.warn("init was not called")}be(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.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 be.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)?(be.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((n=>{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);n({visible:a.eligible,disabledReason:a.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(ue(this._surveyManager))be.warn("init was not called");else{var s=typeof e=="string"?this.be(e):e;if(s!=null&&s.id)if(A1.includes(s.type)){var o=D?.querySelector(t);if(o)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(be.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;be.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,n),be.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);be.warn("Survey element not found")}else be.warn("Surveys of type "+s.type+" cannot be rendered in the app");else be.warn("Survey not found")}}displaySurvey(e,t){var n;if(ue(this._surveyManager))be.warn("init was not called");else{var i=this.be(e);if(i){var s=i;if((n=i.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=V({},i,{appearance:V({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Jp.Popover&&t.initialResponses&&be.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 be.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Jp.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else be.warn("Survey not found")}}cancelPendingSurvey(e){ue(this._surveyManager)?be.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},cr=Te("[Conversations]"),nh=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)||(gr(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=X?.__PosthogExtensions__;if(e&&!H(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 n=e.loadExternalDependency;if(!n)return void this.Se("PostHog loadExternalDependency extension not found.");n(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 cr.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),cr.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else cr.error("Cannot complete initialization: remote config is null")}Se(e,t){cr.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():cr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!Nt(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var i=this;return yi((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(cr.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var n=this;return yi((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(cr.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return yi((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(cr.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return yi((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(cr.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}},ih=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,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!ue(n)&&n&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=Te("[logs]"),t=X?.__PosthogExtensions__;if(t){var n=t.loadExternalDependency;n?n(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.")}}},C_=Te("[RateLimiter]"),sh=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var n=t.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach((i=>{C_.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4}))}catch(i){return void C_.warn('could not rate limit - continuing. Error: "'+i?.message+'"',{text:n})}},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,n,i;e===void 0&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(n=this.instance.persistence)==null?void 0:n.get_property(Tp))!==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(Tp,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Mn=Te("[RemoteConfig]"),oh=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=X._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,n;(t=X.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(Mn.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 Mn.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void Mn.warn("Remote config is disabled. Falling back to local config.");this.Te((e=>{if(!e)return Mn.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){Mn.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()):Mn.info("__preview_remote_config is disabled. Logging config instead",e):Mn.error("Failed to fetch remote config from PostHog.")}},ah=3e3,lh=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=qt(t?.flush_interval_ms||ah,250,5e3,B.createLogger("flush interval"),ah),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((n=>n.url.indexOf("/e")===0)),...t.filter((n=>n.url.indexOf("/e")!==0))].map((n=>{this.Oe(V({},n,{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(),n=function(){var s=t[i],o=new Date().getTime();s.data&&fe(s.data)&&xe(s.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.Oe(s)};for(var i in t)n()}}),this.Fe))}je(){clearTimeout(this.Me),this.Me=void 0}De(){var e={};return xe(this.Re,(t=>{var n,i=t,s=(i?i.batchKey:null)||i.url;H(e[s])&&(e[s]=V({},i,{data:[]})),(n=e[s].data)==null||n.push(i.data)})),this.Re=[],e}},T1=["retriesPerformedSoFar"],ch=class{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!H(E)&&"onLine"in E.navigator&&(this.Ue=E.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},Oe(E,"online",this.ze),Oe(E,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=M_(e,T1);mi(t)&&(n.url=Ol(n.url,{retry_count:t})),this._instance._send_request(V({},n,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(t??0)<10?this.Be(V({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(i)}}))}Be(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=(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()+n;this.Re.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+n;navigator.onLine||(s+=" (Browser is offline)"),B.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=[],n=this.Re.filter((s=>s.retryAt<e||(t.push(s),!1)));if(this.Re=t,n.length>0)for(var{requestOptions:i}of n)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.We&&(clearTimeout(this.We),this.We=void 0),this.Le=!1,H(E)||(this.ze&&(E.removeEventListener("online",this.ze),this.ze=void 0),this.He&&(E.removeEventListener("offline",this.He),this.He=void 0)),this.Re))try{this._instance._send_request(V({},e,{transport:"sendBeacon"}))}catch(t){B.error(t)}this.Re=[]}},uh=class{constructor(e){this.Ge=()=>{var t,n,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,(n=this.Ve.maxScrollHeight)!==null&&n!==void 0?n: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(E,"scroll",this.Ge,{capture:!0}),Oe(E,"scrollend",this.Ge,{capture:!0}),Oe(E,"resize",this.Ge)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E?.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 n=E?.document.querySelector(t);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return E&&(E.scrollY||E.pageYOffset||E.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return E&&(E.scrollX||E.pageXOffset||E.document.documentElement.scrollLeft)||0}},I1=r=>Eb(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties),Nl=class{constructor(e,t,n,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({[Rp]:a})}},this._instance=e,this.Qe=t,this.Xe=n,this.Ye=i||I1,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[Rp]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?Cb(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 xe(wh(this.getSetOnceProps()),((t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+ap(n)]=t})),e}},ip=Te("[SessionId]"),Ll=class{on(e,t){return this.Ze.on(e,t)}constructor(e,t,n){var i;if(this.tr=[],this.ir=void 0,this.Ze=new vo,this.er=(u,p)=>!(!mi(u)||!mi(p))&&Math.abs(u-p)>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||Br,this.ar=n||Br;var s=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*qt(o,60,36e3,ip.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=ze.W(this.ur),l=ze.W(this.hr);a&&!l?this.rr=a:ze.V(this.ur),ze.G(this.hr,!0)}if((i=this.R.bootstrap)!=null&&i.sessionID)try{var c=(u=>{var p=u.replace(/-/g,"");if(p.length!==32)throw new Error("Not a valid UUID");if(p[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(p.substring(0,12),16)})(this.R.bootstrap.sessionID);this.vr(this.R.bootstrap.sessionID,new Date().getTime(),c)}catch(u){ip.error("Invalid sessionID in bootstrap",u)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return H(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&&ze.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&ze.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?ze.W(this.ur):null}vr(e,t,n){e===this.sr&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.sr=e,this.Xe.register({[bl]:[t,e,n]}))}_r(){var e=this.Xe.props[bl];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&&E&&(E.removeEventListener("beforeunload",this.ir,{capture:!1}),this.ir=void 0),this.tr=[]}cr(){this.ir=()=>{this.dr()&&ze.V(this.hr)},Oe(E,"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 n=t||new Date().getTime(),[i,s,o]=this._r(),a=this.gr(),l=mi(o)&&Math.abs(n-o)>864e5,c=!1,u=!s,p=!u&&!e&&this.er(n,i);u||p||l?(s=this.nr(),a=this.ar(),ip.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:u,activityTimeout:p,sessionPastMaximumLength:l}}),o=n,c=!0):a||(a=this.ar(),c=!0);var h=mi(i)&&e&&!l?i:n,f=mi(o)?o:new Date().getTime();return this.pr(a),this.vr(s,h,f),e||this.lr(),c&&this.tr.forEach((v=>v(s,a,c?{noSessionId:u,activityTimeout:p,sessionPastMaximumLength:l}:void 0))),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:c?{noSessionId:u,activityTimeout:p,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)}},$1=["$set_once","$set"],Dr=Te("[SiteApps]"),dh=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 n=this.globalsForEvent(t);this.br.push(n),this.br.length>1e3&&(this.br=this.br.slice(10))}}get siteAppLoaders(){var e;return(e=X._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,n,i,s,o,a,l;if(!e)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],p=this._instance.get_property("$stored_group_properties")||{};for(var[h,f]of Object.entries(p))c[h]={id:u[h],type:h,properties:f};var{$set_once:v,$set:m}=e;return{event:V({},M_(e,$1),{properties:V({},e.properties,m?{$set:V({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},m)}:{},v?{$set_once:V({},(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],n=()=>{var a;!t.errored&&this.br.length&&(Dr.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,Dr.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),i&&n()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{s(a)}});o&&(t.processEvent=o),i=!0}catch(a){Dr.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&t.loaded)try{n()}catch(a){Dr.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 n of e)this.setupSiteApp(n)}$r(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(i){Dr.error("Error while processing event "+e.event+" for site app "+n.id,i)}}}onRemoteConfig(e){var t,n,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 Dr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.wr)==null||n.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var o=function(c){var u;X["__$$ph_site_app_"+c]=s._instance,(u=X.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,l,(p=>{if(p)return Dr.error("Error while initializing PostHog app with config id "+c,p)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else Dr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},Nb=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&By(t,e))return!0;try{var n=r?.userAgentData;if(n!=null&&n.brands&&n.brands.some((i=>By(i?.brand,e))))return!0}catch{}return!!r.webdriver},ao=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),A_="i.posthog.com",ph=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("."+A_,".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]=ao.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=ao.EU:this.Sr[this.apiHost]=ao.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===ao.CUSTOM)return this.apiHost+t;var n=A_+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}},M1={icontains:(r,e)=>!!E&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!E&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!E&&Pl(e.href,r),not_regex:(r,e)=>!!E&&!Pl(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r},hh=class r{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),t.getWebExperiments((i=>{r.kr("retrieved web experiments from the server"),t.Pr=new Map,i.forEach((s=>{if(s.feature_flag_key){var o;t.Pr&&(r.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);Ne(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];r.Ir(c)&&t.Tr(s.name,l,c.transforms)}}))}),n)},this._instance=e,this._instance.onFeatureFlags((n=>{this.onFeatureFlags(n)}))}onFeatureFlags(e){if(this._is_bot())r.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();r.kr("applying feature flags",e),e.forEach((t=>{var n;if(this.Pr&&(n=this.Pr)!=null&&n.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=r.getWindowLocation();if(e!=null&&e.search){var t=Al(e?.search,"__experiment_id"),n=Al(e?.search,"__experiment_variant");t&&n&&(r.kr("previewing web experiments "+t+" && "+n),this.getWebExperiments((i=>{this.Cr(parseInt(t),n,i)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)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,n){var i=n.filter((s=>s.id===e));i&&i.length>0&&(r.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)&&r.Rr(e)&&r.Fr(e)}static Rr(e){var t;if(ue(e.conditions)||ue((t=e.conditions)==null?void 0:t.url))return!0;var n,i,s,o=r.getWindowLocation();return!!o&&((n=e.conditions)==null||!n.url||M1[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return E?.location}static Fr(e){var t;if(ue(e.conditions)||ue((t=e.conditions)==null?void 0:t.utm))return!0;var n=xb();if(n.utm_source){var i,s,o,a,l,c,u,p,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)==n.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==n.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)==n.utm_medium,m=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((p=e.conditions)==null||(p=p.utm)==null?void 0:p.utm_term)==n.utm_term;return h&&v&&m&&f}return!1}static kr(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];B.info("[WebExperiments] "+e,n)}Tr(e,t,n){this._is_bot()?r.kr("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?n.forEach((i=>{if(i.selector){var s;r.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)}))}})):r.kr("Control variants leave the page unmodified.")}_is_bot(){return dt&&this._instance?Nb(dt,this._instance.config.custom_blocked_useragents):void 0}},O1=Te("[PostHog ExternalIntegrations]"),P1={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},fh=class{constructor(e){this._instance=e}it(e,t){var n;(n=X.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(i=>{if(i)return O1.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!i||(a=X.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(P1[o],(()=>{var u;(u=X.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)})),!i&&(l=X.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=X.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.stop())};for(var[n,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;t(n)}}},gh="[SessionRecording]",Qs=Te(gh),Fl=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 Qs.error("started without valid sessionManager"),new Error(gh+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(gh+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(zd))==null||!e.enabled),n=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return E&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!this.Ar||(t=this.Or)==null||!t.isStarted){var n=!H(Object.assign)&&!H(Array.from);this.Ar&&n?(this.Dr(e),Qs.info("starting")):this.stopRecording()}}Dr(e){var t,n,i;this.Ar&&(X!=null&&(t=X.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=X.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Lr(e):(i=X.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Nr,(s=>{if(s)return Qs.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(ib)}zr(e){if(this._instance.persistence){var t,n,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({[zd]:V({enabled:!!o},o,{networkPayloadCapture:V({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:H(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=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.zr(e),this.Mr=!0,this.startIfEnabledOrStop()):this.Mr=!0:Qs.info("skipping remote config with no sessionRecording",e)}log(e,t){var n;t===void 0&&(t="log"),(n=this.Or)!=null&&n.log?this.Or.log(e,t):Qs.warn("log called before recorder was ready")}get Nr(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(zd);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Lr(e){var t,n;if((t=X.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Or||(this.Or=(n=X.__PosthogExtensions__)==null?void 0:n.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,n;this.Or||(n=this._instance.persistence)==null||n.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 n;return!((n=this.Or)==null||!n.tryAddCustomEvent(e,t))}},uo={},mh=()=>{},vi="posthog",Lb=!w1&&st?.indexOf("MSIE")===-1&&st?.indexOf("Mozilla")===-1,R_=r=>{var e;return V({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:DC(D?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:mh,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:r??"unset",__preview_deferred_init_extensions:!1,debug:qe&&Ne(qe?.search)&&qe.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:(E==null||(e=E.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 n="Bad HTTP status: "+t.statusCode+" "+t.text;B.error(n)},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:ah},error_tracking:{},_onCapture:mh,__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}))(r))},T_=r=>{var e={};H(r.process_person)||(e.person_profiles=r.process_person),H(r.xhr_headers)||(e.request_headers=r.xhr_headers),H(r.cookie_name)||(e.persistence_name=r.cookie_name),H(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),H(r.store_google)||(e.save_campaign_params=r.store_google),H(r.verbose)||(e.debug=r.verbose);var t=$e({},e,r);return fe(r.property_blacklist)&&(H(r.property_denylist)?t.property_denylist=r.property_blacklist:fe(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:B.error("Invalid value for property_denylist config: "+r.property_denylist)),t},vh=class{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){B.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Dl=class r{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 vh,this.Br=!1,this.version=ur.LIB_VERSION,this.qr=new vo,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=R_(),this.SentryIntegration=Bp,this.sentryIntegration=e=>(function(t,n){var i=bb(t,n);return{name:_b,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 Yp(this),this.toolbar=new Vp(this),this.scrollManager=new uh(this),this.pageViewManager=new Il(this),this.surveys=new rh(this),this.conversations=new nh(this),this.logs=new ih(this),this.experiments=new hh(this),this.exceptions=new Kp(this),this.rateLimiter=new sh(this),this.requestRouter=new ph(this),this.consent=new Fp(this),this.externalIntegrations=new fh(this),this.people={set:(e,t,n)=>{var i=Ne(e)?{[e]:t}:e;this.setPersonProperties(i),n?.({})},set_once:(e,t,n)=>{var i=Ne(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),n?.({})}},this.on("eventCaptured",(e=>B.info('send "'+e?.event+'"',e)))}init(e,t,n){if(n&&n!==vi){var i,s=(i=uo[n])!==null&&i!==void 0?i:new r;return s._init(e,t,n),uo[n]=s,uo[vi][n]=s,s}return this._init(e,t,n)}_init(e,t,n){var i;if(t===void 0&&(t={}),H(e)||lp(e))return B.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($e({},R_(t.defaults),T_(t),{name:n,token:e})),this.config.on_xhr_error&&B.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:hr.GZipJS;var s=this.Qr();this.persistence=new co(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new co(V({},this.config,{persistence:"sessionStorage"}),s);var o=V({},this.persistence.props),a=V({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new lh((x=>this.ts(x)),this.config.request_queue_config),this.es=new ch(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 Ll(this),this.sessionPropsManager=new Nl(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(B.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(B.info("Initializing extensions synchronously"),this.rs(l)),ur.DEBUG=ur.DEBUG||this.config.debug,ur.DEBUG&&B.info("Starting in debug mode",{this:this,config:t,thisC:V({},this.config),p:o,s:a}),((i=t.bootstrap)==null?void 0:i.distinctID)!==void 0){var c,u,p=this.config.get_device_id(Br()),h=(c=t.bootstrap)!=null&&c.isIdentifiedID?p:t.bootstrap.distinctID;this.persistence.set_property(dr,(u=t.bootstrap)!=null&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:h})}if(this.ss()){var f,v,m=Object.keys(((f=t.bootstrap)==null?void 0:f.featureFlags)||{}).filter((x=>{var k;return!((k=t.bootstrap)==null||(k=k.featureFlags)==null||!k[x])})).reduce(((x,k)=>{var _;return x[k]=((_=t.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[k])||!1,x}),{}),g=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter((x=>m[x])).reduce(((x,k)=>{var _,w;return(_=t.bootstrap)!=null&&(_=_.featureFlagPayloads)!=null&&_[k]&&(x[k]=(w=t.bootstrap)==null||(w=w.featureFlagPayloads)==null?void 0:w[k]),x}),{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:g})}if(l)this.register_once({distinct_id:zs,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(Br());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(dr,"anonymous")}return Oe(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?o1(this,(()=>this.ns())):this.ns(),Vr(this.config._onCapture)&&this.config._onCapture!==mh&&(B.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(x=>this.config._onCapture(x.event,x)))),this.config.ip&&B.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 Hp(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new jp(this).startIfEnabledOrStop()})),n.push((()=>{var i;this.siteApps=new dh(this),(i=this.siteApps)==null||i.init()})),e||n.push((()=>{this.sessionRecording=new Fl(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new Op(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.logs.loadIfEnabled()})),n.push((()=>{this.conversations.loadIfEnabled()})),n.push((()=>{this.productTours=new Xp(this),this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new Up(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new Wp(this)})),n.push((()=>{this.exceptionObserver=new Dp(this),this.exceptionObserver.startIfEnabledOrStop()})),n.push((()=>{this.deadClicksAutocapture=new Tl(this,s1),this.deadClicksAutocapture.startIfEnabled()})),n.push((()=>{if(this.os){var i=this.os;this.os=void 0,this.yi(i)}})),this.ls(n,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 n=e.shift();if(n)try{n()}catch(s){B.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&&B.info("PostHog extensions initialized ("+i+"ms)")}yi(e){var t,n,i,s,o,a,l,c,u;if(!D||!D.body)return B.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=le(e.supportedCompression,hr.GZipJS)?hr.GZipJS:le(e.supportedCompression,hr.Base64)?hr.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"}),(n=this.siteApps)==null||n.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(n){B.critical("`loaded` function failed",n)}if(this.us(),this.config.internal_or_test_user_hostname&&qe!=null&&qe.hostname){var e=qe.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 oh(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()&&jr(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&&(Lb?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ol(e.url,{ip:this.config.ip?1:0}),e.headers=V({},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 n,i,s,o=V({},t);o.timeout=o.timeout||6e4,o.url=Ol(o.url,{_:new Date().getTime().toString(),ver:ur.LIB_VERSION,compression:o.compression});var a=(n=o.transport)!==null&&n!==void 0?n:"fetch",l=ml.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(i=(s=tb(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)})(V({},e,{callback:t=>{var n,i;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((n=(i=this.config).on_request_error)==null||n.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,n=[],i=[],s=[];jr(e,(a=>{a&&(t=a[0],fe(t)?s.push(a):Vr(a)?a.call(this):fe(a)&&t==="alias"?n.push(a):fe(a)&&t.indexOf("capture")!==-1&&Vr(this[t])?s.push(a):i.push(a))}));var o=function(a,l){jr(a,(function(c){if(fe(c[0])){var u=l;xe(c,(function(p){u=u[p[0]].apply(u,p.slice(1))}))}else this[c[0]].apply(this,c.slice(1))}),l)};o(n,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,n){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zr){if(this.is_capturing())if(!H(e)&&Ne(e)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var o=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!Ne(t?.$current_url)&&(B.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=n?.timestamp||a,c=Br(),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),n?.$set&&(u.$set=n?.$set);var p,h=e!=="$groupidentify",f=this.vs(n?.$set_once,h);if(f&&(u.$set_once=f),(u=LC(u,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,H(n?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===oo.DISMISSED||e===oo.SENT){var v=t?.[np.SURVEY_ID],m=t?.[np.SURVEY_ITERATION];p={id:v,current_iteration:m},localStorage.getItem(E_(p))||localStorage.setItem(E_(p),"true"),u.$set=V({},u.$set,{[C1({id:v,current_iteration:m},e===oo.SENT?"responded":"dismissed")]:!0})}else e===oo.SHOWN&&(u.$set=V({},u.$set,{[np.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var g=V({},u.properties.$set,u.$set);if(_i(g)||this.setPersonPropertiesForFlags(g),!ue(this.config.before_send)){var y=this.cs(u);if(!y)return;u=y}this.qr.emit("eventCaptured",u);var x={method:"POST",url:(i=n?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:n?._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.ts(x):this.Zr.enqueue(x),u}B.critical("This capture call is ignored due to client rate limiting.")}}else B.error("No event name provided to posthog.capture")}else B.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,n,i,s){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var o=s?void 0:this.persistence.remove_event_timer(e),a=V({},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=V({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!Ne(a.distinct_id)&&!mr(a.distinct_id)||lp(a.distinct_id))&&B.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=p1(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:p,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,n.getTime());a.$session_id=p,a.$window_id=h}this.sessionPropsManager&&$e(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&$e(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.es)==null?void 0:f.length}catch(y){a.$sdk_debug_error_capturing_properties=String(y)}if(this.requestRouter.region===ao.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||s?e!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),a=$e(a,c),e==="$pageview"&&D&&(a.title=D.title),!H(o)){var v=n.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=$e({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),fe(this.config.property_denylist)?xe(this.config.property_denylist,(function(y){delete a[y]})):B.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(B.error("sanitize_properties is deprecated. Use before_send instead"),a=m(a,e));var g=this.fs();return a.$process_person_profile=g,g&&!s&&this.ps("_calculate_event_properties"),a}vs(e,t){var n;if(t===void 0&&(t=!0),!this.persistence||!this.fs()||this.Br)return e;var i=this.persistence.get_initial_props(),s=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),o=$e({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(B.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.Br=!0),_i(o)?void 0:o}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var i;(i=this.persistence)==null||i.register_once(e,t,n)}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,n){var i=n!=null&&n.merge?this.featureFlags.getFlagVariants():{},s=n!=null&&n.merge?this.featureFlags.getFlagPayloads():{},o=V({},i,e),a=V({},s,t),l={};for(var[c,u]of Object.entries(o)){var p=typeof u=="string";l[c]={key:c,enabled:!!p||!!u,variant:p?u:void 0,reason:void 0,metadata:H(a?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:a[c]}}}this.featureFlags.receivedFeatureFlags({flags:l})}updateEarlyAccessFeatureEnrollment(e,t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}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,n;return(t=(n=this.sessionManager)==null?void 0:n.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=R1),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,n){if(!this.__loaded||!this.persistence)return B.uninitializedWarning("posthog.identify");if(mr(e)&&(e=e.toString(),B.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()))B.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!==zs){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(to)&&(this.unregister(to),this.register({distinct_id:e}));var o=(this.persistence.get_property(dr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(dr,"identified"),this.setPersonPropertiesForFlags(V({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.Jr=__(e,t,n),this.featureFlags.setAnonymousDistinctId(i)):(t||n)&&this.setPersonProperties(t,n),e!==i&&(this.reloadFeatureFlags(),this.unregister(xl))}}else B.critical('The string "'+zs+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else B.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var n=__(this.get_distinct_id(),e,t);this.Jr!==n?(this.setPersonPropertiesForFlags(V({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=n):B.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,n){if(e&&t){var i=this.getGroups();i[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:V({},i,{[e]:t})}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),i[e]===t||n||this.reloadFeatureFlags()}else B.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,n,i,s;if(B.info("reset"),!this.__loaded)return B.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(dr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:zs,$device_id:null},"");else{var a=this.config.get_device_id(Br());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:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&n){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!n)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0)}return i}alias(e,t){return e===this.get_property(rb)?(B.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(H(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(to,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(B.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=V({},this.config);if(Pe(e)){var n,i,s,o,a,l,c;$e(this.config,T_(e));var u=this.Qr();(n=this.persistence)==null||n.update_config(this.config,t,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new co(V({},this.config,{persistence:"sessionStorage"}),u);var p=this.Kr(this.config.debug);gr(p)&&(this.config.debug=p),gr(this.config.debug)&&(this.config.debug?(ur.DEBUG=!0,Ae.H()&&Ae.G("ph_debug","true"),B.info("set_config",{config:e,oldConfig:t,newConfig:V({},this.config)})):(ur.DEBUG=!1,Ae.H()&&Ae.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,n={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(n).some(Boolean)){var i,s,o,a,l;(i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),n.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),n.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),n.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),n.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 n=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(V({},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:vi;return t!==vi&&(t=vi+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(dr))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(dr))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&_i(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[to])&&((t=this.persistence)==null||(t=t.props)==null||!t[kl]))}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"?(B.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(kl,!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,n,i,s=this.Qr();return((e=this.persistence)==null?void 0:e.ki)!==s&&((n=this.persistence)==null||n.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 n,i,s;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(n=this.sessionManager)==null||n.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new Ll(this),this.pageViewManager=new Il(this),this.persistence&&(this.sessionPropsManager=new Nl(this,this.sessionManager,this.persistence)),this.sessionRecording=new Fl(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(),(H(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 B.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,n;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:zs,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(n=this.sessionRecording)==null||n.stopRecording(),this.sessionRecording=void 0,this.hs())):B.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===pr.GRANTED?"granted":e===pr.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 dt?Nb(dt,this.config.custom_blocked_useragents):void 0}hs(){D&&(D.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:D.title},{send_instantly:!0}),this.Gr&&(D.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),Oe(D,"visibilitychange",this.Gr)))}debug(e){e===!1?(E?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(E?.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,n,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?(B.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):(n="advanced_disable_decide",i=!1,s=B,o=(t="advanced_disable_flags")in(e=l)&&!ue(e[t]),a=n in e&&!ue(e[n]),o?e[t]:a?(s&&s.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]):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],n=e;for(var i of t){if(n=i(n),ue(n)){var s="Event '"+e.event+"' was rejected in beforeSend function";return cC(e.event)?B.warn(s+". This can cause unexpected behavior."):B.info(s),null}n.properties&&!_i(n.properties)||B.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return n}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,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}Kr(e){var t=gr(e)&&!e,n=Ae.H()&&Ae.q("ph_debug")==="true";return!t&&(!!n||e)}};(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=NC(r.prototype[e[t]])})(Dl,["identify"]);var I_;var Fb=(I_=uo[vi]=new Dl,(function(){function r(){r.done||(r.done=!0,Lb=!1,xe(uo,(function(e){e._dom_loaded()})))}D!=null&&D.addEventListener?D.readyState==="complete"?r():Oe(D,"DOMContentLoaded",r,{capture:!1}):E&&B.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),I_);var Rh=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,n=`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=Fb.init(e.apiKey,o,n);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,p=typeof c=="string"?void 0:c?.properties;typeof u=="string"&&this.captureCallback?.(u,p)}),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 n=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){n=a;break}}if(!n){e>0&&setTimeout(()=>this.setupRRWebIntercept(e-1),500);return}let s=n.onRRwebEmit.bind(n);n.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[n,i]of Object.entries(e))n.startsWith("in_segment_")&&(t[n]=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,n){this.track("shadow_canvas_action",{action:e,rectangleId:t,surface:n})}register(e){this.client?.register?.(e)}getSessionId(){return this.client?.get_session_id?.()}startSessionRecording(){this.client?.startSessionRecording?.()}trackExperiment(e,t,n){let i=`$experiment_${e}`;this.register({[i]:n??`variation_${t}`,[`${i}_id`]:t}),this.track("$experiment_started",{$experiment_key:e,$experiment_variation_id:t,$experiment_variation_name:n??`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 Th(r={}){return new Rh(r)}var Db={posthog:r=>Th(r),noop:()=>Vd()};function Hb(r,e){let t=Db[r];if(!t)throw new Error(`Unknown telemetry provider: ${r}. Supported: ${Object.keys(Db).join(", ")}`);return t(e)}async function Bb(r){lu(),z("Syntro Bootstrap","====== INIT ======"),z("Syntro Bootstrap","Options:",{hasToken:!!r.token,tokenPrefix:`${r.token?.slice(0,15)}...`,hasCanvasOptions:!!r.canvas});let e=Pa();if(console.log(`[DIAG] Mode detection: sdkMode=${e}`),console.log("[DIAG] editorSource:",Ts()),console.log("[DIAG] editorConf:",Oa()),z("Syntro Bootstrap","SDK mode:",e??"normal"),!e&&typeof window<"u"){let C=!!window.__SYNTRO_EDITOR_PARAMS__,P=!!window.__SYNTRO_AUDIT_LEGEND__,G=!!window.__SYNTRO_REVIEW_DATA__;if(C||P||G){let pe=[C&&"__SYNTRO_EDITOR_PARAMS__",P&&"__SYNTRO_AUDIT_LEGEND__",G&&"__SYNTRO_REVIEW_DATA__"].filter(Boolean);console.warn(`[Syntro Bootstrap] \u26A0 Mode detection returned null but mode-specific globals found: ${pe.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=${r.token?r.token.slice(0,15)+"...":"null"}`);let t=r.token;if(!t&&e){let P=Oa()?.syntro_token;P?.startsWith("syn_")&&(t=P,z("Syntro Bootstrap",`\u2713 Using syntro_token from editor_conf (${e} mode)`))}let n;if(t)if(t.startsWith("syn_"))z("Syntro Bootstrap","Token starts with syn_, decoding..."),n=Is(t),lu(n.d);else if(e)z("Syntro Bootstrap",`\u2713 Non-syn_ token allowed (${e} mode)`);else throw xa("Syntro Bootstrap","\u274C Token does not start with syn_ and NOT in editor/audit/review mode!"),xa("Syntro Bootstrap","Token received:",t),new Error("Invalid Syntro token: must start with 'syn_'");else if(e)z("Syntro Bootstrap",`\u2713 No token, but ${e} mode - proceeding`);else throw xa("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=bt("NEXT_PUBLIC_SYNTRO_EXPERIMENT_HOST")||bt("VITE_SYNTRO_EXPERIMENT_HOST")||n?.eh,s=bt("NEXT_PUBLIC_SYNTRO_TELEMETRY_HOST")||bt("VITE_SYNTRO_TELEMETRY_HOST")||n?.th,o=bt("NEXT_PUBLIC_SYNTRO_EDITOR_URL")||bt("VITE_SYNTRO_EDITOR_URL")||r.canvas?.editorUrl,a=n?.g||bt("NEXT_PUBLIC_SYNTRO_GEO_HOST")||bt("VITE_SYNTRO_GEO_HOST")||Cv,l=kv(),c=Zu(),u=r.appSignalsInit??{},p={...c,...l,...u};z("Syntro Bootstrap","Phase 1: Browser metadata:",c),z("Syntro Bootstrap","Phase 1: Cached segment attributes:",l),Object.keys(u).length>0&&z("Syntro Bootstrap","Phase 1: App signals:",u);let h=Gu(a),f=(()=>{try{if(typeof window>"u"||window.self===window.top)return Promise.resolve(null)}catch{}return new Promise(C=>{let P=setTimeout(()=>{window.removeEventListener("message",G),C(null)},500);function G(pe){let ce=pe.data;ce?.jsonrpc==="2.0"&&ce?.id===1&&ce?.result?.hostInfo&&(clearTimeout(P),window.removeEventListener("message",G),C(ce.result.hostInfo))}window.addEventListener("message",G);try{window.parent.postMessage({jsonrpc:"2.0",id:1,method:"ui/initialize",params:{capabilities:{}}},"*")}catch{clearTimeout(P),window.removeEventListener("message",G),C(null)}})})(),v,m=r.debug||r.testMode,g=$s({debug:r.debug,history:m?new Ms(r.testMode?0:100):void 0,testMode:r.testMode});console.log("[Syntro Bootstrap] EventBus created");let y=nu({elementResolver:typeof window<"u"?(C,P)=>{let G=document.elementFromPoint(C,P);if(!G)return null;let pe={tag_name:G.tagName.toLowerCase()};G.id&&(pe.attr__id=G.id),G.className&&typeof G.className=="string"&&(pe.classes=G.className.split(" ").filter(Boolean));for(let ce of G.attributes)ce.name.startsWith("data-")&&(pe[`attr__${ce.name}`]=ce.value);return pe}:void 0});y.onEvent(C=>g.publishEvent(C)),typeof window<"u"&&(setInterval(()=>y.tick(Date.now()),1e3),document.addEventListener("click",C=>{let P=[],G=C.target;for(;G&&G!==document.body;){let pe={tag_name:G.tagName.toLowerCase()};for(let ce of G.attributes)(ce.name.startsWith("data-")||ce.name==="id"||ce.name==="class"||ce.name==="aria-label")&&(pe[`attr__${ce.name}`]=ce.value);P.push(pe),G=G.parentElement}y.enrichClickAttributes(Date.now(),P)},!0));let x=xy(),k,_=C=>{z("Syntro Bootstrap","Phase 2: PostHog feature flags loaded");let P=Ev(C);if(z("Syntro Bootstrap","Segment flags from PostHog:",P),Sv(P),v){let G=R?.getAll?.()??{},pe={...c,...G,...P,...u};z("Syntro Bootstrap","Updating GrowthBook with attributes:",pe),v.setAttributes?.(pe)}if(k&&w?.getDistinctId){let G=w.getDistinctId();G&&s&&n?.t&&k.updateContext({distinctId:G,telemetryHost:s,telemetryKey:n.t})}},w;if(n?.t){let C=n.t==="noop"?"noop":"posthog";w=Hb(C,{apiKey:n.t,apiHost:s,enableFeatureFlags:!0,sessionRecording:!0,onFeatureFlagsLoaded:_,onCapture:(G,pe)=>{y.ingest({kind:"posthog",event:G,properties:pe,timestamp:Date.now()})},onRRWebEvent:G=>{y.ingest(G)}}),console.log(`[Syntro Bootstrap] Telemetry client created (${C}) with EventBus wiring`),Object.keys(u).length>0&&(w.track?.("app_signals_init",u),z("Syntro Bootstrap","Tracked app signals event:",u));let P=w;if(g.setPosthogCapture((G,pe)=>{P.track?.(G,pe)}),x?.name==="shopify"&&s)try{k=new nl({distinctId:w.getDistinctId?.()??"",telemetryHost:s,telemetryKey:n.t}),z("Syntro Bootstrap","ShopifyPixelBridge initialized for checkout attribution")}catch(G){Je("Syntro Bootstrap","ShopifyPixelBridge init failed",G)}}let R;n?.e&&(v=gy("growthbook",{clientKey:n.e,apiHost:i,attributes:p,onExperimentViewed:w?.trackExperiment?(C,P,G)=>{w.trackExperiment(C,P,G)}:void 0})),R=_d({experiments:v,onMetricChange:(C,P)=>{z("Syntro Bootstrap",`Session metric changed: ${C} = ${P}`)}}),z("Syntro Bootstrap","SessionMetricTracker created");let b="production";e==="editor"?b="editor":e==="audit"?b="audit":bt("NODE_ENV")==="development"&&(b="development");let A=Hd({telemetry:w,sessionMetrics:R,mode:b,events:g});z("Syntro Bootstrap","Runtime created:",{version:A.version,mode:A.mode,hasContext:!!A.context,hasEvents:!!A.events,hasState:!!A.state}),z("Syntro Bootstrap","Core app executors already registered");let $=r.cdnBase||bt("NEXT_PUBLIC_SYNTRO_CDN_BASE")||bt("VITE_SYNTRO_CDN_BASE")||Av()||"https://cdn.syntrologie.com",N=wc({cdnBase:$,registry:A.apps,onLoadStart:C=>{z("Syntro Bootstrap",`Loading app from CDN: ${C}`)},onLoadEnd:(C,P,G)=>{P?z("Syntro Bootstrap",`App loaded successfully: ${C}`):Je("Syntro Bootstrap",`Failed to load app: ${C}`,G)}});typeof window<"u"&&(window.SynOS={...window.SynOS,appRegistry:A.apps,appLoader:N,runtime:A,version:A.version},z("Syntro Bootstrap","Global SynOS object exposed")),typeof window<"u"&&window.parent!==window&&N.loadApp("adaptive-mcp").catch(C=>{z("Syntro Bootstrap","auto-load of adaptive-mcp failed (non-fatal):",C)});let M=A.apps.list?.()??[];console.log(`[DIAG] Activation loop: ${M.length} apps in registry:`,M.map(C=>`${C.manifest.id}(${C.state})`).join(", "));for(let C of M)if(C.state==="registered")try{await A.apps.activate(C.manifest.id),console.log(`[DIAG] Activated: ${C.manifest.id} \u2192 widgets: [${A.widgets.list().join(", ")}]`)}catch(P){console.error(`[DIAG] FAILED to activate: ${C.manifest.id}`,P),Je("Syntro Bootstrap",`Failed to auto-activate built-in app: ${C.manifest.id}`,P)}if(console.log(`[DIAG] Activation complete. Total widgets: [${A.widgets.list().join(", ")}]`),v?.refreshFeatures)try{await v.refreshFeatures(),z("Syntro Bootstrap","GrowthBook features loaded")}catch(C){Je("Syntro Bootstrap","Failed to load GrowthBook features:",C)}let K=await h;if(v&&Object.keys(K).length>0){let C={...c,...K,...u};z("Syntro Bootstrap","Merging geo data into GrowthBook attributes:",K),v.setAttributes?.(C)}let L=await f;L&&v&&(c.surface_type="mcp-app",c.surface_host=L.name,v.setAttributes?.({...c,...K}),z("Syntro Bootstrap","MCP App detected:",L.name));let O;if(r.fetcher)O=r.fetcher;else if(n?.f){let C=_y(n.f,n.o??{});O=async()=>{let P=await C.fetch();return{...P.config,tiles:P.config.tiles??[]}}}else v&&(O=ti({experiments:v}));let q=new Set,Y=O?async()=>{let C=await O(),P=C.tiles?.length??0,G=C.actions?.length??0,pe=C.meta?.variant_id;if((P>0||G>0)&&(pe||console.warn("[Syntro] Config has content but no meta.variant_id \u2014 intervention tracking disabled")),w&&pe){let Ee=new Us(w,pe);Ee.trackServed(P,G),typeof window<"u"&&(window.SynOS.interventionTracker=Ee),A.navigation.subscribe(()=>{Ee.resetPage()})}console.log("[Syntro Bootstrap] Config fetched:",`tiles=${C.tiles?.length??0},`,`actions=${C.actions?.length??0},`,`theme=${C.theme?.name??"none"}`),C.actions?.length>0&&console.log("[Syntro Bootstrap] Actions in config:",C.actions.map((Ee,kt)=>`[${kt}] ${Ee.kind}${Ee.anchorId?` anchor="${Ee.anchorId.selector}"`:""}${Ee.label?` "${Ee.label}"`:""}`).join(", "));let ce=C,Be=N.getRequiredApps(ce);return Be.length>0?console.log("[Syntro Bootstrap] Required external apps:",Be.join(", ")):z("Syntro Bootstrap","No external apps required (all executors are built-in)"),Be.length>0&&await N.loadAppsForConfig(ce).then(async kt=>{let St=kt.filter(Me=>Me.success),jl=kt.filter(Me=>!Me.success);St.length>0&&console.log(`[Syntro Bootstrap] Apps loaded from CDN: ${St.map(Me=>Me.appId).join(", ")}`);let Ri=jl.filter(Me=>!q.has(Me.appId));Ri.length>0&&(console.error("[Syntro Bootstrap] Apps FAILED to load from CDN:",Ri.map(Me=>`${Me.appId} (${Me.error})`).join(", ")),Ri.forEach(Me=>q.add(Me.appId)));for(let Me of Be)if(A.apps.has(Me))try{await A.apps.activate(Me),console.log(`[Syntro Bootstrap] App activated: ${Me}`)}catch(Lt){console.error(`[Syntro Bootstrap] Failed to activate app: ${Me}`,Lt)}else console.error(`[Syntro Bootstrap] App "${Me}" required by config but NOT registered.`,`Available apps: [${Array.from(A.apps.list?.()??[]).join(", ")}]`)}),C}:void 0;if(x){z("Syntro Bootstrap",`Detected platform: ${x.name}`);try{await x.onInit(),z("Syntro Bootstrap",`Platform adapter initialized: ${x.name}`)}catch(C){Je("Syntro Bootstrap",`Platform adapter init failed: ${x.name}`,C)}}return{canvas:await Uu({...r.canvas,fetcher:Y,integrations:{experiments:v,telemetry:w},editorUrl:o,runtime:A}),runtime:A,experiments:v,telemetry:w,sessionMetrics:R,appLoader:N}}async function N1(r){try{return await Bb(r)}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 L1(r,e={}){if(typeof window>"u")return;let t=window.SynOS?.runtime;t?.events?.publish&&t.events.publish({name:r,source:"custom",props:e})}async function F1(r){if(typeof window>"u")return{appId:r,success:!1,error:"no-window"};let e=window.SynOS?.appLoader;return e?e.loadApp(r):{appId:r,success:!1,error:"syntro-not-initialized"}}var Vb={init:N1,loadAdaptive:F1,encodeToken:qu,decodeToken:Is,events:{emit:L1}};typeof window<"u"&&(window.Syntro=Vb);function xo(r){let e=r.split(".");return{major:parseInt(e[0]||"0",10),minor:parseInt(e[1]||"0",10)}}function TN(r){let e=[],t=[];if(!r||typeof r!="object")return{valid:!1,errors:["Config must be an object"],warnings:e};let n=r;if(n.tiles||t.push("Config missing required field: tiles"),n.actions||t.push("Config missing required field: actions"),n.fetchedAt||t.push("Config missing required field: fetchedAt"),t.length>0)return{valid:!1,errors:t,warnings:e};let i=n.schemaVersion||"1.0",s=xo(i),o=xo(Ar);return s.major>o.major&&e.push(`Config schema v${i} is newer than SDK v${Ar}. Some features may not work. Update SDK to latest version.`),s.major<o.major||!n.schemaVersion?(e.push(`Config schema v${i} is older than SDK v${Ar}. Migrating config to current version.`),{valid:!0,warnings:e,errors:t,migratedConfig:D1(n,i)}):{valid:!0,warnings:e,errors:t}}function D1(r,e){let t={...r};return xo(e).major===1&&(t=H1(t)),t.schemaVersion=Ar,t}function H1(r){let e={schemaVersion:"2.0",tiles:[],actions:r.actions||[],fetchedAt:r.fetchedAt||new Date().toISOString()};return r.tiles&&Array.isArray(r.tiles)&&(e.tiles=r.tiles.map(t=>{let n={...t};return t.experiment&&delete n.experiment,n})),r.configVersion&&(e.configVersion=r.configVersion),r.canvasTitle&&(e.canvasTitle=r.canvasTitle),r.theme&&(e.theme=r.theme),r.launcher&&(e.launcher=r.launcher),e}function IN(r){if(!r||typeof r!="object")return!1;let e=r,t=e.schemaVersion||"1.0",n=xo(t),i=xo(Ar);return n.major<i.major||!e.schemaVersion}var B1=d.object({url:d.string(),routeId:d.string().optional(),title:d.string().optional(),locale:d.string().optional()}),V1=d.object({url:d.string(),ts:d.number()}),j1=d.object({sessionId:d.string(),startTs:d.number(),pageHistory:d.array(V1).optional()}),W1=d.object({width:d.number(),height:d.number()}),U1=d.object({x:d.number(),y:d.number(),w:d.number(),h:d.number()}),z1=d.object({anchorId:d.string(),present:d.boolean(),visible:d.boolean().optional(),boundingBox:U1.optional()}),q1=d.record(d.string(),d.union([d.number(),d.string(),d.boolean(),d.undefined()])),Z1=d.object({page:B1,session:j1,viewport:W1,anchors:d.array(z1).optional(),augmented:q1.optional()});function ON(r){return Z1.safeParse(r)}var Ih=class{constructor(e,t,n,i){this._isFallback=!0;this._isLoading=!0;this._cancelled=!1;this._host=e,this._runtime=t,this._strategy=n,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 $h=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 Mh=class{constructor(e,t,n,i){this._host=e,this._runtime=t,this._filter=n,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 jb=d.enum(["posthog","canvas","derived"]),G1=d.object({ts:d.number(),name:d.string(),source:jb,props:d.record(d.string(),d.unknown()).optional(),schemaVersion:d.string()}),K1=d.object({names:d.array(d.string()).optional(),patterns:d.array(d.string()).optional(),sources:d.array(jb).optional()});function nL(r){return G1.safeParse(r)}function iL(r){return K1.safeParse(r)}var Wb=d.union([d.object({type:d.literal("data"),key:d.string(),value:d.string().optional()}),d.object({type:d.literal("css"),value:d.string()}),d.object({type:d.literal("aria"),role:d.string().optional(),label:d.string().optional()}),d.object({type:d.literal("shadow-css"),value:d.string()}),d.object({type:d.literal("ref"),el:d.any()})]),Y1=d.object({kind:d.literal("tooltip"),id:d.string(),anchor:Wb,content:d.object({title:d.string().optional(),body:d.string()}),placement:d.enum(["top","bottom","left","right","auto"]).optional(),offsetPx:d.number().optional(),blocking:d.boolean().optional(),trigger:d.enum(["immediate","hover","click"]).optional(),dismiss:d.object({onEsc:d.boolean().optional(),closeButton:d.boolean().optional(),timeoutMs:d.number().optional()}).optional()}),X1=d.object({kind:d.literal("highlight"),id:d.string(),anchor:Wb,copy:d.string().optional(),ring:d.object({paddingPx:d.number().optional(),radiusPx:d.number().optional()}).optional(),scrim:d.object({opacity:d.number().optional()}).optional(),ringColor:d.string().optional(),blocking:d.boolean().optional(),dismiss:d.object({onClickOutside:d.boolean().optional(),onEsc:d.boolean().optional(),timeoutMs:d.number().optional()}).optional()}),Oh=d.object({id:d.string(),version:d.number(),routes:d.array(d.string()).optional(),steps:d.array(d.union([Y1,X1]))});function _L(r){return Oh.parse(r)}var kL=({configUri:r,experiments:e,featureKey:t="smart-canvas-overlay-uri",credentials:n="include"}={})=>async()=>{let i=uu({configUri:r,experiments:e,featureKey:t});if(!i)throw new Error("SmartCanvas overlays: recipe URI missing (env + feature unset).");let s=await fetch(i,{credentials:n});if(!s.ok)throw new Error(`SmartCanvas overlays: failed to fetch recipe (${s.status})`);let o=await s.json();return Oh.parse(o)};var J1=d.object({value:d.unknown(),expiresAt:d.number().optional()}),Q1=d.object({count:d.number(),resetAt:d.number().optional()});function CL(r){return J1.safeParse(r)}function AL(r){return Q1.safeParse(r)}var Ub="2026-04-27T21:12:51.466Z (2ae6c4be4f5)";if(typeof window<"u"){console.log(`[Syntro Runtime] Build: ${Ub} (Lit)`);let r=window.SynOS,e=r?.appRegistry||Xi;window.SynOS={...r,appRegistry:e,_runtimeBuild:Ub,_renderer:"lit"},Sa(),lm(e)}export{Ws as ANIMATION_KEYFRAMES,$a as ActivationConfigZ,Xm as AddClassZ,_t as AnchorIdZ,z1 as AnchorStateZ,Vc as AnchorVisibleConditionZ,Yi as AppRegistry,q1 as AugmentationZ,Bm as BadgePositionZ,nv as BadgeZ,U1 as BoundingBoxZ,xs as CanvasEvents,Oh as CanvasRecipeZ,Cr as ConditionZ,il as ContextManager,Zc as CooldownActiveConditionZ,as as CounterDefZ,Bu as CtaButtonZ,su as DEFAULT_COOLDOWN,Ih as DecisionController,hs as DecisionStrategyZ,qc as DismissedConditionZ,Ie as EVENT_SCHEMA_VERSION,La as EventBus,Kc as EventCountConditionZ,K1 as EventFilterZ,Ms as EventHistory,jc as EventOccurredConditionZ,jb as EventSourceZ,Aa as ExecutorRegistry,ps as ExternalStrategyZ,Q1 as FrequencyEntryZ,Gc as FrequencyLimitConditionZ,X1 as HighlightStepZ,Hm as HighlightStyleZ,tv as HighlightZ,ev as InsertHtmlZ,Um as InsertPositionZ,Us as InterventionTracker,iu as MAX_VISIBLE_TOASTS,os as MatchOpZ,Wm as ModalContentZ,sv as ModalZ,ds as ModelStrategyZ,lv as MountWidgetZ,av as NavigateZ,Hs as NavigationMonitor,G1 as NormalizedEventZ,bs as NotificationsController,B1 as PageContextZ,V1 as PageHistoryEntryZ,Hc as PageUrlConditionZ,dv as ParallelZ,Vm as PlacementZ,rv as PulseZ,Ub as RUNTIME_SDK_BUILD,Ny as RUNTIME_VERSION,Jm as RemoveClassZ,Bc as RouteConditionZ,Dm as RouteFilterZ,cs as RuleStrategyZ,ls as RuleZ,Z1 as RuntimeContextZ,$h as RuntimeController,Mh as RuntimeEventsController,Ar as SDK_SCHEMA_VERSION,cu as SDK_VERSION,$y as STATIC_SLOT_STYLES,us as ScoreStrategyZ,Gm as ScrollBehaviorZ,Hu as ScrollLogicalPositionZ,ov as ScrollToZ,Wb as SelectorZ,uv as SequenceZ,j1 as SessionContextZ,zc as SessionMetricConditionZ,el as SessionMetricTracker,Ym as SetAttrZ,Qm as SetStyleZ,Km as SetTextZ,du as SmartCanvasController,ni as SmartCanvasElementLit,Ue as StandardEvents,Wc as StateEqualsConditionZ,al as StateStore,J1 as StoredValueZ,Vb as Syntro,ws as ThemeController,jm as TooltipContentZ,Y1 as TooltipStepZ,zm as TooltipTriggerZ,iv as TooltipZ,Zm as TourStepForSchemaZ,pv as TourZ,oa as TriggerWhenZ,Uc as ViewportConditionZ,W1 as ViewportContextZ,cv as WaitZ,qm as WidgetConfigZ,cl as WidgetRegistry,Td as applyStaticSlotStyles,PS as coreActionStepSchemas,Fu as createActionEngine,Vu as createAnchorResolver,ti as createCanvasConfigFetcher,wd as createContextManager,kd as createDecisionEngine,Sd as createEventAccumulator,$s as createEventBus,md as createGrowthBookClient,Vd as createNoopClient,kL as createOverlayRecipeFetcher,Th as createPostHogClient,pm as createPostHogNormalizer,_d as createSessionMetricTracker,Uu as createSmartCanvas,ym as createSmartCanvasController,Hd as createSmartCanvasRuntime,Rd as createStateStore,Pd as createSurfaceContainer,Ld as createSurfaces,IM as decisionSchemas,Is as decodeToken,qu as encodeToken,Cy as evaluate,ky as evaluateCondition,Sy as evaluateRule,sl as evaluateRuleStrategy,ol as evaluateScoreStrategy,Ay as evaluateSync,sr as executorRegistry,NS as getAntiFlickerSnippet,wS as getExecutor,ll as getSlotAnchorId,js as getSlotType,Nd as getSlotZIndex,xu as hasExecutor,IN as needsMigration,ys as normalizePostHogEvent,xo as parseVersion,Md as playEnterAnimation,Od as playExitAnimation,ri as registerConfigPredicates,Sa as registerSmartCanvasElement,uu as resolveConfigUri,vS as runtimeContext,Id as setupAdjacentPositioning,$d as setupInlinePositioning,_s as shouldNormalizeEvent,jt as validateAction,Ia as validateActions,TM as validateActivationConfig,AM as validateCondition,TN as validateConfig,iL as validateEventFilter,Yu as validateEventName,AL as validateFrequencyEntry,nL as validateNormalizedEvent,Xu as validateProps,_L as validateRecipe,ON as validateRuntimeContext,CL as validateStoredValue,RM as validateStrategy,Fd as widgetRegistry};
1011
1011
  /*! Bundled license information:
1012
1012
 
1013
1013
  @lit/reactive-element/css-tag.js: