{"version":3,"file":"store.js","mappings":";;;;AAAA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;;AAEA,6CAAe,MAAM,EAAC;;;ACjBtB;AACA;AACA;AACA;AACA,IAAI,wBAAQ;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,wBAAQ;;AAEvB;AACA;AACA;AACA;AACA;AACA,IAAI,wBAAQ;AACZ;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE;AACjE;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,gBAAgB,wBAAQ;AACxB;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA,IAAI;AACJ;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA,EAAE,wBAAQ;AACV,EAAE;;;AAGF;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA,EAAE;;;AAGF;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAE;;;AAGF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,EAAE;;;AAGF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,EAAE;;AAEF;;AAEA;AACA;AACA,8DAA8D;;AAE9D,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA,OAAO;AACP;AACA,IAAI;AACJ;AACA;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA;AACA,OAAO;AACP;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,IAAI;AACJ;AACA;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sDAAe,KAAK,EAAC;AAC0D;AAC/E;;;ACrgBA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACO;AACP;;AAEA;AACA;AACA,QAAQ,KAAqC,EAAE,EAE1C;AACL;AACA,IAAI;AACJ,QAAQ,KAAqC,EAAE,EAE1C;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ,KAAqC,EAAE,EAE1C;AACL;AACA;;AAEA;AACA;AACA;AACA,QAAQ,KAAqC,EAAE,EAE1C;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG,GAAG;;AAEN;AACA;AACA;AACO;AACP;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACO,SAAS,aAAQ;AACxB;AACA;AACA;;AAEA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;ACnSA;;AAE6C;AAC7C;;AAEA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,mBAAmB,aAAa,mBAAmB;AAChE;AACA,aAAa,mBAAmB,aAAa,mBAAmB;AAChE;AACA,aAAa,mBAAmB,WAAW,mBAAmB;AAC9D;AACA,aAAa,mBAAmB,YAAY,mBAAmB;AAC/D;AACA,aAAa,mBAAmB,WAAW,mBAAmB;AAC9D;AACA,aAAa,mBAAmB,YAAY,mBAAmB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,qBAAqB;AAC3C;AACA,wBAAwB,mBAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AC5M0C;AACJ;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,4BAAS,GAAG,YAAY;AACvB;AACP;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,WAAW,4BAAS;AACpB;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,WAAW,4BAAS;AACpB,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,iBAAiB,4BAAS;AAC1B;AACA,OAAO;AACP;AACA,eAAe,4BAAS;AACxB,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,4BAAS;AACb;AACA,EAAE;AACF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACO;AACP,gBAAgB,4BAAS;AACzB;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA,GAAG;AACH;AACO;AACP;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;;AAEA;AACA;AACA,SAAS,4BAAS;AAClB,UAAU,4BAAS;AACnB,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA,iDAAiD,SAAS;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ,4BAAS;AACjB,0BAA0B,4BAAS;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,MAAM,MAAqC,IAAI,CAIvC;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,8DAA8D,4BAAS;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,UAAU;AACV,UAAU,MAAqC,IAAI,CAIvC;AACZ;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,4BAA4B;AACjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AC5fiC;AACyM;AAC/L;AACsD;AACjG;AACA,oBAAoB,cAAc;AAC3B,MAAM,qBAAU;AACvB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,gBAAgB;AACtB,MAAM,SAAS;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,gBAAgB;AACxB,QAAQ,SAAS;AACjB;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,OAAO;AACP;AACA,QAAQ,SAAS;AACjB;AACA,sCAAsC;AACtC;AACA;AACA;;AAEA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,KAAK;AACL,oCAAoC;AACpC;AACA,MAAM,SAAS;AACf;AACA;AACA;AACA;AACA,uBAAuB;AACvB;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,kBAAkB;AACzC;AACA,+BAA+B,OAAO;AACtC;AACA;;AAEA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,kBAAkB;AACzC;AACA,kCAAkC,OAAO;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA,0CAA0C,OAAO;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,WAAW;AACf;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM,MAAqC,IAAI,CAEvC;AACR;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,yBAAyB,2BAA2B;AACpD;AACA,oDAAoD,iBAAiB;AACrE,YAAY,aAAa;AACzB;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,aAAa;AACb,YAAY;AACZ;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,yEAAyE,2BAA2B;AACpG;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,MAAqC,IAAI,CAGvC;AACR;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,MAAqC,IAAI,CAGvC;AACR;AACA;;AAEA;AACA;AACA,MAAM,MAAqC,IAAI,CAEvC;AACR;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,aAAa,yCAAyC;AACjF;AACA;AACA;AACA,gBAAgB,MAAqC,IAAI,CAGvC;AAClB;AACA;AACA;AACA,cAAc,MAAqC,IAAI,CAGvC;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,MAAqC,IAAI,CAGvC;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,MAAqC,IAAI,CAGvC;AACd;AACA;;AAEA;AACA;AACA,YAAY,MAAqC,IAAI,CAGvC;AACd;AACA;AACA,UAAU,MAAqC,IAAI,CAGvC;;AAEZ;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,UAAU,MAAqC,IAAI,CAGvC;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,MAAqC,IAAI,CAGvC;;AAEN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,cAAc,IAAI;AAClB;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,gBAAgB,IAAI;AACpB;AACA,sCAAsC,OAAO;AAC7C,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,MAAqC,IAAI,CAEvC;AACR;AACA;;AAEA;AACA;AACA,MAAM,MAAqC,IAAI,CAEvC;AACR;AACA;;AAEA;AACA;;AAEA;AACA,mCAAmC,aAAa;AAChD,MAAM,MAAqC,IAAI,CAEvC;AACR;AACA;;AAEA;AACA,uBAAuB,sBAAsB;AAC7C;AACA,MAAM,MAAqC,IAAI,CAGvC;AACR;AACA;;AAEA;AACA;AACA;AACA,MAAM,MAAqC,IAAI,CAGvC;AACR;AACA;;AAEA;AACA;AACA,MAAM,MAAqC,IAAI,CAEvC;AACR;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM,MAAqC,IAAI,CAEvC;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU,MAAqC,IAAI,CAEvC;AACZ;AACA;AACA,QAAQ,kCAAkC,WAAW;AACrD,QAAQ,MAAqC,IAAI,CAEvC;AACV;AACA;;AAEA;AACA,iCAAiC,UAAU;AAC3C,QAAQ,MAAqC,IAAI,CAEvC;AACV;AACA;;AAEA;AACA;AACA,QAAQ,MAAqC,IAAI,CAEvC;AACV;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa,yCAAyC;AACrE,YAAY,MAAqC,IAAI,CAEvC;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA,QAAQ,MAAqC,IAAI,CAEvC;AACV;AACA;AACA;;AAEA;AACA;AACA,MAAM,MAAqC,IAAI,CAEvC;AACR;AACA;;AAEA;AACA,cAAc,IAAI;AAClB;AACA,MAAM,MAAqC,IAAI,CAEvC;AACR;AACA;AACA;AACA,0CAA0C,eAAe;AACzD,iBAAiB,eAAe;AAChC;;AAEA;AACA;AACA,MAAM,MAAqC,IAAI,CAEvC;AACR;AACA;;AAEA;AACA;AACA,MAAM,MAAqC,IAAI,CAEvC;AACR;AACA;;AAEA;AACA;AACA,MAAM,MAAqC,IAAI,CAGvC;AACR;AACA;;AAEA;AACA;AACA,MAAM,MAAqC,IAAI,CAEvC;AACR;AACA;;AAEA;AACA;AACA,MAAM,MAAqC,IAAI,CAEvC;AACR;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,yDAAyD,aAAQ;AACzE;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,IAAI,MAAqC,IAAI,CAGvC;AACN;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,yBAAyB,YAAY;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,sBAAsB;AAC1C;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,uBAAuB,uBAAuB;AAC7F;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAM;AACxB,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,0DAA0D,aAAQ;AAClE;AACA;AACA;AACA,MAAM;AACN,kFAAkF,aAAQ;AAC1F;AACA;AACA,oGAAoG;AACpG;AACA;AACA,gGAAgG;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,0BAA0B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR,yBAAyB,aAAQ;AACjC,KAAK;AACL;AACA;AACA;AACA;AACA,gLAAgL;AAChL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;ACj7C8B;AACsB;;AAEpD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA,gEAAgE;AAChE,GAAG;;AAEH;AACA,sBAAsB,KAAK;AAC3B,4CAA4C;;AAE5C;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA,GAAG;;AAEH;AACA;;AAEA,2BAA2B,qBAAU;AACrC;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAqB,MAAM;AAC3B,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAQ;;AAER;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA,GAAG;AACH;;AAEA,iDAAe,MAAM,EAAC;;;;AC/HtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAI,eAAe;AAC1B;AACA;AACA;AACA;;AAEA,kDAAe,WAAW;;;ACtEmB;AAC7C;AAC+C;AACN;;AAEzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,EAAE;AAC/B;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,aAAa;AACb,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN,4CAA4C,QAAQ;AACpD;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA,OAAO;AACP,MAAM;AACN;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,eAAe;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA,eAAe;AACf,WAAW;AACX;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sCAAsC,QAAQ;AAC9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW;AACX;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,eAAe;AACf,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,eAAe;AACf,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,eAAe;AACf,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,WAAW;AACX,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA,KAAK;AACL,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO;;AAEP;AACA,KAAK;AACL,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX;AACA;AACA;AACA;AACA,eAAe;AACf;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,eAAe;AACf,aAAa;AACb,mCAAmC;;AAEnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,WAAW;AACX;AACA,QAAQ;AACR;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,WAAW;AACX;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,qBAAqB,uBAAuB;AAC5C,OAAO;AACP;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,OAAO;;AAEP;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,OAAO;;AAEP;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS;AACT,OAAO;;AAEP;AACA;AACA,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,kBAAkB;AACxE;AACA;AACA,uBAAuB,kBAAkB;AACzC,SAAS;;AAET;AACA;AACA,sDAAsD,kBAAkB;AACxE;AACA;AACA,uBAAuB,kBAAkB;AACzC,SAAS;;AAET;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX,SAAS;AACT,OAAO;;AAEP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb,WAAW;AACX,SAAS;AACT,OAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,uBAAuB;AACzD;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA,OAAO;AACP,KAAK;;AAEL,GAAG;AACH;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,GAAG;AACH;AACA,YAAY,kBAAkB;;AAE9B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA,KAAK;AACL,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,aAAa;AACb;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,eAAe;AACf,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2FAA2F,qBAAqB,SAAS,OAAO;;AAEhI;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP,iCAAiC,mDAAmD;AACpF,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP,MAAM;AACN;AACA;AACA,GAAG;;AAEH;AACA;AACA,IAAI,UAAM;AACV,IAAI,MAAM;AACV;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL,GAAG;AACH;;AAEA;AACA;AACA;AACA,EAAE,WAAW;;AAEb;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,mBAAmB,iBAAiB,oCAAoC,kBAAkB;AAC1F","sources":["webpack://build/../vincishoes2/assets/javascripts/components/loader.js","webpack://build/../vincishoes2/node_modules/dom-mutator/dist/dom-mutator.esm.js","webpack://build/../vincishoes2/node_modules/@growthbook/growthbook/dist/esm/util.js","webpack://build/../vincishoes2/node_modules/@growthbook/growthbook/dist/esm/mongrule.js","webpack://build/../vincishoes2/node_modules/@growthbook/growthbook/dist/esm/feature-repository.js","webpack://build/../vincishoes2/node_modules/@growthbook/growthbook/dist/esm/GrowthBook.js","webpack://build/../vincishoes2/assets/javascripts/components/growthbook.js","webpack://build/../vincishoes2/assets/javascripts/common/lazyLoading.js","webpack://build/../vincishoes2/assets/javascripts/store.js"],"sourcesContent":["// LOADER \nconst Loader = {\n loader: document.querySelector('#loader'),\n\n init: function () {\n\n if (this.loader != null) {\n setTimeout(() => {\n this.loader.classList.add('-hidden');\n }, 3000);\n setTimeout(() => {\n this.loader.remove();\n }, 3500);\n }\n },\n}\n\nexport default Loader;\n","var validAttributeName = /^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/;\nvar nullController = {\n revert: function revert() {}\n};\nvar elements = /*#__PURE__*/new Map();\nvar mutations = /*#__PURE__*/new Set();\n\nfunction getObserverInit(attr) {\n return attr === 'html' ? {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true\n } : {\n childList: false,\n subtree: false,\n attributes: true,\n attributeFilter: [attr]\n };\n}\n\nfunction getElementRecord(element) {\n var record = elements.get(element);\n\n if (!record) {\n record = {\n element: element,\n attributes: {}\n };\n elements.set(element, record);\n }\n\n return record;\n}\n\nfunction createElementPropertyRecord(el, attr, getCurrentValue, setValue, mutationRunner) {\n var currentValue = getCurrentValue(el);\n var record = {\n isDirty: false,\n originalValue: currentValue,\n virtualValue: currentValue,\n mutations: [],\n el: el,\n _positionTimeout: null,\n observer: new MutationObserver(function () {\n // enact a 1 second timeout that blocks subsequent firing of the\n // observer until the timeout is complete. This will prevent multiple\n // mutations from firing in quick succession, which can cause the\n // mutation to be reverted before the DOM has a chance to update.\n if (attr === 'position' && record._positionTimeout) return;else if (attr === 'position') record._positionTimeout = setTimeout(function () {\n record._positionTimeout = null;\n }, 1000);\n var currentValue = getCurrentValue(el);\n if (attr === 'position' && currentValue.parentNode === record.virtualValue.parentNode && currentValue.insertBeforeNode === record.virtualValue.insertBeforeNode) return;\n if (currentValue === record.virtualValue) return;\n record.originalValue = currentValue;\n mutationRunner(record);\n }),\n mutationRunner: mutationRunner,\n setValue: setValue,\n getCurrentValue: getCurrentValue\n };\n\n if (attr === 'position' && el.parentNode) {\n record.observer.observe(el.parentNode, {\n childList: true,\n subtree: true,\n attributes: false,\n characterData: false\n });\n } else {\n record.observer.observe(el, getObserverInit(attr));\n }\n\n return record;\n}\n\nfunction queueIfNeeded(val, record) {\n var currentVal = record.getCurrentValue(record.el);\n record.virtualValue = val;\n\n if (val && typeof val !== 'string') {\n if (!currentVal || val.parentNode !== currentVal.parentNode || val.insertBeforeNode !== currentVal.insertBeforeNode) {\n record.isDirty = true;\n runDOMUpdates();\n }\n } else if (val !== currentVal) {\n record.isDirty = true;\n runDOMUpdates();\n }\n}\n\nfunction htmlMutationRunner(record) {\n var val = record.originalValue;\n record.mutations.forEach(function (m) {\n return val = m.mutate(val);\n });\n queueIfNeeded(getTransformedHTML(val), record);\n}\n\nfunction classMutationRunner(record) {\n var val = new Set(record.originalValue.split(/\\s+/).filter(Boolean));\n record.mutations.forEach(function (m) {\n return m.mutate(val);\n });\n queueIfNeeded(Array.from(val).filter(Boolean).join(' '), record);\n}\n\nfunction attrMutationRunner(record) {\n var val = record.originalValue;\n record.mutations.forEach(function (m) {\n return val = m.mutate(val);\n });\n queueIfNeeded(val, record);\n}\n\nfunction _loadDOMNodes(_ref) {\n var parentSelector = _ref.parentSelector,\n insertBeforeSelector = _ref.insertBeforeSelector;\n var parentNode = document.querySelector(parentSelector);\n if (!parentNode) return null;\n var insertBeforeNode = insertBeforeSelector ? document.querySelector(insertBeforeSelector) : null;\n if (insertBeforeSelector && !insertBeforeNode) return null;\n return {\n parentNode: parentNode,\n insertBeforeNode: insertBeforeNode\n };\n}\n\nfunction positionMutationRunner(record) {\n var val = record.originalValue;\n record.mutations.forEach(function (m) {\n var selectors = m.mutate();\n\n var newNodes = _loadDOMNodes(selectors);\n\n val = newNodes || val;\n });\n queueIfNeeded(val, record);\n}\n\nvar getHTMLValue = function getHTMLValue(el) {\n return el.innerHTML;\n};\n\nvar setHTMLValue = function setHTMLValue(el, value) {\n return el.innerHTML = value;\n};\n\nfunction getElementHTMLRecord(element) {\n var elementRecord = getElementRecord(element);\n\n if (!elementRecord.html) {\n elementRecord.html = createElementPropertyRecord(element, 'html', getHTMLValue, setHTMLValue, htmlMutationRunner);\n }\n\n return elementRecord.html;\n}\n\nvar getElementPosition = function getElementPosition(el) {\n return {\n parentNode: el.parentElement,\n insertBeforeNode: el.nextElementSibling\n };\n};\n\nvar setElementPosition = function setElementPosition(el, value) {\n if (value.insertBeforeNode && !value.parentNode.contains(value.insertBeforeNode)) {\n // skip position mutation - insertBeforeNode not a child of parent. happens\n // when mutation observer for indvidual element fires out of order\n return;\n }\n\n value.parentNode.insertBefore(el, value.insertBeforeNode);\n};\n\nfunction getElementPositionRecord(element) {\n var elementRecord = getElementRecord(element);\n\n if (!elementRecord.position) {\n elementRecord.position = createElementPropertyRecord(element, 'position', getElementPosition, setElementPosition, positionMutationRunner);\n }\n\n return elementRecord.position;\n}\n\nvar setClassValue = function setClassValue(el, val) {\n return val ? el.className = val : el.removeAttribute('class');\n};\n\nvar getClassValue = function getClassValue(el) {\n return el.className;\n};\n\nfunction getElementClassRecord(el) {\n var elementRecord = getElementRecord(el);\n\n if (!elementRecord.classes) {\n elementRecord.classes = createElementPropertyRecord(el, 'class', getClassValue, setClassValue, classMutationRunner);\n }\n\n return elementRecord.classes;\n}\n\nvar getAttrValue = function getAttrValue(attrName) {\n return function (el) {\n var _el$getAttribute;\n\n return (_el$getAttribute = el.getAttribute(attrName)) != null ? _el$getAttribute : null;\n };\n};\n\nvar setAttrValue = function setAttrValue(attrName) {\n return function (el, val) {\n return val !== null ? el.setAttribute(attrName, val) : el.removeAttribute(attrName);\n };\n};\n\nfunction getElementAttributeRecord(el, attr) {\n var elementRecord = getElementRecord(el);\n\n if (!elementRecord.attributes[attr]) {\n elementRecord.attributes[attr] = createElementPropertyRecord(el, attr, getAttrValue(attr), setAttrValue(attr), attrMutationRunner);\n }\n\n return elementRecord.attributes[attr];\n}\n\nfunction deleteElementPropertyRecord(el, attr) {\n var element = elements.get(el);\n if (!element) return;\n\n if (attr === 'html') {\n var _element$html, _element$html$observe;\n\n (_element$html = element.html) == null ? void 0 : (_element$html$observe = _element$html.observer) == null ? void 0 : _element$html$observe.disconnect();\n delete element.html;\n } else if (attr === 'class') {\n var _element$classes, _element$classes$obse;\n\n (_element$classes = element.classes) == null ? void 0 : (_element$classes$obse = _element$classes.observer) == null ? void 0 : _element$classes$obse.disconnect();\n delete element.classes;\n } else if (attr === 'position') {\n var _element$position, _element$position$obs;\n\n (_element$position = element.position) == null ? void 0 : (_element$position$obs = _element$position.observer) == null ? void 0 : _element$position$obs.disconnect();\n delete element.position;\n } else {\n var _element$attributes, _element$attributes$a, _element$attributes$a2;\n\n (_element$attributes = element.attributes) == null ? void 0 : (_element$attributes$a = _element$attributes[attr]) == null ? void 0 : (_element$attributes$a2 = _element$attributes$a.observer) == null ? void 0 : _element$attributes$a2.disconnect();\n delete element.attributes[attr];\n }\n}\n\nvar transformContainer;\n\nfunction getTransformedHTML(html) {\n if (!transformContainer) {\n transformContainer = document.createElement('div');\n }\n\n transformContainer.innerHTML = html;\n return transformContainer.innerHTML;\n}\n\nfunction setPropertyValue(el, attr, m) {\n if (!m.isDirty) return;\n m.isDirty = false;\n var val = m.virtualValue;\n\n if (!m.mutations.length) {\n deleteElementPropertyRecord(el, attr);\n }\n\n m.setValue(el, val);\n}\n\nfunction setValue(m, el) {\n m.html && setPropertyValue(el, 'html', m.html);\n m.classes && setPropertyValue(el, 'class', m.classes);\n m.position && setPropertyValue(el, 'position', m.position);\n Object.keys(m.attributes).forEach(function (attr) {\n setPropertyValue(el, attr, m.attributes[attr]);\n });\n}\n\nfunction runDOMUpdates() {\n elements.forEach(setValue);\n} // find or create ElementPropertyRecord, add mutation to it, then run\n\n\nfunction startMutating(mutation, element) {\n var record = null;\n\n if (mutation.kind === 'html') {\n record = getElementHTMLRecord(element);\n } else if (mutation.kind === 'class') {\n record = getElementClassRecord(element);\n } else if (mutation.kind === 'attribute') {\n record = getElementAttributeRecord(element, mutation.attribute);\n } else if (mutation.kind === 'position') {\n record = getElementPositionRecord(element);\n }\n\n if (!record) return;\n record.mutations.push(mutation);\n record.mutationRunner(record);\n} // get (existing) ElementPropertyRecord, remove mutation from it, then run\n\n\nfunction stopMutating(mutation, el) {\n var record = null;\n\n if (mutation.kind === 'html') {\n record = getElementHTMLRecord(el);\n } else if (mutation.kind === 'class') {\n record = getElementClassRecord(el);\n } else if (mutation.kind === 'attribute') {\n record = getElementAttributeRecord(el, mutation.attribute);\n } else if (mutation.kind === 'position') {\n record = getElementPositionRecord(el);\n }\n\n if (!record) return;\n var index = record.mutations.indexOf(mutation);\n if (index !== -1) record.mutations.splice(index, 1);\n record.mutationRunner(record);\n} // maintain list of elements associated with mutation\n\n\nfunction refreshElementsSet(mutation) {\n // if a position mutation has already found an element to move, don't move\n // any more elements\n if (mutation.kind === 'position' && mutation.elements.size === 1) return;\n var existingElements = new Set(mutation.elements);\n var matchingElements = document.querySelectorAll(mutation.selector);\n matchingElements.forEach(function (el) {\n if (!existingElements.has(el)) {\n mutation.elements.add(el);\n startMutating(mutation, el);\n }\n });\n}\n\nfunction revertMutation(mutation) {\n mutation.elements.forEach(function (el) {\n return stopMutating(mutation, el);\n });\n mutation.elements.clear();\n mutations[\"delete\"](mutation);\n}\n\nfunction refreshAllElementSets() {\n mutations.forEach(refreshElementsSet);\n} // Observer for elements that don't exist in the DOM yet\n\n\nvar observer;\nfunction disconnectGlobalObserver() {\n observer && observer.disconnect();\n}\nfunction connectGlobalObserver() {\n if (typeof document === 'undefined') return;\n\n if (!observer) {\n observer = new MutationObserver(function () {\n refreshAllElementSets();\n });\n }\n\n refreshAllElementSets();\n observer.observe(document.documentElement, {\n childList: true,\n subtree: true,\n attributes: false,\n characterData: false\n });\n} // run on init\n\nconnectGlobalObserver();\n\nfunction newMutation(m) {\n // Not in a browser\n if (typeof document === 'undefined') return nullController; // add to global index of mutations\n\n mutations.add(m); // run refresh on init to establish list of elements associated w/ mutation\n\n refreshElementsSet(m);\n return {\n revert: function revert() {\n revertMutation(m);\n }\n };\n}\n\nfunction html(selector, mutate) {\n return newMutation({\n kind: 'html',\n elements: new Set(),\n mutate: mutate,\n selector: selector\n });\n}\n\nfunction position(selector, mutate) {\n return newMutation({\n kind: 'position',\n elements: new Set(),\n mutate: mutate,\n selector: selector\n });\n}\n\nfunction classes(selector, mutate) {\n return newMutation({\n kind: 'class',\n elements: new Set(),\n mutate: mutate,\n selector: selector\n });\n}\n\nfunction attribute(selector, attribute, mutate) {\n if (!validAttributeName.test(attribute)) return nullController;\n\n if (attribute === 'class' || attribute === 'className') {\n return classes(selector, function (classnames) {\n var mutatedClassnames = mutate(Array.from(classnames).join(' '));\n classnames.clear();\n if (!mutatedClassnames) return;\n mutatedClassnames.split(/\\s+/g).filter(Boolean).forEach(function (c) {\n return classnames.add(c);\n });\n });\n }\n\n return newMutation({\n kind: 'attribute',\n attribute: attribute,\n elements: new Set(),\n mutate: mutate,\n selector: selector\n });\n}\n\nfunction declarative(_ref2) {\n var selector = _ref2.selector,\n action = _ref2.action,\n value = _ref2.value,\n attr = _ref2.attribute,\n parentSelector = _ref2.parentSelector,\n insertBeforeSelector = _ref2.insertBeforeSelector;\n\n if (attr === 'html') {\n if (action === 'append') {\n return html(selector, function (val) {\n return val + (value != null ? value : '');\n });\n } else if (action === 'set') {\n return html(selector, function () {\n return value != null ? value : '';\n });\n }\n } else if (attr === 'class') {\n if (action === 'append') {\n return classes(selector, function (val) {\n if (value) val.add(value);\n });\n } else if (action === 'remove') {\n return classes(selector, function (val) {\n if (value) val[\"delete\"](value);\n });\n } else if (action === 'set') {\n return classes(selector, function (val) {\n val.clear();\n if (value) val.add(value);\n });\n }\n } else if (attr === 'position') {\n if (action === 'set' && parentSelector) {\n return position(selector, function () {\n return {\n insertBeforeSelector: insertBeforeSelector,\n parentSelector: parentSelector\n };\n });\n }\n } else {\n if (action === 'append') {\n return attribute(selector, attr, function (val) {\n return val !== null ? val + (value != null ? value : '') : value != null ? value : '';\n });\n } else if (action === 'set') {\n return attribute(selector, attr, function () {\n return value != null ? value : '';\n });\n } else if (action === 'remove') {\n return attribute(selector, attr, function () {\n return null;\n });\n }\n }\n\n return nullController;\n}\n\nvar index = {\n html: html,\n classes: classes,\n attribute: attribute,\n position: position,\n declarative: declarative\n};\n\nexport default index;\nexport { connectGlobalObserver, disconnectGlobalObserver, validAttributeName };\n//# sourceMappingURL=dom-mutator.esm.js.map\n","const polyfills = {\n fetch: globalThis.fetch ? globalThis.fetch.bind(globalThis) : undefined,\n SubtleCrypto: globalThis.crypto ? globalThis.crypto.subtle : undefined,\n EventSource: globalThis.EventSource\n};\nexport function getPolyfills() {\n return polyfills;\n}\nfunction hashFnv32a(str) {\n let hval = 0x811c9dc5;\n const l = str.length;\n for (let i = 0; i < l; i++) {\n hval ^= str.charCodeAt(i);\n hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24);\n }\n return hval >>> 0;\n}\nexport function hash(seed, value, version) {\n // New unbiased hashing algorithm\n if (version === 2) {\n return hashFnv32a(hashFnv32a(seed + value) + \"\") % 10000 / 10000;\n }\n // Original biased hashing algorithm (keep for backwards compatibility)\n if (version === 1) {\n return hashFnv32a(value + seed) % 1000 / 1000;\n }\n\n // Unknown hash version\n return null;\n}\nexport function getEqualWeights(n) {\n if (n <= 0) return [];\n return new Array(n).fill(1 / n);\n}\nexport function inRange(n, range) {\n return n >= range[0] && n < range[1];\n}\nexport function inNamespace(hashValue, namespace) {\n const n = hash(\"__\" + namespace[0], hashValue, 1);\n if (n === null) return false;\n return n >= namespace[1] && n < namespace[2];\n}\nexport function chooseVariation(n, ranges) {\n for (let i = 0; i < ranges.length; i++) {\n if (inRange(n, ranges[i])) {\n return i;\n }\n }\n return -1;\n}\nexport function getUrlRegExp(regexString) {\n try {\n const escaped = regexString.replace(/([^\\\\])\\//g, \"$1\\\\/\");\n return new RegExp(escaped);\n } catch (e) {\n console.error(e);\n return undefined;\n }\n}\nexport function isURLTargeted(url, targets) {\n if (!targets.length) return false;\n let hasIncludeRules = false;\n let isIncluded = false;\n for (let i = 0; i < targets.length; i++) {\n const match = _evalURLTarget(url, targets[i].type, targets[i].pattern);\n if (targets[i].include === false) {\n if (match) return false;\n } else {\n hasIncludeRules = true;\n if (match) isIncluded = true;\n }\n }\n return isIncluded || !hasIncludeRules;\n}\nfunction _evalSimpleUrlPart(actual, pattern, isPath) {\n try {\n // Escape special regex characters and change wildcard `_____` to `.*`\n let escaped = pattern.replace(/[*.+?^${}()|[\\]\\\\]/g, \"\\\\$&\").replace(/_____/g, \".*\");\n if (isPath) {\n // When matching pathname, make leading/trailing slashes optional\n escaped = \"\\\\/?\" + escaped.replace(/(^\\/|\\/$)/g, \"\") + \"\\\\/?\";\n }\n const regex = new RegExp(\"^\" + escaped + \"$\", \"i\");\n return regex.test(actual);\n } catch (e) {\n return false;\n }\n}\nfunction _evalSimpleUrlTarget(actual, pattern) {\n try {\n // If a protocol is missing, but a host is specified, add `https://` to the front\n // Use \"_____\" as the wildcard since `*` is not a valid hostname in some browsers\n const expected = new URL(pattern.replace(/^([^:/?]*)\\./i, \"https://$1.\").replace(/\\*/g, \"_____\"), \"https://_____\");\n\n // Compare each part of the URL separately\n const comps = [[actual.host, expected.host, false], [actual.pathname, expected.pathname, true]];\n // We only want to compare hashes if it's explicitly being targeted\n if (expected.hash) {\n comps.push([actual.hash, expected.hash, false]);\n }\n expected.searchParams.forEach((v, k) => {\n comps.push([actual.searchParams.get(k) || \"\", v, false]);\n });\n\n // If any comparisons fail, the whole thing fails\n return !comps.some(data => !_evalSimpleUrlPart(data[0], data[1], data[2]));\n } catch (e) {\n return false;\n }\n}\nfunction _evalURLTarget(url, type, pattern) {\n try {\n const parsed = new URL(url, \"https://_\");\n if (type === \"regex\") {\n const regex = getUrlRegExp(pattern);\n if (!regex) return false;\n return regex.test(parsed.href) || regex.test(parsed.href.substring(parsed.origin.length));\n } else if (type === \"simple\") {\n return _evalSimpleUrlTarget(parsed, pattern);\n }\n return false;\n } catch (e) {\n return false;\n }\n}\nexport function getBucketRanges(numVariations, coverage, weights) {\n coverage = coverage === undefined ? 1 : coverage;\n\n // Make sure coverage is within bounds\n if (coverage < 0) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Experiment.coverage must be greater than or equal to 0\");\n }\n coverage = 0;\n } else if (coverage > 1) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Experiment.coverage must be less than or equal to 1\");\n }\n coverage = 1;\n }\n\n // Default to equal weights if missing or invalid\n const equal = getEqualWeights(numVariations);\n weights = weights || equal;\n if (weights.length !== numVariations) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Experiment.weights array must be the same length as Experiment.variations\");\n }\n weights = equal;\n }\n\n // If weights don't add up to 1 (or close to it), default to equal weights\n const totalWeight = weights.reduce((w, sum) => sum + w, 0);\n if (totalWeight < 0.99 || totalWeight > 1.01) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Experiment.weights must add up to 1\");\n }\n weights = equal;\n }\n\n // Covert weights to ranges\n let cumulative = 0;\n return weights.map(w => {\n const start = cumulative;\n cumulative += w;\n return [start, start + coverage * w];\n });\n}\nexport function getQueryStringOverride(id, url, numVariations) {\n if (!url) {\n return null;\n }\n const search = url.split(\"?\")[1];\n if (!search) {\n return null;\n }\n const match = search.replace(/#.*/, \"\") // Get rid of anchor\n .split(\"&\") // Split into key/value pairs\n .map(kv => kv.split(\"=\", 2)).filter(_ref => {\n let [k] = _ref;\n return k === id;\n }) // Look for key that matches the experiment id\n .map(_ref2 => {\n let [, v] = _ref2;\n return parseInt(v);\n }); // Parse the value into an integer\n\n if (match.length > 0 && match[0] >= 0 && match[0] < numVariations) return match[0];\n return null;\n}\nexport function isIncluded(include) {\n try {\n return include();\n } catch (e) {\n console.error(e);\n return false;\n }\n}\nconst base64ToBuf = b => Uint8Array.from(atob(b), c => c.charCodeAt(0));\nexport async function decrypt(encryptedString, decryptionKey, subtle) {\n decryptionKey = decryptionKey || \"\";\n subtle = subtle || globalThis.crypto && globalThis.crypto.subtle || polyfills.SubtleCrypto;\n if (!subtle) {\n throw new Error(\"No SubtleCrypto implementation found\");\n }\n try {\n const key = await subtle.importKey(\"raw\", base64ToBuf(decryptionKey), {\n name: \"AES-CBC\",\n length: 128\n }, true, [\"encrypt\", \"decrypt\"]);\n const [iv, cipherText] = encryptedString.split(\".\");\n const plainTextBuffer = await subtle.decrypt({\n name: \"AES-CBC\",\n iv: base64ToBuf(iv)\n }, key, base64ToBuf(cipherText));\n return new TextDecoder().decode(plainTextBuffer);\n } catch (e) {\n throw new Error(\"Failed to decrypt\");\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function toString(input) {\n if (typeof input === \"string\") return input;\n return JSON.stringify(input);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function paddedVersionString(input) {\n if (typeof input === \"number\") {\n input = input + \"\";\n }\n if (!input || typeof input !== \"string\") {\n input = \"0\";\n }\n // Remove build info and leading `v` if any\n // Split version into parts (both core version numbers and pre-release tags)\n // \"v1.2.3-rc.1+build123\" -> [\"1\",\"2\",\"3\",\"rc\",\"1\"]\n const parts = input.replace(/(^v|\\+.*$)/g, \"\").split(/[-.]/);\n\n // If it's SemVer without a pre-release, add `~` to the end\n // [\"1\",\"0\",\"0\"] -> [\"1\",\"0\",\"0\",\"~\"]\n // \"~\" is the largest ASCII character, so this will make \"1.0.0\" greater than \"1.0.0-beta\" for example\n if (parts.length === 3) {\n parts.push(\"~\");\n }\n\n // Left pad each numeric part with spaces so string comparisons will work (\"9\">\"10\", but \" 9\"<\"10\")\n // Then, join back together into a single string\n return parts.map(v => v.match(/^[0-9]+$/) ? v.padStart(5, \" \") : v).join(\"-\");\n}\nexport function loadSDKVersion() {\n let version;\n try {\n // @ts-expect-error right-hand value to be replaced by build with string literal\n version = \"1.0.0\";\n } catch (e) {\n version = \"\";\n }\n return version;\n}\nexport function mergeQueryStrings(oldUrl, newUrl) {\n let currUrl;\n let redirectUrl;\n try {\n currUrl = new URL(oldUrl);\n redirectUrl = new URL(newUrl);\n } catch (e) {\n console.error(\"Unable to merge query strings: \".concat(e));\n return newUrl;\n }\n currUrl.searchParams.forEach((value, key) => {\n // skip if search param already exists in redirectUrl\n if (redirectUrl.searchParams.has(key)) {\n return;\n }\n redirectUrl.searchParams.set(key, value);\n });\n return redirectUrl.toString();\n}\nfunction isObj(x) {\n return typeof x === \"object\" && x !== null;\n}\nexport function getAutoExperimentChangeType(exp) {\n if (exp.urlPatterns && exp.variations.some(variation => isObj(variation) && \"urlRedirect\" in variation)) {\n return \"redirect\";\n } else if (exp.variations.some(variation => isObj(variation) && (variation.domMutations || \"js\" in variation || \"css\" in variation))) {\n return \"visual\";\n }\n return \"unknown\";\n}\n//# sourceMappingURL=util.js.map","/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { paddedVersionString } from \"./util\";\nconst _regexCache = {};\n\n// The top-level condition evaluation function\nexport function evalCondition(obj, condition) {\n // Recursive condition\n if (\"$or\" in condition) {\n return evalOr(obj, condition[\"$or\"]);\n }\n if (\"$nor\" in condition) {\n return !evalOr(obj, condition[\"$nor\"]);\n }\n if (\"$and\" in condition) {\n return evalAnd(obj, condition[\"$and\"]);\n }\n if (\"$not\" in condition) {\n return !evalCondition(obj, condition[\"$not\"]);\n }\n\n // Condition is an object, keys are object paths, values are the condition for that path\n for (const [k, v] of Object.entries(condition)) {\n if (!evalConditionValue(v, getPath(obj, k))) return false;\n }\n return true;\n}\n\n// Return value at dot-separated path of an object\nfunction getPath(obj, path) {\n const parts = path.split(\".\");\n let current = obj;\n for (let i = 0; i < parts.length; i++) {\n if (current && typeof current === \"object\" && parts[i] in current) {\n current = current[parts[i]];\n } else {\n return null;\n }\n }\n return current;\n}\n\n// Transform a regex string into a real RegExp object\nfunction getRegex(regex) {\n if (!_regexCache[regex]) {\n _regexCache[regex] = new RegExp(regex.replace(/([^\\\\])\\//g, \"$1\\\\/\"));\n }\n return _regexCache[regex];\n}\n\n// Evaluate a single value against a condition\nfunction evalConditionValue(condition, value) {\n // Simple equality comparisons\n if (typeof condition === \"string\") {\n return value + \"\" === condition;\n }\n if (typeof condition === \"number\") {\n return value * 1 === condition;\n }\n if (typeof condition === \"boolean\") {\n return !!value === condition;\n }\n if (condition === null) {\n return value === null;\n }\n if (Array.isArray(condition) || !isOperatorObject(condition)) {\n return JSON.stringify(value) === JSON.stringify(condition);\n }\n\n // This is a special operator condition and we should evaluate each one separately\n for (const op in condition) {\n if (!evalOperatorCondition(op, value, condition[op])) {\n return false;\n }\n }\n return true;\n}\n\n// If the object has only keys that start with '$'\nfunction isOperatorObject(obj) {\n const keys = Object.keys(obj);\n return keys.length > 0 && keys.filter(k => k[0] === \"$\").length === keys.length;\n}\n\n// Return the data type of a value\nfunction getType(v) {\n if (v === null) return \"null\";\n if (Array.isArray(v)) return \"array\";\n const t = typeof v;\n if ([\"string\", \"number\", \"boolean\", \"object\", \"undefined\"].includes(t)) {\n return t;\n }\n return \"unknown\";\n}\n\n// At least one element of actual must match the expected condition/value\nfunction elemMatch(actual, expected) {\n if (!Array.isArray(actual)) return false;\n const check = isOperatorObject(expected) ? v => evalConditionValue(expected, v) : v => evalCondition(v, expected);\n for (let i = 0; i < actual.length; i++) {\n if (actual[i] && check(actual[i])) {\n return true;\n }\n }\n return false;\n}\nfunction isIn(actual, expected) {\n // Do an intersection is attribute is an array\n if (Array.isArray(actual)) {\n return actual.some(el => expected.includes(el));\n }\n return expected.includes(actual);\n}\n\n// Evaluate a single operator condition\nfunction evalOperatorCondition(operator, actual, expected) {\n switch (operator) {\n case \"$veq\":\n return paddedVersionString(actual) === paddedVersionString(expected);\n case \"$vne\":\n return paddedVersionString(actual) !== paddedVersionString(expected);\n case \"$vgt\":\n return paddedVersionString(actual) > paddedVersionString(expected);\n case \"$vgte\":\n return paddedVersionString(actual) >= paddedVersionString(expected);\n case \"$vlt\":\n return paddedVersionString(actual) < paddedVersionString(expected);\n case \"$vlte\":\n return paddedVersionString(actual) <= paddedVersionString(expected);\n case \"$eq\":\n return actual === expected;\n case \"$ne\":\n return actual !== expected;\n case \"$lt\":\n return actual < expected;\n case \"$lte\":\n return actual <= expected;\n case \"$gt\":\n return actual > expected;\n case \"$gte\":\n return actual >= expected;\n case \"$exists\":\n // Using `!=` and `==` instead of strict checks so it also matches for undefined\n return expected ? actual != null : actual == null;\n case \"$in\":\n if (!Array.isArray(expected)) return false;\n return isIn(actual, expected);\n case \"$nin\":\n if (!Array.isArray(expected)) return false;\n return !isIn(actual, expected);\n case \"$not\":\n return !evalConditionValue(expected, actual);\n case \"$size\":\n if (!Array.isArray(actual)) return false;\n return evalConditionValue(expected, actual.length);\n case \"$elemMatch\":\n return elemMatch(actual, expected);\n case \"$all\":\n if (!Array.isArray(actual)) return false;\n for (let i = 0; i < expected.length; i++) {\n let passed = false;\n for (let j = 0; j < actual.length; j++) {\n if (evalConditionValue(expected[i], actual[j])) {\n passed = true;\n break;\n }\n }\n if (!passed) return false;\n }\n return true;\n case \"$regex\":\n try {\n return getRegex(expected).test(actual);\n } catch (e) {\n return false;\n }\n case \"$type\":\n return getType(actual) === expected;\n default:\n console.error(\"Unknown operator: \" + operator);\n return false;\n }\n}\n\n// Recursive $or rule\nfunction evalOr(obj, conditions) {\n if (!conditions.length) return true;\n for (let i = 0; i < conditions.length; i++) {\n if (evalCondition(obj, conditions[i])) {\n return true;\n }\n }\n return false;\n}\n\n// Recursive $and rule\nfunction evalAnd(obj, conditions) {\n for (let i = 0; i < conditions.length; i++) {\n if (!evalCondition(obj, conditions[i])) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=mongrule.js.map","import { GrowthBook } from \"./GrowthBook\";\nimport { getPolyfills } from \"./util\";\n// Config settings\nconst cacheSettings = {\n // Consider a fetch stale after 1 minute\n staleTTL: 1000 * 60,\n // Max time to keep a fetch in cache (24 hours default)\n maxAge: 1000 * 60 * 60 * 24,\n cacheKey: \"gbFeaturesCache\",\n backgroundSync: true,\n maxEntries: 10,\n disableIdleStreams: false,\n idleStreamInterval: 20000,\n disableCache: false\n};\nconst polyfills = getPolyfills();\nexport const helpers = {\n fetchFeaturesCall: _ref => {\n let {\n host,\n clientKey,\n headers\n } = _ref;\n return polyfills.fetch(\"\".concat(host, \"/api/features/\").concat(clientKey), {\n headers\n });\n },\n fetchRemoteEvalCall: _ref2 => {\n let {\n host,\n clientKey,\n payload,\n headers\n } = _ref2;\n const options = {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...headers\n },\n body: JSON.stringify(payload)\n };\n return polyfills.fetch(\"\".concat(host, \"/api/eval/\").concat(clientKey), options);\n },\n eventSourceCall: _ref3 => {\n let {\n host,\n clientKey,\n headers\n } = _ref3;\n if (headers) {\n return new polyfills.EventSource(\"\".concat(host, \"/sub/\").concat(clientKey), {\n headers\n });\n }\n return new polyfills.EventSource(\"\".concat(host, \"/sub/\").concat(clientKey));\n },\n startIdleListener: () => {\n let idleTimeout;\n const isBrowser = typeof window !== \"undefined\" && typeof document !== \"undefined\";\n if (!isBrowser) return;\n const onVisibilityChange = () => {\n if (document.visibilityState === \"visible\") {\n window.clearTimeout(idleTimeout);\n onVisible();\n } else if (document.visibilityState === \"hidden\") {\n idleTimeout = window.setTimeout(onHidden, cacheSettings.idleStreamInterval);\n }\n };\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n return () => document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n },\n stopIdleListener: () => {\n // No-op, replaced by startIdleListener\n }\n};\ntry {\n if (globalThis.localStorage) {\n polyfills.localStorage = globalThis.localStorage;\n }\n} catch (e) {\n // Ignore localStorage errors\n}\n\n// Global state\nconst subscribedInstances = new Map();\nlet cacheInitialized = false;\nconst cache = new Map();\nconst activeFetches = new Map();\nconst streams = new Map();\nconst supportsSSE = new Set();\n\n// Public functions\nexport function setPolyfills(overrides) {\n Object.assign(polyfills, overrides);\n}\nexport function configureCache(overrides) {\n Object.assign(cacheSettings, overrides);\n if (!cacheSettings.backgroundSync) {\n clearAutoRefresh();\n }\n}\nexport async function clearCache() {\n cache.clear();\n activeFetches.clear();\n clearAutoRefresh();\n cacheInitialized = false;\n await updatePersistentCache();\n}\nexport async function prefetchPayload(options) {\n // Create a temporary instance, just to fetch the payload\n const instance = new GrowthBook(options);\n await refreshFeatures({\n instance,\n skipCache: options.skipCache,\n allowStale: false,\n backgroundSync: options.streaming\n });\n instance.destroy();\n}\n\n// Get or fetch features and refresh the SDK instance\nexport async function refreshFeatures(_ref4) {\n let {\n instance,\n timeout,\n skipCache,\n allowStale,\n backgroundSync\n } = _ref4;\n if (!backgroundSync) {\n cacheSettings.backgroundSync = false;\n }\n return fetchFeaturesWithCache({\n instance,\n allowStale,\n timeout,\n skipCache\n });\n}\n\n// Subscribe a GrowthBook instance to feature changes\nexport function subscribe(instance) {\n const key = getKey(instance);\n const subs = subscribedInstances.get(key) || new Set();\n subs.add(instance);\n subscribedInstances.set(key, subs);\n}\nexport function unsubscribe(instance) {\n subscribedInstances.forEach(s => s.delete(instance));\n}\nexport function onHidden() {\n streams.forEach(channel => {\n if (!channel) return;\n channel.state = \"idle\";\n disableChannel(channel);\n });\n}\nexport function onVisible() {\n streams.forEach(channel => {\n if (!channel) return;\n if (channel.state !== \"idle\") return;\n enableChannel(channel);\n });\n}\n\n// Private functions\n\nasync function updatePersistentCache() {\n try {\n if (!polyfills.localStorage) return;\n await polyfills.localStorage.setItem(cacheSettings.cacheKey, JSON.stringify(Array.from(cache.entries())));\n } catch (e) {\n // Ignore localStorage errors\n }\n}\n\n// SWR wrapper for fetching features. May indirectly or directly start SSE streaming.\nasync function fetchFeaturesWithCache(_ref5) {\n let {\n instance,\n allowStale,\n timeout,\n skipCache\n } = _ref5;\n const key = getKey(instance);\n const cacheKey = getCacheKey(instance);\n const now = new Date();\n const minStaleAt = new Date(now.getTime() - cacheSettings.maxAge + cacheSettings.staleTTL);\n await initializeCache();\n const existing = !cacheSettings.disableCache && !skipCache ? cache.get(cacheKey) : undefined;\n if (existing && (allowStale || existing.staleAt > now) && existing.staleAt > minStaleAt) {\n // Restore from cache whether SSE is supported\n if (existing.sse) supportsSSE.add(key);\n\n // Reload features in the background if stale\n if (existing.staleAt < now) {\n fetchFeatures(instance);\n }\n // Otherwise, if we don't need to refresh now, start a background sync\n else {\n startAutoRefresh(instance);\n }\n return {\n data: existing.data,\n success: true,\n source: \"cache\"\n };\n } else {\n const res = await promiseTimeout(fetchFeatures(instance), timeout);\n return res || {\n data: null,\n success: false,\n source: \"timeout\",\n error: new Error(\"Timeout\")\n };\n }\n}\nfunction getKey(instance) {\n const [apiHost, clientKey] = instance.getApiInfo();\n return \"\".concat(apiHost, \"||\").concat(clientKey);\n}\nfunction getCacheKey(instance) {\n const baseKey = getKey(instance);\n if (!instance.isRemoteEval()) return baseKey;\n const attributes = instance.getAttributes();\n const cacheKeyAttributes = instance.getCacheKeyAttributes() || Object.keys(instance.getAttributes());\n const ca = {};\n cacheKeyAttributes.forEach(key => {\n ca[key] = attributes[key];\n });\n const fv = instance.getForcedVariations();\n const url = instance.getUrl();\n return \"\".concat(baseKey, \"||\").concat(JSON.stringify({\n ca,\n fv,\n url\n }));\n}\n\n// Guarantee the promise always resolves within {timeout} ms\n// Resolved value will be `null` when there's an error or it takes too long\n// Note: The promise will continue running in the background, even if the timeout is hit\nfunction promiseTimeout(promise, timeout) {\n return new Promise(resolve => {\n let resolved = false;\n let timer;\n const finish = data => {\n if (resolved) return;\n resolved = true;\n timer && clearTimeout(timer);\n resolve(data || null);\n };\n if (timeout) {\n timer = setTimeout(() => finish(), timeout);\n }\n promise.then(data => finish(data)).catch(() => finish());\n });\n}\n\n// Populate cache from localStorage (if available)\nasync function initializeCache() {\n if (cacheInitialized) return;\n cacheInitialized = true;\n try {\n if (polyfills.localStorage) {\n const value = await polyfills.localStorage.getItem(cacheSettings.cacheKey);\n if (!cacheSettings.disableCache && value) {\n const parsed = JSON.parse(value);\n if (parsed && Array.isArray(parsed)) {\n parsed.forEach(_ref6 => {\n let [key, data] = _ref6;\n cache.set(key, {\n ...data,\n staleAt: new Date(data.staleAt)\n });\n });\n }\n cleanupCache();\n }\n }\n } catch (e) {\n // Ignore localStorage errors\n }\n if (!cacheSettings.disableIdleStreams) {\n const cleanupFn = helpers.startIdleListener();\n if (cleanupFn) {\n helpers.stopIdleListener = cleanupFn;\n }\n }\n}\n\n// Enforce the maxEntries limit\nfunction cleanupCache() {\n const entriesWithTimestamps = Array.from(cache.entries()).map(_ref7 => {\n let [key, value] = _ref7;\n return {\n key,\n staleAt: value.staleAt.getTime()\n };\n }).sort((a, b) => a.staleAt - b.staleAt);\n const entriesToRemoveCount = Math.min(Math.max(0, cache.size - cacheSettings.maxEntries), cache.size);\n for (let i = 0; i < entriesToRemoveCount; i++) {\n cache.delete(entriesWithTimestamps[i].key);\n }\n}\n\n// Called whenever new features are fetched from the API\nfunction onNewFeatureData(key, cacheKey, data) {\n // If contents haven't changed, ignore the update, extend the stale TTL\n const version = data.dateUpdated || \"\";\n const staleAt = new Date(Date.now() + cacheSettings.staleTTL);\n const existing = !cacheSettings.disableCache ? cache.get(cacheKey) : undefined;\n if (existing && version && existing.version === version) {\n existing.staleAt = staleAt;\n updatePersistentCache();\n return;\n }\n if (!cacheSettings.disableCache) {\n // Update in-memory cache\n cache.set(cacheKey, {\n data,\n version,\n staleAt,\n sse: supportsSSE.has(key)\n });\n cleanupCache();\n }\n // Update local storage (don't await this, just update asynchronously)\n updatePersistentCache();\n\n // Update features for all subscribed GrowthBook instances\n const instances = subscribedInstances.get(key);\n instances && instances.forEach(instance => refreshInstance(instance, data));\n}\nasync function refreshInstance(instance, data) {\n await instance.setPayload(data || instance.getPayload());\n}\n\n// Fetch the features payload from helper function or from in-mem injected payload\nasync function fetchFeatures(instance) {\n const {\n apiHost,\n apiRequestHeaders\n } = instance.getApiHosts();\n const clientKey = instance.getClientKey();\n const remoteEval = instance.isRemoteEval();\n const key = getKey(instance);\n const cacheKey = getCacheKey(instance);\n let promise = activeFetches.get(cacheKey);\n if (!promise) {\n const fetcher = remoteEval ? helpers.fetchRemoteEvalCall({\n host: apiHost,\n clientKey,\n payload: {\n attributes: instance.getAttributes(),\n forcedVariations: instance.getForcedVariations(),\n forcedFeatures: Array.from(instance.getForcedFeatures().entries()),\n url: instance.getUrl()\n },\n headers: apiRequestHeaders\n }) : helpers.fetchFeaturesCall({\n host: apiHost,\n clientKey,\n headers: apiRequestHeaders\n });\n\n // TODO: auto-retry if status code indicates a temporary error\n promise = fetcher.then(res => {\n if (!res.ok) {\n throw new Error(\"HTTP error: \".concat(res.status));\n }\n if (res.headers.get(\"x-sse-support\") === \"enabled\") {\n supportsSSE.add(key);\n }\n return res.json();\n }).then(data => {\n onNewFeatureData(key, cacheKey, data);\n startAutoRefresh(instance);\n activeFetches.delete(cacheKey);\n return {\n data,\n success: true,\n source: \"network\"\n };\n }).catch(e => {\n process.env.NODE_ENV !== \"production\" && instance.log(\"Error fetching features\", {\n apiHost,\n clientKey,\n error: e ? e.message : null\n });\n activeFetches.delete(cacheKey);\n return {\n data: null,\n source: \"error\",\n success: false,\n error: e\n };\n });\n activeFetches.set(cacheKey, promise);\n }\n return promise;\n}\n\n// Start SSE streaming, listens to feature payload changes and triggers a refresh or re-fetch\nexport function startAutoRefresh(instance) {\n let forceSSE = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n const key = getKey(instance);\n const cacheKey = getCacheKey(instance);\n const {\n streamingHost,\n streamingHostRequestHeaders\n } = instance.getApiHosts();\n const clientKey = instance.getClientKey();\n if (forceSSE) {\n supportsSSE.add(key);\n }\n if (cacheSettings.backgroundSync && supportsSSE.has(key) && polyfills.EventSource) {\n if (streams.has(key)) return;\n const channel = {\n src: null,\n host: streamingHost,\n clientKey,\n headers: streamingHostRequestHeaders,\n cb: event => {\n try {\n if (event.type === \"features-updated\") {\n const instances = subscribedInstances.get(key);\n instances && instances.forEach(instance => {\n fetchFeatures(instance);\n });\n } else if (event.type === \"features\") {\n const json = JSON.parse(event.data);\n onNewFeatureData(key, cacheKey, json);\n }\n // Reset error count on success\n channel.errors = 0;\n } catch (e) {\n process.env.NODE_ENV !== \"production\" && instance.log(\"SSE Error\", {\n streamingHost,\n clientKey,\n error: e ? e.message : null\n });\n onSSEError(channel);\n }\n },\n errors: 0,\n state: \"active\"\n };\n streams.set(key, channel);\n enableChannel(channel);\n }\n}\nfunction onSSEError(channel) {\n if (channel.state === \"idle\") return;\n channel.errors++;\n if (channel.errors > 3 || channel.src && channel.src.readyState === 2) {\n // exponential backoff after 4 errors, with jitter\n const delay = Math.pow(3, channel.errors - 3) * (1000 + Math.random() * 1000);\n disableChannel(channel);\n setTimeout(() => {\n if ([\"idle\", \"active\"].includes(channel.state)) return;\n enableChannel(channel);\n }, Math.min(delay, 300000)); // 5 minutes max\n }\n}\n\nfunction disableChannel(channel) {\n if (!channel.src) return;\n channel.src.onopen = null;\n channel.src.onerror = null;\n channel.src.close();\n channel.src = null;\n if (channel.state === \"active\") {\n channel.state = \"disabled\";\n }\n}\nfunction enableChannel(channel) {\n channel.src = helpers.eventSourceCall({\n host: channel.host,\n clientKey: channel.clientKey,\n headers: channel.headers\n });\n channel.state = \"active\";\n channel.src.addEventListener(\"features\", channel.cb);\n channel.src.addEventListener(\"features-updated\", channel.cb);\n channel.src.onerror = () => onSSEError(channel);\n channel.src.onopen = () => {\n channel.errors = 0;\n };\n}\nfunction destroyChannel(channel, key) {\n disableChannel(channel);\n streams.delete(key);\n}\nfunction clearAutoRefresh() {\n // Clear list of which keys are auto-updated\n supportsSSE.clear();\n\n // Stop listening for any SSE events\n streams.forEach(destroyChannel);\n\n // Remove all references to GrowthBook instances\n subscribedInstances.clear();\n\n // Run the idle stream cleanup function\n helpers.stopIdleListener();\n}\n//# sourceMappingURL=feature-repository.js.map","import mutate from \"dom-mutator\";\nimport { chooseVariation, decrypt, getAutoExperimentChangeType, getBucketRanges, getQueryStringOverride, getUrlRegExp, hash, inNamespace, inRange, isIncluded, isURLTargeted, loadSDKVersion, mergeQueryStrings, toString } from \"./util\";\nimport { evalCondition } from \"./mongrule\";\nimport { refreshFeatures, startAutoRefresh, subscribe, unsubscribe } from \"./feature-repository\";\nconst isBrowser = typeof window !== \"undefined\" && typeof document !== \"undefined\";\nconst SDK_VERSION = loadSDKVersion();\nexport class GrowthBook {\n // context is technically private, but some tools depend on it so we can't mangle the name\n // _ctx below is a clone of this property that we use internally\n\n // Properties and methods that start with \"_\" are mangled by Terser (saves ~150 bytes)\n\n // eslint-disable-next-line\n\n constructor(context) {\n context = context || {};\n // These properties are all initialized in the constructor instead of above\n // This saves ~80 bytes in the final output\n this.version = SDK_VERSION;\n this._ctx = this.context = context;\n this._renderer = context.renderer || null;\n this._trackedExperiments = new Set();\n this._completedChangeIds = new Set();\n this._trackedFeatures = {};\n this.debug = !!context.debug;\n this._subscriptions = new Set();\n this._rtQueue = [];\n this._rtTimer = 0;\n this.ready = false;\n this._assigned = new Map();\n this._forcedFeatureValues = new Map();\n this._attributeOverrides = {};\n this._activeAutoExperiments = new Map();\n this._triggeredExpKeys = new Set();\n this._initialized = false;\n this._redirectedUrl = \"\";\n this._deferredTrackingCalls = new Map();\n this._autoExperimentsAllowed = !context.disableExperimentsOnLoad;\n if (context.remoteEval) {\n if (context.decryptionKey) {\n throw new Error(\"Encryption is not available for remoteEval\");\n }\n if (!context.clientKey) {\n throw new Error(\"Missing clientKey\");\n }\n let isGbHost = false;\n try {\n isGbHost = !!new URL(context.apiHost || \"\").hostname.match(/growthbook\\.io$/i);\n } catch (e) {\n // ignore invalid URLs\n }\n if (isGbHost) {\n throw new Error(\"Cannot use remoteEval on GrowthBook Cloud\");\n }\n } else {\n if (context.cacheKeyAttributes) {\n throw new Error(\"cacheKeyAttributes are only used for remoteEval\");\n }\n }\n if (context.features) {\n this.ready = true;\n }\n if (isBrowser && context.enableDevMode) {\n window._growthbook = this;\n document.dispatchEvent(new Event(\"gbloaded\"));\n }\n if (context.experiments) {\n this.ready = true;\n this._updateAllAutoExperiments();\n } else if (context.antiFlicker) {\n this._setAntiFlicker();\n }\n\n // Hydrate sticky bucket service\n if (this._ctx.stickyBucketService && this._ctx.stickyBucketAssignmentDocs) {\n for (const key in this._ctx.stickyBucketAssignmentDocs) {\n const doc = this._ctx.stickyBucketAssignmentDocs[key];\n if (doc) {\n this._ctx.stickyBucketService.saveAssignments(doc).catch(() => {\n // Ignore hydration errors\n });\n }\n }\n }\n\n // Legacy - passing in features/experiments into the constructor instead of using init\n if (this.ready) {\n this.refreshStickyBuckets(this.getPayload());\n }\n }\n async setPayload(payload) {\n this._payload = payload;\n const data = await this.decryptPayload(payload);\n this._decryptedPayload = data;\n await this.refreshStickyBuckets(data);\n if (data.features) {\n this._ctx.features = data.features;\n }\n if (data.experiments) {\n this._ctx.experiments = data.experiments;\n this._updateAllAutoExperiments();\n }\n this.ready = true;\n this._render();\n }\n initSync(options) {\n this._initialized = true;\n const payload = options.payload;\n if (payload.encryptedExperiments || payload.encryptedFeatures) {\n throw new Error(\"initSync does not support encrypted payloads\");\n }\n if (this._ctx.stickyBucketService && !this._ctx.stickyBucketAssignmentDocs) {\n throw new Error(\"initSync requires you to pass stickyBucketAssignmentDocs into the GrowthBook constructor\");\n }\n this._payload = payload;\n this._decryptedPayload = payload;\n if (payload.features) {\n this._ctx.features = payload.features;\n }\n if (payload.experiments) {\n this._ctx.experiments = payload.experiments;\n this._updateAllAutoExperiments();\n }\n this.ready = true;\n if (options.streaming) {\n if (!this._ctx.clientKey) {\n throw new Error(\"Must specify clientKey to enable streaming\");\n }\n startAutoRefresh(this, true);\n subscribe(this);\n }\n return this;\n }\n async init(options) {\n this._initialized = true;\n options = options || {};\n if (options.payload) {\n await this.setPayload(options.payload);\n if (options.streaming) {\n if (!this._ctx.clientKey) {\n throw new Error(\"Must specify clientKey to enable streaming\");\n }\n startAutoRefresh(this, true);\n subscribe(this);\n }\n return {\n success: true,\n source: \"init\"\n };\n } else {\n const {\n data,\n ...res\n } = await this._refresh({\n ...options,\n allowStale: true\n });\n if (options.streaming) {\n subscribe(this);\n }\n await this.setPayload(data || {});\n return res;\n }\n }\n\n /** @deprecated Use {@link init} */\n async loadFeatures(options) {\n this._initialized = true;\n options = options || {};\n if (options.autoRefresh) {\n // interpret deprecated autoRefresh option as subscribeToChanges\n this._ctx.subscribeToChanges = true;\n }\n const {\n data\n } = await this._refresh({\n ...options,\n allowStale: true\n });\n await this.setPayload(data || {});\n if (this._canSubscribe()) {\n subscribe(this);\n }\n }\n async refreshFeatures(options) {\n const res = await this._refresh({\n ...(options || {}),\n allowStale: false\n });\n if (res.data) {\n await this.setPayload(res.data);\n }\n }\n getApiInfo() {\n return [this.getApiHosts().apiHost, this.getClientKey()];\n }\n getApiHosts() {\n const defaultHost = this._ctx.apiHost || \"https://cdn.growthbook.io\";\n return {\n apiHost: defaultHost.replace(/\\/*$/, \"\"),\n streamingHost: (this._ctx.streamingHost || defaultHost).replace(/\\/*$/, \"\"),\n apiRequestHeaders: this._ctx.apiHostRequestHeaders,\n streamingHostRequestHeaders: this._ctx.streamingHostRequestHeaders\n };\n }\n getClientKey() {\n return this._ctx.clientKey || \"\";\n }\n getPayload() {\n return this._payload || {\n features: this.getFeatures(),\n experiments: this.getExperiments()\n };\n }\n getDecryptedPayload() {\n return this._decryptedPayload || this.getPayload();\n }\n isRemoteEval() {\n return this._ctx.remoteEval || false;\n }\n getCacheKeyAttributes() {\n return this._ctx.cacheKeyAttributes;\n }\n async _refresh(_ref) {\n var _ref2;\n let {\n timeout,\n skipCache,\n allowStale,\n streaming\n } = _ref;\n if (!this._ctx.clientKey) {\n throw new Error(\"Missing clientKey\");\n }\n // Trigger refresh in feature repository\n return refreshFeatures({\n instance: this,\n timeout,\n skipCache: skipCache || this._ctx.disableCache,\n allowStale,\n backgroundSync: (_ref2 = streaming !== null && streaming !== void 0 ? streaming : this._ctx.backgroundSync) !== null && _ref2 !== void 0 ? _ref2 : true\n });\n }\n _render() {\n if (this._renderer) {\n try {\n this._renderer();\n } catch (e) {\n console.error(\"Failed to render\", e);\n }\n }\n }\n\n /** @deprecated Use {@link setPayload} */\n setFeatures(features) {\n this._ctx.features = features;\n this.ready = true;\n this._render();\n }\n\n /** @deprecated Use {@link setPayload} */\n async setEncryptedFeatures(encryptedString, decryptionKey, subtle) {\n const featuresJSON = await decrypt(encryptedString, decryptionKey || this._ctx.decryptionKey, subtle);\n this.setFeatures(JSON.parse(featuresJSON));\n }\n\n /** @deprecated Use {@link setPayload} */\n setExperiments(experiments) {\n this._ctx.experiments = experiments;\n this.ready = true;\n this._updateAllAutoExperiments();\n }\n\n /** @deprecated Use {@link setPayload} */\n async setEncryptedExperiments(encryptedString, decryptionKey, subtle) {\n const experimentsJSON = await decrypt(encryptedString, decryptionKey || this._ctx.decryptionKey, subtle);\n this.setExperiments(JSON.parse(experimentsJSON));\n }\n async decryptPayload(data, decryptionKey, subtle) {\n data = {\n ...data\n };\n if (data.encryptedFeatures) {\n data.features = JSON.parse(await decrypt(data.encryptedFeatures, decryptionKey || this._ctx.decryptionKey, subtle));\n delete data.encryptedFeatures;\n }\n if (data.encryptedExperiments) {\n data.experiments = JSON.parse(await decrypt(data.encryptedExperiments, decryptionKey || this._ctx.decryptionKey, subtle));\n delete data.encryptedExperiments;\n }\n return data;\n }\n async setAttributes(attributes) {\n this._ctx.attributes = attributes;\n if (this._ctx.stickyBucketService) {\n await this.refreshStickyBuckets();\n }\n if (this._ctx.remoteEval) {\n await this._refreshForRemoteEval();\n return;\n }\n this._render();\n this._updateAllAutoExperiments();\n }\n async updateAttributes(attributes) {\n return this.setAttributes({\n ...this._ctx.attributes,\n ...attributes\n });\n }\n async setAttributeOverrides(overrides) {\n this._attributeOverrides = overrides;\n if (this._ctx.stickyBucketService) {\n await this.refreshStickyBuckets();\n }\n if (this._ctx.remoteEval) {\n await this._refreshForRemoteEval();\n return;\n }\n this._render();\n this._updateAllAutoExperiments();\n }\n async setForcedVariations(vars) {\n this._ctx.forcedVariations = vars || {};\n if (this._ctx.remoteEval) {\n await this._refreshForRemoteEval();\n return;\n }\n this._render();\n this._updateAllAutoExperiments();\n }\n\n // eslint-disable-next-line\n setForcedFeatures(map) {\n this._forcedFeatureValues = map;\n this._render();\n }\n async setURL(url) {\n this._ctx.url = url;\n this._redirectedUrl = \"\";\n if (this._ctx.remoteEval) {\n await this._refreshForRemoteEval();\n this._updateAllAutoExperiments(true);\n return;\n }\n this._updateAllAutoExperiments(true);\n }\n getAttributes() {\n return {\n ...this._ctx.attributes,\n ...this._attributeOverrides\n };\n }\n getForcedVariations() {\n return this._ctx.forcedVariations || {};\n }\n getForcedFeatures() {\n // eslint-disable-next-line\n return this._forcedFeatureValues || new Map();\n }\n getStickyBucketAssignmentDocs() {\n return this._ctx.stickyBucketAssignmentDocs || {};\n }\n getUrl() {\n return this._ctx.url || \"\";\n }\n getFeatures() {\n return this._ctx.features || {};\n }\n getExperiments() {\n return this._ctx.experiments || [];\n }\n getCompletedChangeIds() {\n return Array.from(this._completedChangeIds);\n }\n subscribe(cb) {\n this._subscriptions.add(cb);\n return () => {\n this._subscriptions.delete(cb);\n };\n }\n _canSubscribe() {\n var _this$_ctx$background;\n return ((_this$_ctx$background = this._ctx.backgroundSync) !== null && _this$_ctx$background !== void 0 ? _this$_ctx$background : true) && this._ctx.subscribeToChanges;\n }\n async _refreshForRemoteEval() {\n if (!this._ctx.remoteEval) return;\n if (!this._initialized) return;\n const res = await this._refresh({\n allowStale: false\n });\n if (res.data) {\n await this.setPayload(res.data);\n }\n }\n getAllResults() {\n return new Map(this._assigned);\n }\n destroy() {\n // Release references to save memory\n this._subscriptions.clear();\n this._assigned.clear();\n this._trackedExperiments.clear();\n this._completedChangeIds.clear();\n this._deferredTrackingCalls.clear();\n this._trackedFeatures = {};\n this._rtQueue = [];\n this._payload = undefined;\n if (this._rtTimer) {\n clearTimeout(this._rtTimer);\n }\n unsubscribe(this);\n if (isBrowser && window._growthbook === this) {\n delete window._growthbook;\n }\n\n // Undo any active auto experiments\n this._activeAutoExperiments.forEach(exp => {\n exp.undo();\n });\n this._activeAutoExperiments.clear();\n this._triggeredExpKeys.clear();\n }\n setRenderer(renderer) {\n this._renderer = renderer;\n }\n forceVariation(key, variation) {\n this._ctx.forcedVariations = this._ctx.forcedVariations || {};\n this._ctx.forcedVariations[key] = variation;\n if (this._ctx.remoteEval) {\n this._refreshForRemoteEval();\n return;\n }\n this._updateAllAutoExperiments();\n this._render();\n }\n run(experiment) {\n const result = this._run(experiment, null);\n this._fireSubscriptions(experiment, result);\n return result;\n }\n triggerExperiment(key) {\n this._triggeredExpKeys.add(key);\n if (!this._ctx.experiments) return null;\n const experiments = this._ctx.experiments.filter(exp => exp.key === key);\n return experiments.map(exp => {\n return this._runAutoExperiment(exp);\n }).filter(res => res !== null);\n }\n triggerAutoExperiments() {\n this._autoExperimentsAllowed = true;\n this._updateAllAutoExperiments(true);\n }\n _runAutoExperiment(experiment, forceRerun) {\n const existing = this._activeAutoExperiments.get(experiment);\n\n // If this is a manual experiment and it's not already running, skip\n if (experiment.manual && !this._triggeredExpKeys.has(experiment.key) && !existing) return null;\n\n // Check if this particular experiment is blocked by context settings\n // For example, if all visualEditor experiments are disabled\n const isBlocked = this._isAutoExperimentBlockedByContext(experiment);\n if (isBlocked) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Auto experiment blocked\", {\n id: experiment.key\n });\n }\n\n // Run the experiment (if blocked exclude)\n const result = isBlocked ? this._getResult(experiment, -1, false, \"\") : this.run(experiment);\n\n // A hash to quickly tell if the assigned value changed\n const valueHash = JSON.stringify(result.value);\n\n // If the changes are already active, no need to re-apply them\n if (!forceRerun && result.inExperiment && existing && existing.valueHash === valueHash) {\n return result;\n }\n\n // Undo any existing changes\n if (existing) this._undoActiveAutoExperiment(experiment);\n\n // Apply new changes\n if (result.inExperiment) {\n const changeType = getAutoExperimentChangeType(experiment);\n if (changeType === \"redirect\" && result.value.urlRedirect && experiment.urlPatterns) {\n const url = experiment.persistQueryString ? mergeQueryStrings(this._getContextUrl(), result.value.urlRedirect) : result.value.urlRedirect;\n if (isURLTargeted(url, experiment.urlPatterns)) {\n this.log(\"Skipping redirect because original URL matches redirect URL\", {\n id: experiment.key\n });\n return result;\n }\n this._redirectedUrl = url;\n const navigate = this._getNavigateFunction();\n if (navigate) {\n if (isBrowser) {\n var _this$_ctx$navigateDe;\n this._setAntiFlicker();\n window.setTimeout(() => {\n try {\n navigate(url);\n } catch (e) {\n console.error(e);\n }\n }, (_this$_ctx$navigateDe = this._ctx.navigateDelay) !== null && _this$_ctx$navigateDe !== void 0 ? _this$_ctx$navigateDe : 100);\n } else {\n try {\n navigate(url);\n } catch (e) {\n console.error(e);\n }\n }\n }\n } else if (changeType === \"visual\") {\n const undo = this._ctx.applyDomChangesCallback ? this._ctx.applyDomChangesCallback(result.value) : this._applyDOMChanges(result.value);\n if (undo) {\n this._activeAutoExperiments.set(experiment, {\n undo,\n valueHash\n });\n }\n }\n }\n return result;\n }\n _undoActiveAutoExperiment(exp) {\n const data = this._activeAutoExperiments.get(exp);\n if (data) {\n data.undo();\n this._activeAutoExperiments.delete(exp);\n }\n }\n _updateAllAutoExperiments(forceRerun) {\n if (!this._autoExperimentsAllowed) return;\n const experiments = this._ctx.experiments || [];\n\n // Stop any experiments that are no longer defined\n const keys = new Set(experiments);\n this._activeAutoExperiments.forEach((v, k) => {\n if (!keys.has(k)) {\n v.undo();\n this._activeAutoExperiments.delete(k);\n }\n });\n\n // Re-run all new/updated experiments\n for (const exp of experiments) {\n const result = this._runAutoExperiment(exp, forceRerun);\n\n // Once you're in a redirect experiment, break out of the loop and don't run any further experiments\n if (result !== null && result !== void 0 && result.inExperiment && getAutoExperimentChangeType(exp) === \"redirect\") {\n break;\n }\n }\n }\n _fireSubscriptions(experiment, result) {\n const key = experiment.key;\n\n // If assigned variation has changed, fire subscriptions\n const prev = this._assigned.get(key);\n // TODO: what if the experiment definition has changed?\n if (!prev || prev.result.inExperiment !== result.inExperiment || prev.result.variationId !== result.variationId) {\n this._assigned.set(key, {\n experiment,\n result\n });\n this._subscriptions.forEach(cb => {\n try {\n cb(experiment, result);\n } catch (e) {\n console.error(e);\n }\n });\n }\n }\n _trackFeatureUsage(key, res) {\n // Don't track feature usage that was forced via an override\n if (res.source === \"override\") return;\n\n // Only track a feature once, unless the assigned value changed\n const stringifiedValue = JSON.stringify(res.value);\n if (this._trackedFeatures[key] === stringifiedValue) return;\n this._trackedFeatures[key] = stringifiedValue;\n\n // Fire user-supplied callback\n if (this._ctx.onFeatureUsage) {\n try {\n this._ctx.onFeatureUsage(key, res);\n } catch (e) {\n // Ignore feature usage callback errors\n }\n }\n\n // In browser environments, queue up feature usage to be tracked in batches\n if (!isBrowser || !window.fetch) return;\n this._rtQueue.push({\n key,\n on: res.on\n });\n if (!this._rtTimer) {\n this._rtTimer = window.setTimeout(() => {\n // Reset the queue\n this._rtTimer = 0;\n const q = [...this._rtQueue];\n this._rtQueue = [];\n\n // Skip logging if a real-time usage key is not configured\n if (!this._ctx.realtimeKey) return;\n window.fetch(\"https://rt.growthbook.io/?key=\".concat(this._ctx.realtimeKey, \"&events=\").concat(encodeURIComponent(JSON.stringify(q))), {\n cache: \"no-cache\",\n mode: \"no-cors\"\n }).catch(() => {\n // TODO: retry in case of network errors?\n });\n }, this._ctx.realtimeInterval || 2000);\n }\n }\n _getFeatureResult(key, value, source, ruleId, experiment, result) {\n const ret = {\n value,\n on: !!value,\n off: !value,\n source,\n ruleId: ruleId || \"\"\n };\n if (experiment) ret.experiment = experiment;\n if (result) ret.experimentResult = result;\n\n // Track the usage of this feature in real-time\n this._trackFeatureUsage(key, ret);\n return ret;\n }\n isOn(key) {\n return this.evalFeature(key).on;\n }\n isOff(key) {\n return this.evalFeature(key).off;\n }\n getFeatureValue(key, defaultValue) {\n const value = this.evalFeature(key).value;\n return value === null ? defaultValue : value;\n }\n\n /**\n * @deprecated Use {@link evalFeature}\n * @param id\n */\n // eslint-disable-next-line\n feature(id) {\n return this.evalFeature(id);\n }\n evalFeature(id) {\n return this._evalFeature(id);\n }\n _evalFeature(id, evalCtx) {\n evalCtx = evalCtx || {\n evaluatedFeatures: new Set()\n };\n if (evalCtx.evaluatedFeatures.has(id)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"evalFeature: circular dependency detected: \".concat(evalCtx.id, \" -> \").concat(id), {\n from: evalCtx.id,\n to: id\n });\n return this._getFeatureResult(id, null, \"cyclicPrerequisite\");\n }\n evalCtx.evaluatedFeatures.add(id);\n evalCtx.id = id;\n\n // Global override\n if (this._forcedFeatureValues.has(id)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Global override\", {\n id,\n value: this._forcedFeatureValues.get(id)\n });\n return this._getFeatureResult(id, this._forcedFeatureValues.get(id), \"override\");\n }\n\n // Unknown feature id\n if (!this._ctx.features || !this._ctx.features[id]) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Unknown feature\", {\n id\n });\n return this._getFeatureResult(id, null, \"unknownFeature\");\n }\n\n // Get the feature\n const feature = this._ctx.features[id];\n\n // Loop through the rules\n if (feature.rules) {\n rules: for (const rule of feature.rules) {\n // If there are prerequisite flag(s), evaluate them\n if (rule.parentConditions) {\n for (const parentCondition of rule.parentConditions) {\n const parentResult = this._evalFeature(parentCondition.id, evalCtx);\n // break out for cyclic prerequisites\n if (parentResult.source === \"cyclicPrerequisite\") {\n return this._getFeatureResult(id, null, \"cyclicPrerequisite\");\n }\n const evalObj = {\n value: parentResult.value\n };\n const evaled = evalCondition(evalObj, parentCondition.condition || {});\n if (!evaled) {\n // blocking prerequisite eval failed: feature evaluation fails\n if (parentCondition.gate) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Feature blocked by prerequisite\", {\n id,\n rule\n });\n return this._getFeatureResult(id, null, \"prerequisite\");\n }\n // non-blocking prerequisite eval failed: break out of parentConditions loop, jump to the next rule\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip rule because prerequisite evaluation fails\", {\n id,\n rule\n });\n continue rules;\n }\n }\n }\n\n // If there are filters for who is included (e.g. namespaces)\n if (rule.filters && this._isFilteredOut(rule.filters)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip rule because of filters\", {\n id,\n rule\n });\n continue;\n }\n\n // Feature value is being forced\n if (\"force\" in rule) {\n // If it's a conditional rule, skip if the condition doesn't pass\n if (rule.condition && !this._conditionPasses(rule.condition)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip rule because of condition ff\", {\n id,\n rule\n });\n continue;\n }\n\n // If this is a percentage rollout, skip if not included\n if (!this._isIncludedInRollout(rule.seed || id, rule.hashAttribute, this._ctx.stickyBucketService && !rule.disableStickyBucketing ? rule.fallbackAttribute : undefined, rule.range, rule.coverage, rule.hashVersion)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip rule because user not included in rollout\", {\n id,\n rule\n });\n continue;\n }\n process.env.NODE_ENV !== \"production\" && this.log(\"Force value from rule\", {\n id,\n rule\n });\n\n // If this was a remotely evaluated experiment, fire the tracking callbacks\n if (rule.tracks) {\n rule.tracks.forEach(t => {\n this._track(t.experiment, t.result);\n });\n }\n return this._getFeatureResult(id, rule.force, \"force\", rule.id);\n }\n if (!rule.variations) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip invalid rule\", {\n id,\n rule\n });\n continue;\n }\n\n // For experiment rules, run an experiment\n const exp = {\n variations: rule.variations,\n key: rule.key || id\n };\n if (\"coverage\" in rule) exp.coverage = rule.coverage;\n if (rule.weights) exp.weights = rule.weights;\n if (rule.hashAttribute) exp.hashAttribute = rule.hashAttribute;\n if (rule.fallbackAttribute) exp.fallbackAttribute = rule.fallbackAttribute;\n if (rule.disableStickyBucketing) exp.disableStickyBucketing = rule.disableStickyBucketing;\n if (rule.bucketVersion !== undefined) exp.bucketVersion = rule.bucketVersion;\n if (rule.minBucketVersion !== undefined) exp.minBucketVersion = rule.minBucketVersion;\n if (rule.namespace) exp.namespace = rule.namespace;\n if (rule.meta) exp.meta = rule.meta;\n if (rule.ranges) exp.ranges = rule.ranges;\n if (rule.name) exp.name = rule.name;\n if (rule.phase) exp.phase = rule.phase;\n if (rule.seed) exp.seed = rule.seed;\n if (rule.hashVersion) exp.hashVersion = rule.hashVersion;\n if (rule.filters) exp.filters = rule.filters;\n if (rule.condition) exp.condition = rule.condition;\n\n // Only return a value if the user is part of the experiment\n const res = this._run(exp, id);\n this._fireSubscriptions(exp, res);\n if (res.inExperiment && !res.passthrough) {\n return this._getFeatureResult(id, res.value, \"experiment\", rule.id, exp, res);\n }\n }\n }\n process.env.NODE_ENV !== \"production\" && this.log(\"Use default value\", {\n id,\n value: feature.defaultValue\n });\n\n // Fall back to using the default value\n return this._getFeatureResult(id, feature.defaultValue === undefined ? null : feature.defaultValue, \"defaultValue\");\n }\n _isIncludedInRollout(seed, hashAttribute, fallbackAttribute, range, coverage, hashVersion) {\n if (!range && coverage === undefined) return true;\n if (!range && coverage === 0) return false;\n const {\n hashValue\n } = this._getHashAttribute(hashAttribute, fallbackAttribute);\n if (!hashValue) {\n return false;\n }\n const n = hash(seed, hashValue, hashVersion || 1);\n if (n === null) return false;\n return range ? inRange(n, range) : coverage !== undefined ? n <= coverage : true;\n }\n _conditionPasses(condition) {\n return evalCondition(this.getAttributes(), condition);\n }\n _isFilteredOut(filters) {\n return filters.some(filter => {\n const {\n hashValue\n } = this._getHashAttribute(filter.attribute);\n if (!hashValue) return true;\n const n = hash(filter.seed, hashValue, filter.hashVersion || 2);\n if (n === null) return true;\n return !filter.ranges.some(r => inRange(n, r));\n });\n }\n _run(experiment, featureId) {\n const key = experiment.key;\n const numVariations = experiment.variations.length;\n\n // 1. If experiment has less than 2 variations, return immediately\n if (numVariations < 2) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Invalid experiment\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 2. If the context is disabled, return immediately\n if (this._ctx.enabled === false) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Context disabled\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 2.5. Merge in experiment overrides from the context\n experiment = this._mergeOverrides(experiment);\n\n // 2.6 New, more powerful URL targeting\n if (experiment.urlPatterns && !isURLTargeted(this._getContextUrl(), experiment.urlPatterns)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of url targeting\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 3. If a variation is forced from a querystring, return the forced variation\n const qsOverride = getQueryStringOverride(key, this._getContextUrl(), numVariations);\n if (qsOverride !== null) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Force via querystring\", {\n id: key,\n variation: qsOverride\n });\n return this._getResult(experiment, qsOverride, false, featureId);\n }\n\n // 4. If a variation is forced in the context, return the forced variation\n if (this._ctx.forcedVariations && key in this._ctx.forcedVariations) {\n const variation = this._ctx.forcedVariations[key];\n process.env.NODE_ENV !== \"production\" && this.log(\"Force via dev tools\", {\n id: key,\n variation\n });\n return this._getResult(experiment, variation, false, featureId);\n }\n\n // 5. Exclude if a draft experiment or not active\n if (experiment.status === \"draft\" || experiment.active === false) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because inactive\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 6. Get the hash attribute and return if empty\n const {\n hashAttribute,\n hashValue\n } = this._getHashAttribute(experiment.hashAttribute, this._ctx.stickyBucketService && !experiment.disableStickyBucketing ? experiment.fallbackAttribute : undefined);\n if (!hashValue) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because missing hashAttribute\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n let assigned = -1;\n let foundStickyBucket = false;\n let stickyBucketVersionIsBlocked = false;\n if (this._ctx.stickyBucketService && !experiment.disableStickyBucketing) {\n const {\n variation,\n versionIsBlocked\n } = this._getStickyBucketVariation({\n expKey: experiment.key,\n expBucketVersion: experiment.bucketVersion,\n expHashAttribute: experiment.hashAttribute,\n expFallbackAttribute: experiment.fallbackAttribute,\n expMinBucketVersion: experiment.minBucketVersion,\n expMeta: experiment.meta\n });\n foundStickyBucket = variation >= 0;\n assigned = variation;\n stickyBucketVersionIsBlocked = !!versionIsBlocked;\n }\n\n // Some checks are not needed if we already have a sticky bucket\n if (!foundStickyBucket) {\n // 7. Exclude if user is filtered out (used to be called \"namespace\")\n if (experiment.filters) {\n if (this._isFilteredOut(experiment.filters)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of filters\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n } else if (experiment.namespace && !inNamespace(hashValue, experiment.namespace)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of namespace\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 7.5. Exclude if experiment.include returns false or throws\n if (experiment.include && !isIncluded(experiment.include)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of include function\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 8. Exclude if condition is false\n if (experiment.condition && !this._conditionPasses(experiment.condition)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of condition exp\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 8.05. Exclude if prerequisites are not met\n if (experiment.parentConditions) {\n for (const parentCondition of experiment.parentConditions) {\n const parentResult = this._evalFeature(parentCondition.id);\n // break out for cyclic prerequisites\n if (parentResult.source === \"cyclicPrerequisite\") {\n return this._getResult(experiment, -1, false, featureId);\n }\n const evalObj = {\n value: parentResult.value\n };\n if (!evalCondition(evalObj, parentCondition.condition || {})) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because prerequisite evaluation fails\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n }\n }\n\n // 8.1. Exclude if user is not in a required group\n if (experiment.groups && !this._hasGroupOverlap(experiment.groups)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of groups\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n }\n\n // 8.2. Old style URL targeting\n if (experiment.url && !this._urlIsValid(experiment.url)) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of url\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 9. Get the variation from the sticky bucket or get bucket ranges and choose variation\n const n = hash(experiment.seed || key, hashValue, experiment.hashVersion || 1);\n if (n === null) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of invalid hash version\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n if (!foundStickyBucket) {\n const ranges = experiment.ranges || getBucketRanges(numVariations, experiment.coverage === undefined ? 1 : experiment.coverage, experiment.weights);\n assigned = chooseVariation(n, ranges);\n }\n\n // 9.5 Unenroll if any prior sticky buckets are blocked by version\n if (stickyBucketVersionIsBlocked) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because sticky bucket version is blocked\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId, undefined, true);\n }\n\n // 10. Return if not in experiment\n if (assigned < 0) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because of coverage\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 11. Experiment has a forced variation\n if (\"force\" in experiment) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Force variation\", {\n id: key,\n variation: experiment.force\n });\n return this._getResult(experiment, experiment.force === undefined ? -1 : experiment.force, false, featureId);\n }\n\n // 12. Exclude if in QA mode\n if (this._ctx.qaMode) {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because QA mode\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 12.5. Exclude if experiment is stopped\n if (experiment.status === \"stopped\") {\n process.env.NODE_ENV !== \"production\" && this.log(\"Skip because stopped\", {\n id: key\n });\n return this._getResult(experiment, -1, false, featureId);\n }\n\n // 13. Build the result object\n const result = this._getResult(experiment, assigned, true, featureId, n, foundStickyBucket);\n\n // 13.5. Persist sticky bucket\n if (this._ctx.stickyBucketService && !experiment.disableStickyBucketing) {\n const {\n changed,\n key: attrKey,\n doc\n } = this._generateStickyBucketAssignmentDoc(hashAttribute, toString(hashValue), {\n [this._getStickyBucketExperimentKey(experiment.key, experiment.bucketVersion)]: result.key\n });\n if (changed) {\n // update local docs\n this._ctx.stickyBucketAssignmentDocs = this._ctx.stickyBucketAssignmentDocs || {};\n this._ctx.stickyBucketAssignmentDocs[attrKey] = doc;\n // save doc\n this._ctx.stickyBucketService.saveAssignments(doc);\n }\n }\n\n // 14. Fire the tracking callback\n this._track(experiment, result);\n\n // 14.1 Keep track of completed changeIds\n \"changeId\" in experiment && experiment.changeId && this._completedChangeIds.add(experiment.changeId);\n\n // 15. Return the result\n process.env.NODE_ENV !== \"production\" && this.log(\"In experiment\", {\n id: key,\n variation: result.variationId\n });\n return result;\n }\n log(msg, ctx) {\n if (!this.debug) return;\n if (this._ctx.log) this._ctx.log(msg, ctx);else console.log(msg, ctx);\n }\n getDeferredTrackingCalls() {\n return Array.from(this._deferredTrackingCalls.values());\n }\n setDeferredTrackingCalls(calls) {\n this._deferredTrackingCalls = new Map(calls.filter(c => c && c.experiment && c.result).map(c => {\n return [this._getTrackKey(c.experiment, c.result), c];\n }));\n }\n fireDeferredTrackingCalls() {\n if (!this._ctx.trackingCallback) return;\n this._deferredTrackingCalls.forEach(call => {\n if (!call || !call.experiment || !call.result) {\n console.error(\"Invalid deferred tracking call\", {\n call: call\n });\n } else {\n this._track(call.experiment, call.result);\n }\n });\n this._deferredTrackingCalls.clear();\n }\n setTrackingCallback(callback) {\n this._ctx.trackingCallback = callback;\n this.fireDeferredTrackingCalls();\n }\n _getTrackKey(experiment, result) {\n return result.hashAttribute + result.hashValue + experiment.key + result.variationId;\n }\n _track(experiment, result) {\n const k = this._getTrackKey(experiment, result);\n if (!this._ctx.trackingCallback) {\n // Add to deferred tracking if it hasn't already been added\n if (!this._deferredTrackingCalls.has(k)) {\n this._deferredTrackingCalls.set(k, {\n experiment,\n result\n });\n }\n return;\n }\n\n // Make sure a tracking callback is only fired once per unique experiment\n if (this._trackedExperiments.has(k)) return;\n this._trackedExperiments.add(k);\n try {\n this._ctx.trackingCallback(experiment, result);\n } catch (e) {\n console.error(e);\n }\n }\n _mergeOverrides(experiment) {\n const key = experiment.key;\n const o = this._ctx.overrides;\n if (o && o[key]) {\n experiment = Object.assign({}, experiment, o[key]);\n if (typeof experiment.url === \"string\") {\n experiment.url = getUrlRegExp(\n // eslint-disable-next-line\n experiment.url);\n }\n }\n return experiment;\n }\n _getHashAttribute(attr, fallback) {\n let hashAttribute = attr || \"id\";\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let hashValue = \"\";\n if (this._attributeOverrides[hashAttribute]) {\n hashValue = this._attributeOverrides[hashAttribute];\n } else if (this._ctx.attributes) {\n hashValue = this._ctx.attributes[hashAttribute] || \"\";\n } else if (this._ctx.user) {\n hashValue = this._ctx.user[hashAttribute] || \"\";\n }\n\n // if no match, try fallback\n if (!hashValue && fallback) {\n if (this._attributeOverrides[fallback]) {\n hashValue = this._attributeOverrides[fallback];\n } else if (this._ctx.attributes) {\n hashValue = this._ctx.attributes[fallback] || \"\";\n } else if (this._ctx.user) {\n hashValue = this._ctx.user[fallback] || \"\";\n }\n if (hashValue) {\n hashAttribute = fallback;\n }\n }\n return {\n hashAttribute,\n hashValue\n };\n }\n _getResult(experiment, variationIndex, hashUsed, featureId, bucket, stickyBucketUsed) {\n let inExperiment = true;\n // If assigned variation is not valid, use the baseline and mark the user as not in the experiment\n if (variationIndex < 0 || variationIndex >= experiment.variations.length) {\n variationIndex = 0;\n inExperiment = false;\n }\n const {\n hashAttribute,\n hashValue\n } = this._getHashAttribute(experiment.hashAttribute, this._ctx.stickyBucketService && !experiment.disableStickyBucketing ? experiment.fallbackAttribute : undefined);\n const meta = experiment.meta ? experiment.meta[variationIndex] : {};\n const res = {\n key: meta.key || \"\" + variationIndex,\n featureId,\n inExperiment,\n hashUsed,\n variationId: variationIndex,\n value: experiment.variations[variationIndex],\n hashAttribute,\n hashValue,\n stickyBucketUsed: !!stickyBucketUsed\n };\n if (meta.name) res.name = meta.name;\n if (bucket !== undefined) res.bucket = bucket;\n if (meta.passthrough) res.passthrough = meta.passthrough;\n return res;\n }\n _getContextUrl() {\n return this._ctx.url || (isBrowser ? window.location.href : \"\");\n }\n _urlIsValid(urlRegex) {\n const url = this._getContextUrl();\n if (!url) return false;\n const pathOnly = url.replace(/^https?:\\/\\//, \"\").replace(/^[^/]*\\//, \"/\");\n if (urlRegex.test(url)) return true;\n if (urlRegex.test(pathOnly)) return true;\n return false;\n }\n _hasGroupOverlap(expGroups) {\n const groups = this._ctx.groups || {};\n for (let i = 0; i < expGroups.length; i++) {\n if (groups[expGroups[i]]) return true;\n }\n return false;\n }\n _isAutoExperimentBlockedByContext(experiment) {\n const changeType = getAutoExperimentChangeType(experiment);\n if (changeType === \"visual\") {\n if (this._ctx.disableVisualExperiments) return true;\n if (this._ctx.disableJsInjection) {\n if (experiment.variations.some(v => v.js)) {\n return true;\n }\n }\n } else if (changeType === \"redirect\") {\n if (this._ctx.disableUrlRedirectExperiments) return true;\n\n // Validate URLs\n try {\n const current = new URL(this._getContextUrl());\n for (const v of experiment.variations) {\n if (!v || !v.urlRedirect) continue;\n const url = new URL(v.urlRedirect);\n\n // If we're blocking cross origin redirects, block if the protocol or host is different\n if (this._ctx.disableCrossOriginUrlRedirectExperiments) {\n if (url.protocol !== current.protocol) return true;\n if (url.host !== current.host) return true;\n }\n }\n } catch (e) {\n // Problem parsing one of the URLs\n this.log(\"Error parsing current or redirect URL\", {\n id: experiment.key,\n error: e\n });\n return true;\n }\n } else {\n // Block any unknown changeTypes\n return true;\n }\n if (experiment.changeId && (this._ctx.blockedChangeIds || []).includes(experiment.changeId)) {\n return true;\n }\n return false;\n }\n getRedirectUrl() {\n return this._redirectedUrl;\n }\n _getNavigateFunction() {\n if (this._ctx.navigate) {\n return this._ctx.navigate;\n } else if (isBrowser) {\n return url => {\n window.location.replace(url);\n };\n }\n return null;\n }\n _setAntiFlicker() {\n if (!this._ctx.antiFlicker || !isBrowser) return;\n try {\n var _this$_ctx$antiFlicke;\n const styleTag = document.createElement(\"style\");\n styleTag.innerHTML = \".gb-anti-flicker { opacity: 0 !important; pointer-events: none; }\";\n document.head.appendChild(styleTag);\n document.documentElement.classList.add(\"gb-anti-flicker\");\n\n // Fallback if GrowthBook fails to load in specified time or 3.5 seconds\n setTimeout(() => {\n document.documentElement.classList.remove(\"gb-anti-flicker\");\n }, (_this$_ctx$antiFlicke = this._ctx.antiFlickerTimeout) !== null && _this$_ctx$antiFlicke !== void 0 ? _this$_ctx$antiFlicke : 3500);\n } catch (e) {\n console.error(e);\n }\n }\n _applyDOMChanges(changes) {\n if (!isBrowser) return;\n const undo = [];\n if (changes.css) {\n const s = document.createElement(\"style\");\n s.innerHTML = changes.css;\n document.head.appendChild(s);\n undo.push(() => s.remove());\n }\n if (changes.js) {\n const script = document.createElement(\"script\");\n script.innerHTML = changes.js;\n if (this._ctx.jsInjectionNonce) {\n script.nonce = this._ctx.jsInjectionNonce;\n }\n document.head.appendChild(script);\n undo.push(() => script.remove());\n }\n if (changes.domMutations) {\n changes.domMutations.forEach(mutation => {\n undo.push(mutate.declarative(mutation).revert);\n });\n }\n return () => {\n undo.forEach(fn => fn());\n };\n }\n _deriveStickyBucketIdentifierAttributes(data) {\n const attributes = new Set();\n const features = data && data.features ? data.features : this.getFeatures();\n const experiments = data && data.experiments ? data.experiments : this.getExperiments();\n Object.keys(features).forEach(id => {\n const feature = features[id];\n if (feature.rules) {\n for (const rule of feature.rules) {\n if (rule.variations) {\n attributes.add(rule.hashAttribute || \"id\");\n if (rule.fallbackAttribute) {\n attributes.add(rule.fallbackAttribute);\n }\n }\n }\n }\n });\n experiments.map(experiment => {\n attributes.add(experiment.hashAttribute || \"id\");\n if (experiment.fallbackAttribute) {\n attributes.add(experiment.fallbackAttribute);\n }\n });\n return Array.from(attributes);\n }\n async refreshStickyBuckets(data) {\n if (this._ctx.stickyBucketService) {\n const attributes = this._getStickyBucketAttributes(data);\n this._ctx.stickyBucketAssignmentDocs = await this._ctx.stickyBucketService.getAllAssignments(attributes);\n }\n }\n _getStickyBucketAssignments(expHashAttribute, expFallbackAttribute) {\n if (!this._ctx.stickyBucketAssignmentDocs) return {};\n const {\n hashAttribute,\n hashValue\n } = this._getHashAttribute(expHashAttribute);\n const hashKey = \"\".concat(hashAttribute, \"||\").concat(toString(hashValue));\n const {\n hashAttribute: fallbackAttribute,\n hashValue: fallbackValue\n } = this._getHashAttribute(expFallbackAttribute);\n const fallbackKey = fallbackValue ? \"\".concat(fallbackAttribute, \"||\").concat(toString(fallbackValue)) : null;\n const assignments = {};\n if (fallbackKey && this._ctx.stickyBucketAssignmentDocs[fallbackKey]) {\n Object.assign(assignments, this._ctx.stickyBucketAssignmentDocs[fallbackKey].assignments || {});\n }\n if (this._ctx.stickyBucketAssignmentDocs[hashKey]) {\n Object.assign(assignments, this._ctx.stickyBucketAssignmentDocs[hashKey].assignments || {});\n }\n return assignments;\n }\n _getStickyBucketVariation(_ref3) {\n let {\n expKey,\n expBucketVersion,\n expHashAttribute,\n expFallbackAttribute,\n expMinBucketVersion,\n expMeta\n } = _ref3;\n expBucketVersion = expBucketVersion || 0;\n expMinBucketVersion = expMinBucketVersion || 0;\n expHashAttribute = expHashAttribute || \"id\";\n expMeta = expMeta || [];\n const id = this._getStickyBucketExperimentKey(expKey, expBucketVersion);\n const assignments = this._getStickyBucketAssignments(expHashAttribute, expFallbackAttribute);\n\n // users with any blocked bucket version (0 to minExperimentBucketVersion) are excluded from the test\n if (expMinBucketVersion > 0) {\n for (let i = 0; i <= expMinBucketVersion; i++) {\n const blockedKey = this._getStickyBucketExperimentKey(expKey, i);\n if (assignments[blockedKey] !== undefined) {\n return {\n variation: -1,\n versionIsBlocked: true\n };\n }\n }\n }\n const variationKey = assignments[id];\n if (variationKey === undefined)\n // no assignment found\n return {\n variation: -1\n };\n const variation = expMeta.findIndex(m => m.key === variationKey);\n if (variation < 0)\n // invalid assignment, treat as \"no assignment found\"\n return {\n variation: -1\n };\n return {\n variation\n };\n }\n _getStickyBucketExperimentKey(experimentKey, experimentBucketVersion) {\n experimentBucketVersion = experimentBucketVersion || 0;\n return \"\".concat(experimentKey, \"__\").concat(experimentBucketVersion);\n }\n _getStickyBucketAttributes(data) {\n const attributes = {};\n this._ctx.stickyBucketIdentifierAttributes = !this._ctx.stickyBucketIdentifierAttributes ? this._deriveStickyBucketIdentifierAttributes(data) : this._ctx.stickyBucketIdentifierAttributes;\n this._ctx.stickyBucketIdentifierAttributes.forEach(attr => {\n const {\n hashValue\n } = this._getHashAttribute(attr);\n attributes[attr] = toString(hashValue);\n });\n return attributes;\n }\n _generateStickyBucketAssignmentDoc(attributeName, attributeValue, assignments) {\n const key = \"\".concat(attributeName, \"||\").concat(attributeValue);\n const existingAssignments = this._ctx.stickyBucketAssignmentDocs && this._ctx.stickyBucketAssignmentDocs[key] ? this._ctx.stickyBucketAssignmentDocs[key].assignments || {} : {};\n const newAssignments = {\n ...existingAssignments,\n ...assignments\n };\n const changed = JSON.stringify(existingAssignments) !== JSON.stringify(newAssignments);\n return {\n key,\n doc: {\n attributeName,\n attributeValue,\n assignments: newAssignments\n },\n changed\n };\n }\n}\n//# sourceMappingURL=GrowthBook.js.map","import Loader from \"./loader\";\nimport { GrowthBook } from \"@growthbook/growthbook\";\n\nconst TestAB = {\n loader: document.querySelector(\"#loader\"),\n\n generateUUID: function () {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(\n /[xy]/g,\n function (c) {\n const r = (Math.random() * 16) | 0,\n v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n }\n );\n },\n\n setCookie: function (name, value, days) {\n let expires = \"\";\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = \"; expires=\" + date.toUTCString();\n }\n document.cookie = name + \"=\" + (value || \"\") + expires + \"; path=/\";\n },\n\n getCookie: function (name) {\n const nameEQ = `${name}=`;\n const cookies = document.cookie.split(\";\").map((cookie) => cookie.trim());\n\n for (const cookie of cookies) {\n if (cookie.startsWith(nameEQ)) {\n return cookie.substring(nameEQ.length);\n }\n }\n\n return null;\n },\n\n getOrSetTestID: function () {\n let testID = this.getCookie(\"testID\");\n if (!testID) {\n testID = this.generateUUID();\n this.setCookie(\"testID\", testID, 1); // Set cookie for one day\n }\n return testID;\n },\n\n setGrowthBookPersistent: async function () {\n const testID = this.getOrSetTestID();\n\n const growthbook = new GrowthBook({\n apiHost: \"https://cdn.growthbook.io\",\n clientKey: \"sdk-gNAEzDvTcpDc0Ji\",\n attributes: {\n testID: testID,\n // Add other attributes as needed\n },\n trackingCallback: (experiment, result) => {\n // console.log(\"Tracking Callback Triggered\");\n console.log(\"Experiment/Feature Evaluated\", {\n key: experiment.key,\n value: result.value || result.key,\n type: experiment.type,\n });\n\n // Push experiment/feature data to the data layer\n window.dataLayer = window.dataLayer || [];\n window.dataLayer.push({\n event:\n experiment.type === \"experiment\"\n ? \"experiment_viewed\"\n : \"feature_flag_evaluated\",\n experiment_id: experiment.key,\n variation_id: result.key,\n });\n\n // Log the event and the data sent\n console.log(\"Data Layer event pushed:\", {\n experiment_id: experiment.key,\n variation_id: result.key,\n type: experiment.type,\n });\n },\n });\n\n // console.log(\"Growthbook initialized with Test ID:\", testID);\n // console.log(\"Growthbook user attributes:\", growthbook.getAttributes());\n\n // Initialize Growthbook and fetch feature definitions\n await growthbook.init();\n\n // Check feature flags and run experiments\n this.checkFeaturesAndExperiments(growthbook);\n\n return growthbook;\n },\n\n checkFeaturesAndExperiments: function (growthbook) {\n // Check feature flags\n const featureFlag = growthbook.isOn(\"new_feature_test\");\n // ATUALIZAR O NOME DO TESTE VIGENTE AQUI\n const currentTest = growthbook.isOn(\"100-faixa-topo-preto-vs-cereja\");\n\n if (featureFlag || currentTest) {\n // console.log(\"Feature 'new_feature_test' is ON (Persistent)\");\n this.loader && Loader.init();\n } else {\n // console.log(\"Feature 'new_feature_test' is OFF (Persistent)\");\n this.loader && this.loader.classList.add(\"-hidden\");\n }\n\n // Run experiments\n // const experimentResult = growthbook.run({\n // key: \"100-faixa-topo-10-off-x-15-off\",\n // }).value;\n\n // // Use the result in your UI\n // console.log('experimentResult: ', experimentResult);\n },\n\n init: function () {\n // console.log(\"Growthbook script init\");\n this.setGrowthBookPersistent();\n },\n};\n\nexport default TestAB;\n","\nconst LazyLoading = {\n threshold: window.innerWidth < 768 ? 350 : 600,\n nativeImageSupport: \"loading\" in HTMLImageElement.prototype,\n nativeIframeSupport: \"loading\" in HTMLIFrameElement.prototype,\n setForNativeLazy: function(element) {\n if (element.hasAttribute('src') || element.hasAttribute('srcset')) {\n // console.warn('Elemento já está com lazy load nativo configurado', element)\n return \n }\n if (element.hasAttribute('data-src')) {\n element.setAttribute('src', element.getAttribute('data-src'))\n }\n if (element.hasAttribute('data-srcset')) {\n element.setAttribute('srcset', element.getAttribute('data-srcset'))\n }\n if (element.hasAttribute('data-sizes')) {\n element.setAttribute('sizes', element.getAttribute('data-sizes'))\n }\n element.setAttribute('data-lazy-loaded', true)\n return true\n },\n update: function() {\n if (!this.nativeImageSupport || !this.nativeIframeSupport) {\n window.lazyLoadInstance.update()\n }\n return LazyLoading.init()\n },\n init: function() {\n const lazyImages = document.querySelectorAll(\"img.lazy\");\n const lazyIframes = document.querySelectorAll('iframe.lazy')\n if (LazyLoading.nativeImageSupport) {\n lazyImages.forEach(image => {\n LazyLoading.setForNativeLazy(image)\n });\n }\n if (LazyLoading.nativeIframeSupport) {\n lazyIframes.forEach(iframe => {\n LazyLoading.setForNativeLazy(iframe)\n })\n }\n // Caso tenha o suporte em um, mas não tenha no outro\n if (LazyLoading.nativeImageSupport && !LazyLoading.nativeIframeSupport) {\n lazyImages.forEach(image => {\n image.classList.remove('lazy')\n })\n }\n if (!LazyLoading.nativeImageSupport && LazyLoading.nativeIframeSupport) {\n lazyIframes.forEach(iframe => {\n iframe.classList.remove('lazy')\n })\n }\n // Adiciona vanilla lazy load caso não tenha suporte nativo para algum dos elementos\n if (!LazyLoading.nativeImageSupport || !LazyLoading.nativeIframeSupport) {\n const script = document.createElement('script')\n script.setAttribute('async', true)\n script.src = '/javascripts/lazyload.min.js'\n document.body.appendChild(script)\n window.lazyLoadOptions = {\n elements_selector: \".lazy\",\n threshold: LazyLoading.threshold\n };\n window.addEventListener(\"LazyLoad::Initialized\", event => {\n window.lazyLoadInstance = event.detail.instance\n }, { passive: true });\n }\n return window.lazyLoad = LazyLoading\n }\n}\n\nexport default LazyLoading\n","import TestAB from \"./components/growthbook\";\n// import CrazyEgg from \"./components/crazyEgg\";\nimport LazyLoading from \"./common/lazyLoading\";\nimport Loader from \"./components/loader\";\n\nwindow.$window = $(window);\nwindow.$body = $(\"body\");\nwindow.page = $body.data(\"page\");\nwindow.language = $(\"html\").attr(\"lang\");\nwindow.texts = [];\nwindow.heightHeader = 0;\n\nwindow.texts[\"pt-BR\"] = {\n quantity: \"quantidade\",\n price: \"preço\",\n cart_empty: \"O seu carrinho está vazio\",\n go_product: \"Ir para a página do produto\",\n btn_edit_cart: \"Editar pedido\",\n btn_checkout: \"Finalizar pedido\",\n btn_success: \"Adicionado!\",\n errorsTxt: {\n withoutSku: \"Selecione um atributo para o produto\",\n },\n};\n\nwindow.texts[\"en\"] = {\n quantity: \"quantity\",\n price: \"price\",\n cart_empty: \"Your cart is empty\",\n go_product: \"Ir para a página do produto\",\n btn_edit_cart: \"Go to product page\",\n btn_checkout: \"Checkout\",\n btn_success: \"Added!\",\n errorsTxt: {\n withoutSku: \"Select an attribute for the product\",\n },\n};\n\nfunction getText(key, subKey) {\n if (typeof subKey == \"undefined\") {\n return window.texts[language][key];\n } else {\n return window.texts[language][key][subKey];\n }\n}\n\nwindow.store = {\n config: {\n //Para testes A/B\n abTest: $('body').data('ab-test'),\n // Seletor do botão de comprar\n selectorBtnBuy: '[data-action=\"add-cart\"]',\n selectorBtnBuyAssinatura: '[data-action=\"add-cart-assinatura\"]',\n // Seletor do elemento que engloba um produto\n selectorWrapperProduct: \"[data-box-produto]\",\n selectorWrapperProductAssinatura: \"[data-box-produto-assinatura]\",\n selectorFormProduct: \"[data-form-product]\",\n selectorFormProductAssinatura: \"[data-form-product-assinatura]\",\n // Se a store tem versão internacional ou não\n hasInternacionalVersion: false,\n errorsTxt: {\n withoutSku: getText(\"errorsTxt\", \"withoutSku\"),\n },\n // configuração de comportamento ao add um produto\n addToCartOpenCartpopup: true,\n addToCartOpenCartpopupMobile: true,\n cartCount: {\n selector: \"[data-cart-count]\",\n attr: \"[data-cart-count-attr]\",\n text: \"[data-cart-item-text]\",\n },\n priceProds: {\n selector: \"[data-update-price]\",\n attr: \"update-price\",\n },\n },\n formatMoney: function (value) {\n // FORMATA UM VALOR\n return (\n \"R$ \" +\n value\n .toFixed(2)\n .replace(\".\", \",\")\n .replace(/(\\d)(?=(\\d{3})+\\,)/g, \"$1.\")\n );\n },\n validateQuantity: function (_val) {\n // VALIDA SE A QUANTIDADE INFORMADA É UM NÚMERO\n if (!isNaN(_val)) {\n if (parseInt(_val) > 0) {\n return true;\n }\n }\n\n return false;\n },\n getClearNumber: function (_val) {\n // RETORNA UM NÚMERO LIMPO COMO INT\n if (!isNaN(_val)) {\n let clearNumber = parseInt(_val);\n\n return clearNumber;\n }\n\n return false;\n },\n validateFormProduct: function (_$form) {\n // VALIDA O FORM DE PRODUTO PARA VER SE O PRODUTO PODE SER ADICIONADO\n var $btnComprar = _$form.find('[data-action=\"add-cart\"]');\n var validated = true;\n var errorsTxt = [];\n\n if ($btnComprar.data(\"available\") == \"false\") {\n validated = false;\n errorsTxt.push(\"\");\n } else {\n // verifica se o sku foi selecionado\n if (_$form.find('[name=\"sku\"]').val() == \"\") {\n validated = false;\n errorsTxt.push(\"Selecione um atributo para o produto\");\n }\n\n // verifica se a quantidade é válida\n //console.log(_$form.find('input[name=\"quantity\"]').val());\n if (_$form.find('input[name=\"quantity\"]').val() <= 0) {\n //console.log(\"qtd invalida\");\n validated = false;\n errorsTxt.push(\"Quantidade indisponível\");\n }\n }\n\n return { validated: validated, errors: errorsTxt };\n },\n setRespValidateProduct: function (_resp, _$form, _$boxResponse) {\n // var $boxResult = _$form.find('.resp-validate');\n var $boxResult = _$boxResponse;\n var htmlErrors = \"\";\n\n if (_resp.validated) {\n $boxResult.empty();\n } else {\n for (var i = _resp.errors.length - 1; i >= 0; i--) {\n htmlErrors += '' + _resp.errors[i] + \"\";\n }\n\n $boxResult.html(htmlErrors);\n }\n },\n addItemResultDefault: function (_$form, _typeResult, _result, _$boxResponse) {\n var _this = this;\n if (_typeResult == \"produto-adicionado\") {\n var $btnComprar = _$form.find(_this.config.selectorBtnBuy);\n\n $btnComprar.addClass(\"success\").html(\"Produto adicionado!\");\n\n setTimeout(function () {\n // _$form.find('.msg-response').slideUp(350);\n $btnComprar\n .removeClass(\"success\")\n .html($btnComprar.data(\"text-available\"));\n }, 3500);\n\n setTimeout(function () {\n window.location.href = urlCart;\n }, 150);\n } else if (_typeResult == \"erro-adicionar\") {\n var errorText = JSON.parse(_result.responseText);\n\n if (typeof _$boxResponse != \"undefined\" && _$boxResponse.length > 0) {\n //console.info(errorText);\n\n _$boxResponse.addClass(\"error\");\n _$boxResponse.removeClass(\"success\");\n\n _$boxResponse.find(\"span\").html(errorText.error);\n _$boxResponse.slideDown(350);\n\n setTimeout(function () {\n _$boxResponse.slideUp(350);\n }, 3500);\n }\n }\n },\n getPriceProd: function () {\n var selector = store.config.priceProds.selector;\n var attr = store.config.priceProds.attr;\n var productPrices = document.querySelectorAll(selector);\n\n if (productPrices) {\n productPrices.forEach(function (item, index) {\n var id = item.dataset.updatePrice;\n var url = \"/produto/preco/\" + id;\n\n if (id) {\n fetch(url, { method: \"GET\" }).then(function (response) {\n response\n .text()\n .then(function (text) {\n item.innerHTML = \"\";\n item.insertAdjacentHTML(\"afterbegin\", text);\n // Atualiza o formulário de addFromTag.js\n // Não ativa o form em mobile nem caso esteja na variante de teste A/B\n if ($body.width() > 768 || window.store.config.abTest == false) {\n window.addFromTag.initSingle(item.closest('.product-block'));\n }\n })\n .catch(function (error) {\n // console.log(error.message);\n });\n });\n }\n });\n }\n },\n addItem: function (_$form, _$parent) {\n var $btnComprar = _$parent.find('[data-action=\"add-cart\"]');\n var urlAdd = \"/carrinho/adicionar\";\n var url = urlAdd;\n var form = _$form.serialize();\n var $boxResponse = _$parent.find(\n \"[data-form-product] .msg-response:not(.resp-validate)\"\n );\n\n //console.info('addItem');\n //console.info('addItem', _$form.serializeArray());\n\n if (!$btnComprar.hasClass(\"adding\")) {\n $.ajax({\n url: url,\n type: \"POST\",\n dataType: \"json\",\n data: form,\n beforeSend: function () {\n $btnComprar.addClass(\"adding\");\n },\n })\n .done(function (resp) {\n //console.log(\"success\");\n //console.info(resp);\n\n if (typeof template_store.addItemResult == \"function\") {\n template_store.addItemResult(\n _$form,\n \"produto-adicionado\",\n resp,\n $boxResponse\n );\n } else {\n template_store.addItemResultDefault(\n _$form,\n \"produto-adicionado\",\n resp,\n $boxResponse\n );\n }\n })\n .fail(function (resp) {\n //console.log(\"error\");\n //console.error(resp);\n //console.error(resp.responseText);\n //console.error(resp.responseText.error);\n\n if (typeof template_store.addItemResult == \"function\") {\n template_store.addItemResult(\n _$form,\n \"erro-adicionar\",\n resp,\n $boxResponse\n );\n } else {\n template_store.addItemResultDefault(\n _$form,\n \"erro-adicionar\",\n resp,\n $boxResponse\n );\n }\n })\n .always(function () {\n //console.log(\"complete\");\n $btnComprar.removeClass(\"adding\");\n });\n }\n },\n deleteItem: function (_itemId, _$item, removeItemResult) {\n if (!_$item.hasClass(\"removing\")) {\n $.ajax({\n url: \"/carrinho\",\n type: \"POST\",\n dataType: \"json\",\n data: {\n _method: \"delete\",\n item_id: _itemId,\n },\n beforeSend: function () {\n _$item.addClass(\"removing\");\n },\n })\n .done(function (_cart) {\n //console.log(\"success\");\n\n if ($body.width() > 768) {\n if (store.config.addToCartOpenCartpopup) {\n template_store.headerCart.loadCart(_cart);\n template_store.headerCart.hide();\n }\n } else {\n if (store.config.addToCartOpenCartpopupMobile) {\n template_store.headerCart.loadCart(_cart);\n template_store.headerCart.hide();\n }\n }\n\n if (typeof removeItemResult == \"function\") {\n removeItemResult(_$item, _cart);\n }\n })\n .fail(function (error) {\n //console.log(\"erro ao remover\", error.responseText);\n })\n .always(function () {\n _$item.removeClass(\"removing\");\n });\n }\n },\n setMsgResponse: function (_msg, _type, _$parent) {\n /*\n O tipo pode conter um dos 3 valores: success, warning, error ou CLEAR.\n O type CLEAR limpa as mensagens e faz sumir a mensagem\n */\n\n // Verifica se não há mais de uma mensagem\n // caso tenha, gera um html para cada mensagem\n if (Array.isArray(_msg)) {\n var msgArr = _msg;\n _msg = \"\";\n for (var i = msgArr.length - 1; i >= 0; i--) {\n _msg += '' + msgArr[i] + \"\";\n }\n }\n\n _$parent\n .find(\"[data-msg-retorno]\")\n .removeClass(\"success\")\n .removeClass(\"warning\")\n .removeClass(\"error\");\n\n _$parent.find(\"[data-msg-retorno] [data-msg]\").empty();\n\n if (_type != \"clear\") {\n _$parent.find(\"[data-msg-retorno]\").addClass(_type);\n _$parent.find(\"[data-msg-retorno] [data-msg]\").html(_msg);\n }\n },\n updateCartCount: function (_itemsCount) {\n var _this = this;\n\n $(_this.config.cartCount.selector).empty().text(_itemsCount);\n\n $(_this.config.cartCount.attr).data(\"cart-count-attr\", _itemsCount);\n $(_this.config.cartCount.attr).attr(\"data-cart-count-attr\", _itemsCount);\n\n $(_this.config.cartCount.attr).html(_itemsCount);\n $(_this.config.cartCount.text).html(_itemsCount);\n $(_this.config.cartCount.textLabel).html(\n _itemsCount > 1 ? \"itens\" : \"item\"\n );\n\n if (_itemsCount > 0) {\n $(\"[data-cart-body]\").parent().addClass(\"active\");\n } else {\n $(\"[data-cart-body]\").parent().removeClass(\"active\");\n }\n },\n getCartCount: function () {\n async function getCartItens() {\n let itens;\n\n try {\n itens = await $.ajax({\n url: \"/carrinho/itens\",\n type: \"GET\",\n dataType: \"text\",\n });\n\n return itens;\n } catch (error) {\n //console.error(error);\n }\n }\n\n if ($(store.config.cartCount.selector).length > 0) {\n getCartItens().then((total) => {\n var itens = Number.isInteger(parseInt(total));\n if (itens) {\n $(store.config.cartCount.attr).attr(\"data-cart-count-attr\", total);\n $(store.config.cartCount.selector).html(total);\n\n var $boxCart = $(\"[data-cart-body]\");\n\n if ($boxCart.length > 0) {\n if (total > 0) {\n template_store.headerCart.loadCart();\n } else {\n $boxCart.html(\n '
Seu carrinho está vazio...