@tagadapay/plugin-sdk 3.1.22 → 3.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/build-cdn.js +274 -6
  2. package/dist/external-tracker.js +476 -6774
  3. package/dist/external-tracker.min.js +2 -25
  4. package/dist/external-tracker.min.js.map +4 -4
  5. package/dist/react/config/payment.d.ts +14 -4
  6. package/dist/react/config/payment.js +47 -9
  7. package/dist/react/hooks/useCheckout.d.ts +3 -0
  8. package/dist/react/hooks/useCheckout.js +11 -3
  9. package/dist/react/hooks/usePluginConfig.js +9 -10
  10. package/dist/react/providers/TagadaProvider.js +1 -1
  11. package/dist/tagada-react-sdk-minimal.min.js +36 -0
  12. package/dist/tagada-react-sdk-minimal.min.js.map +7 -0
  13. package/dist/tagada-react-sdk.js +37988 -0
  14. package/dist/tagada-react-sdk.min.js +78 -0
  15. package/dist/tagada-react-sdk.min.js.map +7 -0
  16. package/dist/tagada-sdk.js +7847 -6420
  17. package/dist/tagada-sdk.min.js +4 -22
  18. package/dist/tagada-sdk.min.js.map +4 -4
  19. package/dist/v2/cdn-react-minimal.d.ts +23 -0
  20. package/dist/v2/cdn-react-minimal.js +26 -0
  21. package/dist/v2/core/client.js +2 -1
  22. package/dist/v2/core/config/environment.js +2 -1
  23. package/dist/v2/core/funnelClient.d.ts +106 -10
  24. package/dist/v2/core/funnelClient.js +122 -28
  25. package/dist/v2/core/index.d.ts +0 -1
  26. package/dist/v2/core/index.js +0 -2
  27. package/dist/v2/core/isoData.d.ts +4 -4
  28. package/dist/v2/core/isoData.js +7 -7
  29. package/dist/v2/core/pixelMapping.js +64 -26
  30. package/dist/v2/core/resources/apiClient.d.ts +18 -14
  31. package/dist/v2/core/resources/apiClient.js +151 -109
  32. package/dist/v2/core/resources/checkout.d.ts +10 -0
  33. package/dist/v2/core/resources/checkout.js +6 -0
  34. package/dist/v2/core/resources/expressPaymentMethods.d.ts +1 -0
  35. package/dist/v2/core/resources/index.d.ts +1 -1
  36. package/dist/v2/core/resources/index.js +1 -1
  37. package/dist/v2/core/resources/offers.js +4 -4
  38. package/dist/v2/core/resources/payments.d.ts +8 -2
  39. package/dist/v2/core/resources/payments.js +1 -0
  40. package/dist/v2/core/resources/postPurchases.d.ts +17 -0
  41. package/dist/v2/core/resources/postPurchases.js +20 -0
  42. package/dist/v2/core/utils/currency.d.ts +3 -0
  43. package/dist/v2/core/utils/currency.js +40 -2
  44. package/dist/v2/core/utils/deviceInfo.d.ts +1 -10
  45. package/dist/v2/core/utils/deviceInfo.js +153 -76
  46. package/dist/v2/core/utils/order.d.ts +2 -0
  47. package/dist/v2/core/utils/pluginConfig.js +18 -22
  48. package/dist/v2/core/utils/previewMode.js +12 -0
  49. package/dist/v2/index.d.ts +4 -3
  50. package/dist/v2/index.js +4 -2
  51. package/dist/v2/react/components/ApplePayButton.js +39 -16
  52. package/dist/v2/react/components/FunnelScriptInjector.js +145 -77
  53. package/dist/v2/react/components/StripeExpressButton.d.ts +13 -0
  54. package/dist/v2/react/components/StripeExpressButton.js +170 -0
  55. package/dist/v2/react/components/WhopCheckout.js +7 -1
  56. package/dist/v2/react/hooks/payment-actions/useAirwallexRadarAction.js +1 -0
  57. package/dist/v2/react/hooks/payment-actions/useProcessorAuthAction.js +21 -3
  58. package/dist/v2/react/hooks/useApiQuery.d.ts +1 -1
  59. package/dist/v2/react/hooks/useApiQuery.js +1 -1
  60. package/dist/v2/react/hooks/useApplePayCheckout.js +8 -8
  61. package/dist/v2/react/hooks/useCheckoutQuery.d.ts +10 -0
  62. package/dist/v2/react/hooks/useCheckoutQuery.js +27 -15
  63. package/dist/v2/react/hooks/useFunnel.d.ts +15 -4
  64. package/dist/v2/react/hooks/useFunnel.js +8 -4
  65. package/dist/v2/react/hooks/useGoogleAutocomplete.d.ts +2 -0
  66. package/dist/v2/react/hooks/useGoogleAutocomplete.js +29 -15
  67. package/dist/v2/react/hooks/useISOData.d.ts +2 -5
  68. package/dist/v2/react/hooks/useISOData.js +25 -26
  69. package/dist/v2/react/hooks/usePaymentPolling.d.ts +2 -2
  70. package/dist/v2/react/hooks/usePixelTracking.js +151 -70
  71. package/dist/v2/react/hooks/usePostPurchasesQuery.js +34 -2
  72. package/dist/v2/react/hooks/usePreviewOffer.js +1 -1
  73. package/dist/v2/react/hooks/useRemappableParams.d.ts +2 -6
  74. package/dist/v2/react/hooks/useRemappableParams.js +23 -23
  75. package/dist/v2/react/hooks/useSetPaymentMethod.d.ts +16 -0
  76. package/dist/v2/react/hooks/useSetPaymentMethod.js +33 -0
  77. package/dist/v2/react/hooks/useStepConfig.d.ts +23 -6
  78. package/dist/v2/react/hooks/useStepConfig.js +14 -7
  79. package/dist/v2/react/hooks/useTranslation.js +23 -8
  80. package/dist/v2/react/index.d.ts +8 -1
  81. package/dist/v2/react/index.js +3 -0
  82. package/dist/v2/react/providers/ExpressPaymentMethodsProvider.d.ts +8 -0
  83. package/dist/v2/react/providers/ExpressPaymentMethodsProvider.js +106 -10
  84. package/dist/v2/react/providers/TagadaProvider.js +5 -5
  85. package/dist/v2/standalone/index.d.ts +21 -3
  86. package/dist/v2/standalone/index.js +25 -3
  87. package/dist/v2/standalone/payment-service.d.ts +134 -0
  88. package/dist/v2/standalone/payment-service.js +929 -0
  89. package/package.json +4 -2
@@ -1,32 +1,9 @@
1
1
  /**
2
- * TagadaPay External Tracker v3.1.22
2
+ * TagadaPay External Tracker v3.1.25
3
3
  * CDN Bundle - Standalone tracking for external pages
4
4
  * @license MIT
5
5
  */
6
- "use strict";var TagadaTrackerBundle=(()=>{var os=Object.create;var pt=Object.defineProperty,ss=Object.defineProperties,as=Object.getOwnPropertyDescriptor,cs=Object.getOwnPropertyDescriptors,ls=Object.getOwnPropertyNames,ei=Object.getOwnPropertySymbols,us=Object.getPrototypeOf,ni=Object.prototype.hasOwnProperty,ds=Object.prototype.propertyIsEnumerable;var Ke=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),ps=t=>{throw TypeError(t)};var ti=(t,e,n)=>e in t?pt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,O=(t,e)=>{for(var n in e||(e={}))ni.call(e,n)&&ti(t,n,e[n]);if(ei)for(var n of ei(e))ds.call(e,n)&&ti(t,n,e[n]);return t},$=(t,e)=>ss(t,cs(e));var Te=(t,e)=>()=>(t&&(e=t(t=0)),e);var fs=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Gn=(t,e)=>{for(var n in e)pt(t,n,{get:e[n],enumerable:!0})},ri=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ls(e))!ni.call(t,i)&&i!==n&&pt(t,i,{get:()=>e[i],enumerable:!(r=as(e,i))||r.enumerable});return t};var gs=(t,e,n)=>(n=t!=null?os(us(t)):{},ri(e||!t||!t.__esModule?pt(n,"default",{value:t,enumerable:!0}):n,t)),ms=t=>ri(pt({},"__esModule",{value:!0}),t);var ke=function(t,e){this[0]=t,this[1]=e},Hn=(t,e,n)=>{var r=(s,a,l,c)=>{try{var u=n[s](a),p=(a=u.value)instanceof ke,b=u.done;Promise.resolve(p?a[0]:a).then(w=>p?r(s==="return"?s:"next",a[1]?{done:w.done,value:w.value}:w,l,c):l({value:w,done:b})).catch(w=>r("throw",w,l,c))}catch(w){c(w)}},i=s=>o[s]=a=>new Promise((l,c)=>r(s,a,l,c)),o={};return n=n.apply(t,e),o[Ke("asyncIterator")]=()=>o,i("next"),i("throw"),i("return"),o},Ve=t=>{var e=t[Ke("asyncIterator")],n=!1,r,i={};return e==null?(e=t[Ke("iterator")](),r=o=>i[o]=s=>e[o](s)):(e=e.call(t),r=o=>i[o]=s=>{if(n){if(n=!1,o==="throw")throw s;return s}return n=!0,{done:!1,value:new ke(new Promise(a=>{var l=e[o](s);l instanceof Object||ps("Object expected"),a(l)}),1)}}),i[Ke("iterator")]=()=>i,r("next"),"throw"in e?r("throw"):i.throw=o=>{throw o},"return"in e&&r("return"),i},ii=(t,e,n)=>(e=t[Ke("asyncIterator")])?e.call(t):(t=t[Ke("iterator")](),e={},n=(r,i)=>(i=t[r])&&(e[r]=o=>new Promise((s,a,l)=>(o=i.call(t,o),l=o.done,Promise.resolve(o.value).then(c=>s({value:c,done:l}),a)))),n("next"),n("return"),e);function si(t){var r;if(typeof document=="undefined")return null;let n="; ".concat(document.cookie).split("; ".concat(t,"="));return n.length===2&&((r=n.pop())==null?void 0:r.split(";").shift())||null}function ai(t="local"){let e=oi[t];if(!e)return console.warn("Unknown environment: ".concat(t,". Falling back to local.")),{environment:"local",apiConfig:oi.local};let n=null;if(typeof window!="undefined"&&(n=new URLSearchParams(window.location.search).get("tagadaClientBaseUrl"),!n))try{n=localStorage.getItem("tgd_client_base_url")||si("tgd_client_base_url")}catch(i){}return n?(console.log("[SDK] Using custom API base URL override: ".concat(n)),{environment:t,apiConfig:$(O({},e),{baseUrl:n})}):{environment:t,apiConfig:e}}function ft(){var i;if(console.log("[SDK] detectEnvironment() called"),typeof window=="undefined")return"local";let e=new URLSearchParams(window.location.search).get("tagadaClientEnv");if(e&&(e==="production"||e==="development"||e==="local"))return console.log("[SDK] Using explicit environment override: ".concat(e)),e;try{let o=localStorage.getItem("tgd_client_env")||si("tgd_client_env");if(o&&(o==="production"||o==="development"||o==="local"))return console.log("[SDK] Using persisted environment override: ".concat(o)),o}catch(o){}let n=window.location.hostname,r=window.location.href;if(console.log('[SDK] detectEnvironment() - hostname: "'.concat(n,'"')),n==="localhost"||n.startsWith("127.")||n.startsWith("192.168.")||n.startsWith("10.")||n.includes(".local")||n===""||n==="0.0.0.0"||n.includes("ngrok-free.dev")||n.includes("ngrok-free.app")||n.includes("ngrok.io")||n.includes("ngrok.app")){if(console.log("[SDK] detectEnvironment() - returning LOCAL"),typeof window!="undefined"&&((i=window==null?void 0:window.__TAGADA_ENV__)!=null&&i.TAGADA_ENVIRONMENT)){let o=window.__TAGADA_ENV__.TAGADA_ENVIRONMENT.toLowerCase();if(o==="production"||o==="development"||o==="local")return console.log("[SDK] Local override detected: ".concat(o)),o}return"local"}return n==="app.tagadapay.com"||n.includes("tagadapay.com")||n.includes("yourproductiondomain.com")?"production":n==="app.tagadapay.dev"||n.includes("tagadapay.dev")||n.includes("vercel.app")||n.includes("netlify.app")||n.includes("surge.sh")||n.includes("github.io")||n.includes("herokuapp.com")||n.includes("railway.app")||r.includes("?env=dev")||r.includes("?dev=true")||r.includes("#dev")?"development":(console.warn("[SDK] Unknown domain: ".concat(n,", defaulting to production")),"production")}function gt(t=!1){return ft()!=="local"?!1:t&&typeof window!="undefined"?!window.location.hostname.includes(".cdn."):!0}var oi,en=Te(()=>{"use strict";oi={production:{baseUrl:"https://app.tagadapay.com",endpoints:{checkout:{sessionInit:"/api/v1/checkout/session/init",sessionInitAsync:"/api/v1/checkout/session/init-async",sessionStatus:"/api/v1/checkout/session/status",asyncStatus:"/api/public/v1/checkout/async-status"},customer:{profile:"/api/v1/customer/profile",session:"/api/v1/customer/session"},store:{config:"/api/v1/store/config"}}},development:{baseUrl:"https://app.tagadapay.dev",endpoints:{checkout:{sessionInit:"/api/v1/checkout/session/init",sessionInitAsync:"/api/v1/checkout/session/init-async",sessionStatus:"/api/v1/checkout/session/status",asyncStatus:"/api/public/v1/checkout/async-status"},customer:{profile:"/api/v1/customer/profile",session:"/api/v1/customer/session"},store:{config:"/api/v1/store/config"}}},local:{baseUrl:"http://app.localhost:3000",endpoints:{checkout:{sessionInit:"/api/v1/checkout/session/init",sessionInitAsync:"/api/v1/checkout/session/init-async",sessionStatus:"/api/v1/checkout/session/status",asyncStatus:"/api/public/v1/checkout/async-status"},customer:{profile:"/api/v1/customer/profile",session:"/api/v1/customer/session"},store:{config:"/api/v1/store/config"}}}}});var tn,Kn=Te(()=>{"use strict";tn=class{constructor(e){this.apiClient=e}async initialize(e){return this.apiClient.post("/api/v1/funnel/initialize",e)}async navigate(e){return this.apiClient.post("/api/v1/funnel/navigate",e)}async updateContext(e,n){return this.apiClient.patch("/api/v1/funnel/context/".concat(e),n)}async endSession(e){return this.apiClient.delete("/api/v1/funnel/session/".concat(e))}async getSession(e,n,r){let i=new URLSearchParams;n&&i.append("currentUrl",n),r&&i.append("includeDebugData","true");let o="/api/v1/funnel/session/".concat(e).concat(i.toString()?"?".concat(i):"");return this.apiClient.get(o)}}});var We,Vn=Te(()=>{"use strict";We=class{constructor(){this.listeners=new Set}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(e){this.listeners.forEach(n=>{try{n(e)}catch(r){console.error("Error in event listener:",r)}})}clear(){this.listeners.clear()}}});function re(t){if(typeof window!="undefined")try{let n=localStorage.getItem(nn)!==t;localStorage.setItem(nn,t),n&&window.dispatchEvent(new Event("storage"))}catch(e){console.error("Failed to save token to localStorage:",e)}}function mt(){if(typeof window!="undefined")try{return localStorage.getItem(nn)}catch(t){return console.error("Failed to get token from localStorage:",t),null}return null}function $e(){if(typeof window!="undefined")try{localStorage.removeItem(nn)}catch(t){console.error("Failed to clear token from localStorage:",t)}}var nn,ze=Te(()=>{"use strict";nn="cms_token"});function ci(t){typeof document!="undefined"&&(document.cookie="".concat(Wn,"=").concat(t,"; path=/; max-age=2592000; SameSite=Lax"))}function li(){if(typeof document=="undefined")return;let t=document.cookie.split("; ").find(e=>e.startsWith("".concat(Wn,"=")));return t?t.split("=")[1]:void 0}function rn(){typeof document!="undefined"&&(document.cookie="".concat(Wn,"=; path=/; max-age=0"))}var Wn,ht=Te(()=>{"use strict";Wn="tgd-funnel-session-id"});function Ye(t){if(typeof window=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function on(t,e){if(typeof window!="undefined")try{localStorage.setItem(t,e)}catch(n){}}function Et(t){var r;if(typeof document=="undefined")return null;let n=document.cookie.split(";").find(i=>i.trim().startsWith("".concat(t,"=")));return n?(r=n.split("=")[1])==null?void 0:r.trim():null}function $n(t,e,n=86400){if(typeof document!="undefined"){if(t==="tgd_draft"||t==="tgd-draft"){console.warn("\u{1F6E1}\uFE0F [SDK] Blocked attempt to set ".concat(t," as cookie - this should only be in localStorage"));return}document.cookie="".concat(t,"=").concat(e,"; path=/; max-age=").concat(n)}}function di(t){typeof document!="undefined"&&(document.cookie="".concat(t,"=; path=/; max-age=0"))}function Le(){if(typeof window=="undefined")return{};let t=new URLSearchParams(window.location.search),e,n=t.get("draft");if(n!==null)e=n==="true";else{let C=Ye(B.DRAFT);C!==null&&(e=C==="true")}let r,i=t.get("funnelTracking");if(i!==null)r=i!=="false";else{let C=Ye(B.FUNNEL_TRACKING)||Et(B.FUNNEL_TRACKING);C!==null&&(r=C!=="false")}let o=t.get("token")||mt()||null,s=t.get("funnelSessionId")||null,a=t.get("funnelId")||null,l,c=t.get("funnelEnv");c&&(c==="staging"||c==="production")&&(l=c);let u=t.get("forceReset")==="true",p,b=t.get("tagadaClientEnv");if(b&&(b==="production"||b==="development"||b==="local"))p=b;else{let C=Ye(B.CLIENT_ENV)||Et(B.CLIENT_ENV);C&&(C==="production"||C==="development"||C==="local")&&(p=C)}let w,f=t.get("tagadaClientBaseUrl");if(f)w=f;else{let C=Ye(B.CLIENT_BASE_URL)||Et(B.CLIENT_BASE_URL);C&&(w=C)}let I,h=t.get("currency");if(h)I=h;else{let C=Ye(B.CURRENCY)||Et(B.CURRENCY);C&&(I=C)}let R,x=t.get("locale");if(x)R=x;else{let C=Ye(B.LOCALE)||Et(B.LOCALE);C&&(R=C)}return{forceReset:u,token:o,funnelSessionId:s,funnelId:a,draft:e,funnelTracking:r,funnelEnv:l,tagadaClientEnv:p,tagadaClientBaseUrl:w,currency:I,locale:R}}function yt(){var e;return(e=Le().draft)!=null?e:!1}function zn(t){if(typeof window!="undefined")if(t)on(B.DRAFT,"true");else try{localStorage.removeItem(B.DRAFT)}catch(e){}}function pi(t=!1){let e=null;typeof window!="undefined"&&(e=new URLSearchParams(window.location.search).get("token"));let n=Le(),r=n.forceReset||!1;if(!r&&!n.token)return ui(),!1;t&&(console.log("[SDK] Detected params:",n),console.log("[SDK] URL token (direct read):",e?e.substring(0,20)+"...":"none")),r&&(t&&console.log("[SDK] Force reset: Clearing all stored state"),$e(),rn(),typeof window!="undefined"&&window.localStorage&&Object.keys(localStorage).forEach(s=>{(s.startsWith("tagadapay_")||s.startsWith("tgd_"))&&(t&&console.log("[SDK] Clearing localStorage: ".concat(s)),localStorage.removeItem(s))}));let i=e||n.token;return i!=null?(t&&console.log("[SDK] Setting token from URL:",i.substring(0,20)+"..."),i===""||i==="null"?$e():(re(i),t&&console.log("[SDK] \u2705 Token set in localStorage immediately after clear"))):r&&(t&&console.log("[SDK] Force reset mode (no token in URL)"),$e()),ui(),n.funnelSessionId&&t&&console.log("[SDK] Using funnelSessionId from URL:",n.funnelSessionId),r}function ui(){if(typeof window=="undefined")return;let t=new URLSearchParams(window.location.search),e=t.get("draft");e!==null&&zn(e==="true");let n=t.get("funnelTracking");n!==null&&hs(n!=="false");let r=t.get("tagadaClientEnv");r&&(r==="production"||r==="development"||r==="local")&&Es(r);let i=t.get("tagadaClientBaseUrl");i&&ys(i)}function hs(t){if(typeof window=="undefined")return;let e=t?"true":"false";on(B.FUNNEL_TRACKING,e),$n(B.FUNNEL_TRACKING,e,86400)}function Es(t){typeof window!="undefined"&&(on(B.CLIENT_ENV,t),$n(B.CLIENT_ENV,t,86400))}function fi(){if(typeof window!="undefined")try{localStorage.removeItem(B.CLIENT_ENV),di(B.CLIENT_ENV)}catch(t){}}function ys(t){typeof window!="undefined"&&(on(B.CLIENT_BASE_URL,t),$n(B.CLIENT_BASE_URL,t,86400))}function gi(){if(typeof window!="undefined")try{localStorage.removeItem(B.CLIENT_BASE_URL),di(B.CLIENT_BASE_URL)}catch(t){}}function mi(){var e;return(e=Le().funnelTracking)!=null?e:!0}var B,sn=Te(()=>{"use strict";ze();ht();B={DRAFT:"tgd_draft",FUNNEL_TRACKING:"tgd_funnel_tracking",FORCE_RESET:"tgd_force_reset",CLIENT_ENV:"tgd_client_env",CLIENT_BASE_URL:"tgd_client_base_url",CURRENCY:"tgd_currency",LOCALE:"tgd_locale"}});function Yn(t){if(typeof window=="undefined"||typeof document=="undefined")return;let e=window.location.hostname,n=e.split("."),r=["",e,"."+e];for(let a=1;a<n.length;a++){let l=n.slice(a).join(".");r.push(l),r.push("."+l)}let i=window.location.pathname.split("/").filter(a=>a),o=["/"],s="";i.forEach(a=>{s+="/"+a,o.push(s)}),r.forEach(a=>{o.forEach(l=>{let c="".concat(t,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=").concat(l),u=a?"; domain=".concat(a):"";document.cookie=c+u,document.cookie=c+u+"; secure",document.cookie=c+u+"; SameSite=None; secure",document.cookie=c+u+"; SameSite=Lax",document.cookie=c+u+"; SameSite=Strict"})})}function ws(){if(typeof window=="undefined"||!confirm("\u{1F6AA} Leave Preview Mode?\n\nThis will clear ALL cookies and localStorage (including Shopify session, cart, and preview settings) and reload the page.\n\nAre you sure?"))return;let e=new URL(window.location.href);["draft","funnelEnv","funnelTracking","tagadaClientEnv","tagadaClientBaseUrl","forceReset","funnelId","funnelSessionId","token"].forEach(o=>e.searchParams.delete(o)),window.history.replaceState({},"",e.href);try{let o=Object.getOwnPropertyDescriptor(Document.prototype,"cookie")||Object.getOwnPropertyDescriptor(HTMLDocument.prototype,"cookie");o&&o.set&&Object.defineProperty(document,"cookie",{configurable:!0,enumerable:!0,get:function(){return o.get?o.get.call(this):""},set:function(s){if(typeof s=="string"){let a=s.toLowerCase();if(a.includes("tgd_draft")||a.includes("tgd-draft")||a.includes("tgd.draft")||a.includes("tgddraft")){if(a.includes("max-age=0")||a.includes("expires=thu, 01 jan 1970")){o.set&&o.set.call(this,s);return}console.warn("\u{1F6E1}\uFE0F [TagadaPay] BLOCKED: tgd_draft should never be a cookie");return}}o.set&&o.set.call(this,s)}})}catch(o){console.warn("[TagadaPay] Could not install cookie blocker:",o)}if(window.localStorage)try{localStorage.removeItem("tgd_draft"),localStorage.removeItem("tgd_funnel_tracking"),localStorage.removeItem("tgd_client_env"),localStorage.removeItem("tgd_client_base_url"),localStorage.removeItem("cms_token")}catch(o){console.warn("[TagadaPay] Failed to clear some localStorage keys:",o)}$e(),rn(),fi(),gi(),window.localStorage&&localStorage.clear(),window.sessionStorage&&sessionStorage.clear(),["tgd-funnel-session-id","tgd_draft","tgd_funnel_tracking","tgd_client_env","tgd_client_base_url","cms_token","tagadapay_session"].forEach(o=>Yn(o)),["tgd-draft","tgd_draft","tgd.draft","tgddraft"].forEach(o=>Yn(o)),document.cookie&&document.cookie.split(";").forEach(s=>{let a=s.split("=")[0].trim();if(!a)return;let l=window.location.hostname,c=l.split("."),u=["",l,"."+l];for(let f=1;f<c.length;f++){let I=c.slice(f).join(".");u.push(I),u.push("."+I)}let p=window.location.pathname.split("/").filter(f=>f),b=["/"],w="";p.forEach(f=>{w+="/"+f,b.push(w)}),u.forEach(f=>{b.forEach(I=>{let h="".concat(a,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=").concat(I),R=f?"; domain=".concat(f):"";document.cookie=h+R,document.cookie=h+R+"; secure",document.cookie=h+R+"; SameSite=None; secure",document.cookie=h+R+"; SameSite=Lax",document.cookie=h+R+"; SameSite=Strict",document.cookie=h+R+"; secure; SameSite=None",document.cookie=h+R+"; secure; SameSite=Lax",document.cookie=h+R+"; secure; SameSite=Strict"})})}),setTimeout(()=>{window.localStorage&&localStorage.length>0&&localStorage.clear(),Yn("tgd_draft"),typeof window.stop=="function"&&window.stop(),window.location.replace(e.href)},10)}function jn(){if(hi||typeof window=="undefined"||typeof document=="undefined")return;let t=Le(),e=yt(),n=!mi(),r=!!(t.tagadaClientEnv||t.tagadaClientBaseUrl);if(!e&&!n&&!r)return;let i=document.createElement("div");i.id="tgd-preview-indicator",i.style.cssText='\n position: fixed;\n bottom: 16px;\n right: 16px;\n z-index: 999999;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n ';let o=document.createElement("div");o.style.cssText="\n background: ".concat(e?"#ff9500":"#007aff",";\n color: white;\n padding: 8px 12px;\n border-radius: 8px;\n font-size: 13px;\n font-weight: 600;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n cursor: pointer;\n transition: all 0.2s ease;\n display: flex;\n align-items: center;\n gap: 6px;\n "),o.innerHTML='\n <span style="font-size: 16px;">\u{1F50D}</span>\n <span>'.concat(e?"Preview Mode":"Dev Mode","</span>\n ");let s=document.createElement("div");s.style.cssText="\n position: absolute;\n bottom: calc(100% + 8px);\n right: 0;\n background: white;\n border: 1px solid #e5e5e5;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n padding: 12px;\n min-width: 250px;\n font-size: 12px;\n line-height: 1.5;\n display: none;\n ",s.style.paddingTop="20px";let a=document.createElement("div");a.style.cssText="\n position: absolute;\n bottom: 100%;\n left: 0;\n right: 0;\n height: 8px;\n display: none;\n ";let l='<div style="margin-bottom: 8px; font-weight: 600; color: #1d1d1f;">Current Environment</div>';l+='<div style="display: flex; flex-direction: column; gap: 6px;">',e&&(l+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>Draft Mode:</span>\n <span style="color: #ff9500; font-weight: 600;">ON</span>\n </div>\n '),n&&(l+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>Tracking:</span>\n <span style="color: #ff3b30; font-weight: 600;">DISABLED</span>\n </div>\n '),t.funnelEnv&&(l+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>Funnel Env:</span>\n <span style="color: #1d1d1f; font-weight: 600; font-family: monospace; font-size: 11px;">\n '.concat(t.funnelEnv,"\n </span>\n </div>\n ")),t.tagadaClientEnv&&(l+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>API Env:</span>\n <span style="color: #1d1d1f; font-weight: 600; font-family: monospace; font-size: 11px;">\n '.concat(t.tagadaClientEnv,"\n </span>\n </div>\n ")),t.tagadaClientBaseUrl&&(l+='\n <div style="color: #86868b;">\n <div style="margin-bottom: 4px;">API URL:</div>\n <div style="color: #1d1d1f; font-weight: 600; font-family: monospace; font-size: 10px; word-break: break-all; background: #f5f5f7; padding: 4px 6px; border-radius: 4px;">\n '.concat(t.tagadaClientBaseUrl,"\n </div>\n </div>\n ")),t.funnelId&&(l+='\n <div style="color: #86868b; margin-top: 4px; padding-top: 8px; border-top: 1px solid #e5e5e5;">\n <div style="margin-bottom: 4px;">Funnel ID:</div>\n <div style="color: #1d1d1f; font-family: monospace; font-size: 10px; word-break: break-all; background: #f5f5f7; padding: 4px 6px; border-radius: 4px;">\n '.concat(t.funnelId,"\n </div>\n </div>\n ")),l+="</div>",l+='\n <div style="margin-top: 12px; padding-top: 8px; border-top: 1px solid #e5e5e5; font-size: 11px; color: #86868b; text-align: center;">\n Add <code style="background: #f5f5f7; padding: 2px 4px; border-radius: 3px;">?forceReset=true</code> to reset\n </div>\n ',l+='\n <div style="margin-top: 12px; padding-top: 8px; border-top: 1px solid #e5e5e5;">\n <button id="tgd-leave-preview" style="\n background: #ff3b30;\n color: white;\n border: none;\n border-radius: 6px;\n padding: 10px 12px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n transition: opacity 0.2s;\n width: 100%;\n ">\n \u{1F6AA} Leave Preview Mode\n </button>\n </div>\n ',s.innerHTML=l;let c=!1,u=()=>{c=!0,s.style.display="block",a.style.display="block"},p=()=>{c=!1,setTimeout(()=>{c||(s.style.display="none",a.style.display="none")},100)};o.addEventListener("mouseenter",u),o.addEventListener("mouseleave",p),a.addEventListener("mouseenter",u),a.addEventListener("mouseleave",p),s.addEventListener("mouseenter",u),s.addEventListener("mouseleave",p);let b=s.querySelector("#tgd-leave-preview");b&&(b.addEventListener("mouseenter",()=>{b.style.opacity="0.8"}),b.addEventListener("mouseleave",()=>{b.style.opacity="1"}),b.addEventListener("click",w=>{w.stopPropagation(),ws()})),i.appendChild(o),i.appendChild(a),i.appendChild(s),document.body.appendChild(i),As=i,hi=!0}var As,hi,Ei=Te(()=>{"use strict";sn();ze();ht();As=null,hi=!1});var bi={};Gn(bi,{FunnelClient:()=>wt,TrackingProvider:()=>Ai,getAssignedPaymentFlowId:()=>Rs,getAssignedPixels:()=>vs,getAssignedScripts:()=>Ps,getAssignedStaticResources:()=>Os,getAssignedStepConfig:()=>De,getLocalFunnelConfig:()=>wi,loadLocalFunnelConfig:()=>Cs});function Ss(){if(typeof window!="undefined"){if(window.__TGD_FUNNEL_ID__)return window.__TGD_FUNNEL_ID__;if(typeof document!="undefined"){let t=document.querySelector('meta[name="x-funnel-id"]');return(t==null?void 0:t.getAttribute("content"))||void 0}}}function an(){if(typeof window!="undefined"){if(window.__TGD_FUNNEL_VARIANT_ID__)return window.__TGD_FUNNEL_VARIANT_ID__;if(typeof document!="undefined"){let t=document.querySelector('meta[name="x-funnel-variant-id"]');return(t==null?void 0:t.getAttribute("content"))||void 0}}}function At(){if(typeof window!="undefined"){if(window.__TGD_FUNNEL_STEP_ID__)return window.__TGD_FUNNEL_STEP_ID__;if(typeof document!="undefined"){let t=document.querySelector('meta[name="x-funnel-step-id"]');return(t==null?void 0:t.getAttribute("content"))||void 0}}}function yi(t){if(!t||typeof t!="string")return;let e=t.trim();if(!e)return;let n=[()=>JSON.parse(e),()=>JSON.parse(decodeURIComponent(e)),()=>JSON.parse(decodeURIComponent(decodeURIComponent(e)))];for(let r of n)try{let i=r();if(i&&typeof i=="object")return i}catch(i){}typeof console!="undefined"&&console.warn("[SDK] Failed to parse stepConfig:",e.substring(0,100))}function Is(){if(typeof window=="undefined")return!1;let t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t.endsWith(".localhost")&&!t.includes(".cdn.")}async function Cs(){if(!Is())return null;if(ie!==void 0)return ie;if(qn)return await new Promise(t=>setTimeout(t,100)),ie!=null?ie:null;qn=!0;try{console.log("\u{1F6E0}\uFE0F [SDK] Loading local funnel config from /config/funnel.local.json...");let t=await fetch("/config/funnel.local.json");if(!t.ok)return console.log("\u{1F6E0}\uFE0F [SDK] funnel.local.json not found (this is fine in production)"),ie=null,null;let e=await t.json();return console.log("\u{1F6E0}\uFE0F [SDK] \u2705 Loaded local funnel config:",e),ie=e,e}catch(t){return console.log("\u{1F6E0}\uFE0F [SDK] funnel.local.json not available:",t),ie=null,null}finally{qn=!1}}function wi(){return ie!=null?ie:null}function Ts(t){return{payment:t.paymentFlowId?{paymentFlowId:t.paymentFlowId}:void 0,staticResources:t.staticResources,scripts:t.scripts,pixels:t.pixels}}function De(){if(typeof window=="undefined")return;let t=wi();if(t)return console.log("\u{1F6E0}\uFE0F [SDK] Using local funnel.local.json (overrides injected)"),Ts(t);let e=window.__TGD_STEP_CONFIG__;if(e){let n=yi(e);if(n)return n}if(typeof document!="undefined"){let n=document.querySelector('meta[name="x-step-config"]'),r=n==null?void 0:n.getAttribute("content");if(r){let i=yi(r);if(i)return i}}}function Rs(){var e;let t=De();if((e=t==null?void 0:t.payment)!=null&&e.paymentFlowId)return t.payment.paymentFlowId;if(typeof window!="undefined"){if(window.__TGD_PAYMENT_FLOW_ID__)return window.__TGD_PAYMENT_FLOW_ID__;if(typeof document!="undefined"){let n=document.querySelector('meta[name="x-payment-flow-id"]');return(n==null?void 0:n.getAttribute("content"))||void 0}}}function Os(){let t=De();return t==null?void 0:t.staticResources}function Ps(t){let e=De();if(!(e!=null&&e.scripts))return;let n=e.scripts.filter(r=>r.enabled);return t&&(n=n.filter(r=>r.position===t||!r.position&&t==="head-end")),n.length>0?n:void 0}function vs(){let t=De(),e=t==null?void 0:t.pixels;if(!e||typeof e!="object")return;let n={};for(let[r,i]of Object.entries(e))i&&(Array.isArray(i)?n[r]=i:typeof i=="object"&&(n[r]=[i]));return Object.keys(n).length>0?n:void 0}var Ai,ie,qn,wt,cn=Te(()=>{"use strict";en();Kn();Vn();sn();Ei();ht();Ai=(o=>(o.FACEBOOK="facebook",o.TIKTOK="tiktok",o.SNAPCHAT="snapchat",o.PINTEREST="pinterest",o.GTM="gtm",o))(Ai||{});qn=!1;wt=class{constructor(e){this.eventDispatcher=new We;this.isInitializing=!1;this.initializationAttempted=!1;this.config=e,this.resource=new tn(e.apiClient),this.state={context:null,isLoading:!1,isInitialized:!1,isNavigating:!1,error:null,sessionError:null}}setConfig(e){this.config=O(O({},this.config),e)}subscribe(e){return this.eventDispatcher.subscribe(e)}getState(){return this.state}getDetectedSessionId(){var r;if((r=this.state.context)!=null&&r.sessionId)return this.state.context.sessionId;if(typeof window=="undefined")return null;let n=new URLSearchParams(window.location.search).get("funnelSessionId");return n||li()||null}resetInitialization(){this.initializationAttempted=!1,this.isInitializing=!1,this.updateState({context:null,isInitialized:!1})}async autoInitialize(e,n,r){if(this.state.context)return this.state.context;if(this.isInitializing||this.initializationAttempted)return null;this.initializationAttempted=!0,this.isInitializing=!0,this.updateState({isLoading:!0,error:null});try{let i=this.getDetectedSessionId(),a=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("funnelId")||r,l=Ss(),c=an(),u=At(),p=Le(),b=this.config.funnelId||l||a,w=this.config.stepId||u,f=typeof window!="undefined"?new URLSearchParams(window.location.search):null,I=f==null?void 0:f.get("funnelEnv");this.config.debugMode&&console.log("\u{1F680} [FunnelClient] Auto-initializing...",{existingSessionId:i,effectiveFunnelId:b,funnelVariantId:c,funnelStepId:w,draft:p.draft,funnelTracking:p.funnelTracking,funnelEnv:I,tagadaClientEnv:p.tagadaClientEnv,tagadaClientBaseUrl:p.tagadaClientBaseUrl,source:{funnelId:this.config.funnelId?"config":l?"injected":a?"url/prop":"none",stepId:this.config.stepId?"config":u?"injected":"none"}});let h=await this.resource.initialize({cmsSession:{customerId:e.customerId,sessionId:e.sessionId,storeId:n.id,accountId:n.accountId},funnelId:b,existingSessionId:i||void 0,currentUrl:typeof window!="undefined"?window.location.href:void 0,funnelVariantId:c,funnelStepId:w,draft:p.draft,funnelTracking:p.funnelTracking,funnelEnv:I||void 0,tagadaClientEnv:p.tagadaClientEnv,tagadaClientBaseUrl:p.tagadaClientBaseUrl,currency:p.currency,locale:p.locale});if(h.success&&h.context){let R=this.enrichContext(h.context);return this.handleSessionSuccess(R),jn(),R}else throw new Error(h.error||"Failed to initialize funnel session")}catch(i){let o=i instanceof Error?i:new Error(String(i));throw this.updateState({error:o,isLoading:!1}),this.config.debugMode&&console.error("\u274C [FunnelClient] Init failed:",o),o}finally{this.isInitializing=!1}}async initialize(e,n,r,i){this.updateState({isLoading:!0,error:null});try{let o=an(),s=At();this.config.debugMode&&(o&&console.log("\u{1F3AF} [FunnelClient] Detected A/B test variant:",o),s&&console.log("\u{1F3AF} [FunnelClient] Detected step ID:",s));let a=await this.resource.initialize({cmsSession:{customerId:e.customerId,sessionId:e.sessionId,storeId:n.id,accountId:n.accountId},funnelId:r,entryStepId:i,currentUrl:typeof window!="undefined"?window.location.href:void 0,funnelVariantId:o,funnelStepId:s});if(a.success&&a.context){let l=this.enrichContext(a.context);return this.handleSessionSuccess(l),jn(),l}else throw new Error(a.error||"Failed to initialize")}catch(o){let s=o instanceof Error?o:new Error(String(o));throw this.updateState({error:s,isLoading:!1}),s}}async navigate(e,n){var r,i,o,s,a,l;if(n!=null&&n.waitForSession&&!((r=this.state.context)!=null&&r.sessionId)){this.config.debugMode&&console.log("\u23F3 [FunnelClient] Waiting for session before navigation...");let c=5e3,u=Date.now();for(;!((i=this.state.context)!=null&&i.sessionId)&&Date.now()-u<c;)await new Promise(p=>setTimeout(p,100));(o=this.state.context)!=null&&o.sessionId&&this.config.debugMode&&console.log("\u2705 [FunnelClient] Session ready, proceeding with navigation")}if(!((s=this.state.context)!=null&&s.sessionId))throw new Error("No active session");this.updateState({isNavigating:!0,isLoading:!0});try{let c=an(),u=At(),p=typeof window!="undefined"?window.location.href:void 0;!u&&this.config.stepId&&(u=this.config.stepId,this.config.debugMode&&console.log("\u{1F50D} [FunnelClient.navigate] Using stepId from config (no injection):",u)),!c&&this.config.variantId&&(c=this.config.variantId,this.config.debugMode&&console.log("\u{1F50D} [FunnelClient.navigate] Using variantId from config (no injection):",c)),this.config.debugMode&&console.log("\u{1F50D} [FunnelClient.navigate] Sending to backend:",{sessionId:this.state.context.sessionId,currentUrl:p,funnelStepId:u||"(not found)",funnelVariantId:c||"(not found)",hasInjectedStepId:!!At(),hasInjectedVariantId:!!an(),usedConfigFallback:!At()&&!!this.config.stepId,customerTags:(n==null?void 0:n.customerTags)||"(none)",deviceId:(n==null?void 0:n.deviceId)||"(none)"});let b=(n==null?void 0:n.fireAndForget)||!1,w=await this.resource.navigate({sessionId:this.state.context.sessionId,event:e,currentUrl:p,funnelStepId:u,funnelVariantId:c,fireAndForget:b,customerTags:n==null?void 0:n.customerTags,deviceId:n==null?void 0:n.deviceId});if(!w.success||!w.result)throw new Error(w.error||"Navigation failed");let f=w.result;if(f.queued)return this.updateState({isNavigating:!1,isLoading:!1}),f.sessionId&&f.sessionId!==((a=this.state.context)==null?void 0:a.sessionId)&&(this.config.debugMode&&console.log("\u{1F525} [FunnelClient] Session ID updated: ".concat((l=this.state.context)==null?void 0:l.sessionId," \u2192 ").concat(f.sessionId)),this.state.context&&(this.state.context.sessionId=f.sessionId)),this.config.debugMode&&console.log("\u{1F525} [FunnelClient] Navigation queued (fire-and-forget mode)"),f;let I=(n==null?void 0:n.autoRedirect)!==void 0?n.autoRedirect:this.config.autoRedirect!==!1;return I||(this.config.debugMode&&console.log("\u{1F504} [FunnelClient] Refreshing session (no auto-redirect)"),await this.refreshSession()),this.updateState({isNavigating:!1,isLoading:!1}),I&&(f!=null&&f.url)&&typeof window!="undefined"&&(this.config.debugMode&&console.log("\u{1F680} [FunnelClient] Auto-redirecting to:",f.url,"(skipped session refresh - next page will initialize)"),window.location.href=f.url),f}catch(c){let u=c instanceof Error?c:new Error(String(c));throw this.updateState({error:u,isNavigating:!1,isLoading:!1}),u}}async goToStep(e,n){return this.navigate({type:"direct_navigation",data:{targetStepId:e}},n)}async refreshSession(){var e;if((e=this.state.context)!=null&&e.sessionId)try{let n=await this.resource.getSession(this.state.context.sessionId);if(n.success&&n.context){let r=this.enrichContext(n.context);return this.updateState({context:r,sessionError:null}),r}}catch(n){this.updateState({sessionError:n instanceof Error?n:new Error(String(n))})}}async updateContext(e){var n;if(!((n=this.state.context)!=null&&n.sessionId))throw new Error("No active session");this.updateState({isLoading:!0});try{let r=await this.resource.updateContext(this.state.context.sessionId,{contextUpdates:e});if(r.success)await this.refreshSession();else throw new Error(r.error||"Failed to update context")}finally{this.updateState({isLoading:!1})}}async endSession(){var e;if((e=this.state.context)!=null&&e.sessionId)try{await this.resource.endSession(this.state.context.sessionId)}finally{this.state.context=null,this.updateState({context:null,isInitialized:!1})}}updateState(e){this.state=O(O({},this.state),e),this.eventDispatcher.notify(this.state)}handleSessionSuccess(e){ci(e.sessionId),this.updateState({context:e,isLoading:!1,isInitialized:!0,error:null,sessionError:null})}enrichContext(e){var s,a;if((((s=this.config.environment)==null?void 0:s.environment)||ft())!=="local")return e;let r=((a=this.config.pluginConfig)==null?void 0:a.staticResources)||{};if(Object.keys(r).length===0)return e;let i=e.static||{};return Object.keys(r).every(l=>i[l]===r[l])&&Object.keys(i).length===Object.keys(r).length?e:$(O({},e),{static:O(O({},r),i)})}}});var Qo=fs(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.PathError=ce.TokenData=void 0;ce.parse=zr;ce.compile=Cc;ce.match=Rc;ce.pathToRegexp=Xo;ce.stringify=vc;var Vr="/",Wr=t=>t,jo=new RegExp("^[$_\\p{ID_Start}]$","u"),$r=new RegExp("^[$\\u200c\\u200d\\p{ID_Continue}]$","u"),Sc={"{":"{","}":"}","(":"(",")":")","[":"[","]":"]","+":"+","?":"?","!":"!"};function Ic(t){return t.replace(/[{}()\[\]+?!:*\\]/g,"\\$&")}function Ee(t){return t.replace(/[.+*?^${}()[\]|/\\]/g,"\\$&")}var Mn=class{constructor(e,n){this.tokens=e,this.originalPath=n}};ce.TokenData=Mn;var Ge=class extends TypeError{constructor(e,n){let r=e;n&&(r+=": ".concat(n)),r+="; visit https://git.new/pathToRegexpError for info",super(r),this.originalPath=n}};ce.PathError=Ge;function zr(t,e={}){let{encodePath:n=Wr}=e,r=[...t],i=[],o=0,s=0;function a(){let c="";if(jo.test(r[o]))do c+=r[o++];while($r.test(r[o]));else if(r[o]==='"'){let u=o;for(;o++<r.length;){if(r[o]==='"'){o++,u=0;break}r[o]==="\\"&&o++,c+=r[o]}if(u)throw new Ge("Unterminated quote at index ".concat(u),t)}if(!c)throw new Ge("Missing parameter name at index ".concat(o),t);return c}for(;o<r.length;){let c=r[o],u=Sc[c];u?i.push({type:u,index:o++,value:c}):c==="\\"?i.push({type:"escape",index:o++,value:r[o++]}):c===":"?i.push({type:"param",index:o++,value:a()}):c==="*"?i.push({type:"wildcard",index:o++,value:a()}):i.push({type:"char",index:o++,value:c})}i.push({type:"end",index:o,value:""});function l(c){let u=[];for(;;){let p=i[s++];if(p.type===c)break;if(p.type==="char"||p.type==="escape"){let b=p.value,w=i[s];for(;w.type==="char"||w.type==="escape";)b+=w.value,w=i[++s];u.push({type:"text",value:n(b)});continue}if(p.type==="param"||p.type==="wildcard"){u.push({type:p.type,name:p.value});continue}if(p.type==="{"){u.push({type:"group",tokens:l("}")});continue}throw new Ge("Unexpected ".concat(p.type," at index ").concat(p.index,", expected ").concat(c),t)}return u}return new Mn(l("end"),t)}function Cc(t,e={}){let{encode:n=encodeURIComponent,delimiter:r=Vr}=e,i=typeof t=="object"?t:zr(t,e),o=qo(i.tokens,r,n);return function(a={}){let[l,...c]=o(a);if(c.length)throw new TypeError("Missing parameters: ".concat(c.join(", ")));return l}}function qo(t,e,n){let r=t.map(i=>Tc(i,e,n));return i=>{let o=[""];for(let s of r){let[a,...l]=s(i);o[0]+=a,o.push(...l)}return o}}function Tc(t,e,n){if(t.type==="text")return()=>[t.value];if(t.type==="group"){let i=qo(t.tokens,e,n);return o=>{let[s,...a]=i(o);return a.length?[""]:[s]}}let r=n||Wr;return t.type==="wildcard"&&n!==!1?i=>{let o=i[t.name];if(o==null)return["",t.name];if(!Array.isArray(o)||o.length===0)throw new TypeError('Expected "'.concat(t.name,'" to be a non-empty array'));return[o.map((s,a)=>{if(typeof s!="string")throw new TypeError('Expected "'.concat(t.name,"/").concat(a,'" to be a string'));return r(s)}).join(e)]}:i=>{let o=i[t.name];if(o==null)return["",t.name];if(typeof o!="string")throw new TypeError('Expected "'.concat(t.name,'" to be a string'));return[r(o)]}}function Rc(t,e={}){let{decode:n=decodeURIComponent,delimiter:r=Vr}=e,{regexp:i,keys:o}=Xo(t,e),s=o.map(a=>n===!1?Wr:a.type==="param"?n:l=>l.split(r).map(n));return function(l){let c=i.exec(l);if(!c)return!1;let u=c[0],p=Object.create(null);for(let b=1;b<c.length;b++){if(c[b]===void 0)continue;let w=o[b-1],f=s[b-1];p[w.name]=f(c[b])}return{path:u,params:p}}}function Xo(t,e={}){let{delimiter:n=Vr,end:r=!0,sensitive:i=!1,trailing:o=!0}=e,s=[],a=i?"":"i",l=[];for(let p of Jo(t,[])){let b=typeof p=="object"?p:zr(p,e);for(let w of Bn(b.tokens,0,[]))l.push(Oc(w,n,s,b.originalPath))}let c="^(?:".concat(l.join("|"),")");return o&&(c+="(?:".concat(Ee(n),"$)?")),c+=r?"$":"(?=".concat(Ee(n),"|$)"),{regexp:new RegExp(c,a),keys:s}}function Jo(t,e){if(Array.isArray(t))for(let n of t)Jo(n,e);else e.push(t);return e}function*Bn(t,e,n){if(e===t.length)return yield n;let r=t[e];if(r.type==="group")for(let i of Bn(r.tokens,0,n.slice()))yield*Ve(Bn(t,e+1,i));else n.push(r);yield*Ve(Bn(t,e+1,n))}function Oc(t,e,n,r){let i="",o="",s=!0;for(let a of t){if(a.type==="text"){i+=Ee(a.value),o+=a.value,s||(s=a.value.includes(e));continue}if(a.type==="param"||a.type==="wildcard"){if(!s&&!o)throw new Ge('Missing text before "'.concat(a.name,'" ').concat(a.type),r);a.type==="param"?i+="(".concat(Pc(e,s?"":o),"+)"):i+="([\\s\\S]+)",n.push(a),o="",s=!1;continue}}return i}function Pc(t,e){return e.length<2?t.length<2?"[^".concat(Ee(t+e),"]"):"(?:(?!".concat(Ee(t),")[^").concat(Ee(e),"])"):t.length<2?"(?:(?!".concat(Ee(e),")[^").concat(Ee(t),"])"):"(?:(?!".concat(Ee(e),"|").concat(Ee(t),")[\\s\\S])")}function Zo(t){let e="",n=0;function r(i){return xc(i)&&Nc(t[n])?i:JSON.stringify(i)}for(;n<t.length;){let i=t[n++];if(i.type==="text"){e+=Ic(i.value);continue}if(i.type==="group"){e+="{".concat(Zo(i.tokens),"}");continue}if(i.type==="param"){e+=":".concat(r(i.name));continue}if(i.type==="wildcard"){e+="*".concat(r(i.name));continue}throw new TypeError("Unknown token type: ".concat(i.type))}return e}function vc(t){return Zo(t.tokens)}function xc(t){let[e,...n]=t;return jo.test(e)&&n.every(r=>$r.test(r))}function Nc(t){return t&&t.type==="text"?!$r.test(t.value[0]):!0}});var Gc={};Gn(Gc,{TRACKER_VERSION:()=>qr,TagadaExternalTracker:()=>Zt,TagadaTracker:()=>jr});en();cn();function bt(t,e){return function(){return t.apply(e,arguments)}}var{toString:xs}=Object.prototype,{getPrototypeOf:Jn}=Object,{iterator:un,toStringTag:Ii}=Symbol,dn=(t=>e=>{let n=xs.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),oe=t=>(t=t.toLowerCase(),e=>dn(e)===t),pn=t=>e=>typeof e===t,{isArray:qe}=Array,je=pn("undefined");function St(t){return t!==null&&!je(t)&&t.constructor!==null&&!je(t.constructor)&&J(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var Ci=oe("ArrayBuffer");function Ns(t){let e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ci(t.buffer),e}var _s=pn("string"),J=pn("function"),Ti=pn("number"),It=t=>t!==null&&typeof t=="object",ks=t=>t===!0||t===!1,ln=t=>{if(dn(t)!=="object")return!1;let e=Jn(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Ii in t)&&!(un in t)},Ls=t=>{if(!It(t)||St(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch(e){return!1}},Ds=oe("Date"),Bs=oe("File"),Ms=oe("Blob"),Us=oe("FileList"),Fs=t=>It(t)&&J(t.pipe),Gs=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||J(t.append)&&((e=dn(t))==="formdata"||e==="object"&&J(t.toString)&&t.toString()==="[object FormData]"))},Hs=oe("URLSearchParams"),[Ks,Vs,Ws,$s]=["ReadableStream","Request","Response","Headers"].map(oe),zs=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ct(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t=="undefined")return;let r,i;if(typeof t!="object"&&(t=[t]),qe(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{if(St(t))return;let o=n?Object.getOwnPropertyNames(t):Object.keys(t),s=o.length,a;for(r=0;r<s;r++)a=o[r],e.call(null,t[a],a,t)}}function Ri(t,e){if(St(t))return null;e=e.toLowerCase();let n=Object.keys(t),r=n.length,i;for(;r-- >0;)if(i=n[r],e===i.toLowerCase())return i;return null}var Be=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,Oi=t=>!je(t)&&t!==Be;function Xn(){let{caseless:t,skipUndefined:e}=Oi(this)&&this||{},n={},r=(i,o)=>{let s=t&&Ri(n,o)||o;ln(n[s])&&ln(i)?n[s]=Xn(n[s],i):ln(i)?n[s]=Xn({},i):qe(i)?n[s]=i.slice():(!e||!je(i))&&(n[s]=i)};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&Ct(arguments[i],r);return n}var Ys=(t,e,n,{allOwnKeys:r}={})=>(Ct(e,(i,o)=>{n&&J(i)?t[o]=bt(i,n):t[o]=i},{allOwnKeys:r}),t),js=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),qs=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Xs=(t,e,n,r)=>{let i,o,s,a={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],(!r||r(s,t,e))&&!a[s]&&(e[s]=t[s],a[s]=!0);t=n!==!1&&Jn(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Js=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;let r=t.indexOf(e,n);return r!==-1&&r===n},Zs=t=>{if(!t)return null;if(qe(t))return t;let e=t.length;if(!Ti(e))return null;let n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Qs=(t=>e=>t&&e instanceof t)(typeof Uint8Array!="undefined"&&Jn(Uint8Array)),ea=(t,e)=>{let r=(t&&t[un]).call(t),i;for(;(i=r.next())&&!i.done;){let o=i.value;e.call(t,o[0],o[1])}},ta=(t,e)=>{let n,r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},na=oe("HTMLFormElement"),ra=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),Si=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),ia=oe("RegExp"),Pi=(t,e)=>{let n=Object.getOwnPropertyDescriptors(t),r={};Ct(n,(i,o)=>{let s;(s=e(i,o,t))!==!1&&(r[o]=s||i)}),Object.defineProperties(t,r)},oa=t=>{Pi(t,(e,n)=>{if(J(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let r=t[n];if(J(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},sa=(t,e)=>{let n={},r=i=>{i.forEach(o=>{n[o]=!0})};return qe(t)?r(t):r(String(t).split(e)),n},aa=()=>{},ca=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function la(t){return!!(t&&J(t.append)&&t[Ii]==="FormData"&&t[un])}var ua=t=>{let e=new Array(10),n=(r,i)=>{if(It(r)){if(e.indexOf(r)>=0)return;if(St(r))return r;if(!("toJSON"in r)){e[i]=r;let o=qe(r)?[]:{};return Ct(r,(s,a)=>{let l=n(s,i+1);!je(l)&&(o[a]=l)}),e[i]=void 0,o}}return r};return n(t,0)},da=oe("AsyncFunction"),pa=t=>t&&(It(t)||J(t))&&J(t.then)&&J(t.catch),vi=((t,e)=>t?setImmediate:e?((n,r)=>(Be.addEventListener("message",({source:i,data:o})=>{i===Be&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),Be.postMessage(n,"*")}))("axios@".concat(Math.random()),[]):n=>setTimeout(n))(typeof setImmediate=="function",J(Be.postMessage)),fa=typeof queueMicrotask!="undefined"?queueMicrotask.bind(Be):typeof process!="undefined"&&process.nextTick||vi,ga=t=>t!=null&&J(t[un]),d={isArray:qe,isArrayBuffer:Ci,isBuffer:St,isFormData:Gs,isArrayBufferView:Ns,isString:_s,isNumber:Ti,isBoolean:ks,isObject:It,isPlainObject:ln,isEmptyObject:Ls,isReadableStream:Ks,isRequest:Vs,isResponse:Ws,isHeaders:$s,isUndefined:je,isDate:Ds,isFile:Bs,isBlob:Ms,isRegExp:ia,isFunction:J,isStream:Fs,isURLSearchParams:Hs,isTypedArray:Qs,isFileList:Us,forEach:Ct,merge:Xn,extend:Ys,trim:zs,stripBOM:js,inherits:qs,toFlatObject:Xs,kindOf:dn,kindOfTest:oe,endsWith:Js,toArray:Zs,forEachEntry:ea,matchAll:ta,isHTMLForm:na,hasOwnProperty:Si,hasOwnProp:Si,reduceDescriptors:Pi,freezeMethods:oa,toObjectSet:sa,toCamelCase:ra,noop:aa,toFiniteNumber:ca,findKey:Ri,global:Be,isContextDefined:Oi,isSpecCompliantForm:la,toJSONObject:ua,isAsyncFn:da,isThenable:pa,setImmediate:vi,asap:fa,isIterable:ga};function Xe(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}d.inherits(Xe,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:d.toJSONObject(this.config),code:this.code,status:this.status}}});var xi=Xe.prototype,Ni={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Ni[t]={value:t}});Object.defineProperties(Xe,Ni);Object.defineProperty(xi,"isAxiosError",{value:!0});Xe.from=(t,e,n,r,i,o)=>{let s=Object.create(xi);d.toFlatObject(t,s,function(u){return u!==Error.prototype},c=>c!=="isAxiosError");let a=t&&t.message?t.message:"Error",l=e==null&&t?t.code:e;return Xe.call(s,a,l,n,r,i),t&&s.cause==null&&Object.defineProperty(s,"cause",{value:t,configurable:!0}),s.name=t&&t.name||"Error",o&&Object.assign(s,o),s};var T=Xe;var fn=null;function Zn(t){return d.isPlainObject(t)||d.isArray(t)}function ki(t){return d.endsWith(t,"[]")?t.slice(0,-2):t}function _i(t,e,n){return t?t.concat(e).map(function(i,o){return i=ki(i),!n&&o?"["+i+"]":i}).join(n?".":""):e}function ma(t){return d.isArray(t)&&!t.some(Zn)}var ha=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function Ea(t,e,n){if(!d.isObject(t))throw new TypeError("target must be an object");e=e||new(fn||FormData),n=d.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(I,h){return!d.isUndefined(h[I])});let r=n.metaTokens,i=n.visitor||u,o=n.dots,s=n.indexes,l=(n.Blob||typeof Blob!="undefined"&&Blob)&&d.isSpecCompliantForm(e);if(!d.isFunction(i))throw new TypeError("visitor must be a function");function c(f){if(f===null)return"";if(d.isDate(f))return f.toISOString();if(d.isBoolean(f))return f.toString();if(!l&&d.isBlob(f))throw new T("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(f)||d.isTypedArray(f)?l&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,I,h){let R=f;if(f&&!h&&typeof f=="object"){if(d.endsWith(I,"{}"))I=r?I:I.slice(0,-2),f=JSON.stringify(f);else if(d.isArray(f)&&ma(f)||(d.isFileList(f)||d.endsWith(I,"[]"))&&(R=d.toArray(f)))return I=ki(I),R.forEach(function(C,N){!(d.isUndefined(C)||C===null)&&e.append(s===!0?_i([I],N,o):s===null?I:I+"[]",c(C))}),!1}return Zn(f)?!0:(e.append(_i(h,I,o),c(f)),!1)}let p=[],b=Object.assign(ha,{defaultVisitor:u,convertValue:c,isVisitable:Zn});function w(f,I){if(!d.isUndefined(f)){if(p.indexOf(f)!==-1)throw Error("Circular reference detected in "+I.join("."));p.push(f),d.forEach(f,function(R,x){(!(d.isUndefined(R)||R===null)&&i.call(e,R,d.isString(x)?x.trim():x,I,b))===!0&&w(R,I?I.concat(x):[x])}),p.pop()}}if(!d.isObject(t))throw new TypeError("data must be an object");return w(t),e}var Re=Ea;function Li(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Di(t,e){this._pairs=[],t&&Re(t,this,e)}var Bi=Di.prototype;Bi.append=function(e,n){this._pairs.push([e,n])};Bi.toString=function(e){let n=e?function(r){return e.call(this,r,Li)}:Li;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};var gn=Di;function ya(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Tt(t,e,n){if(!e)return t;let r=n&&n.encode||ya;d.isFunction(n)&&(n={serialize:n});let i=n&&n.serialize,o;if(i?o=i(e,n):o=d.isURLSearchParams(e)?e.toString():new gn(e,n).toString(r),o){let s=t.indexOf("#");s!==-1&&(t=t.slice(0,s)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}var Qn=class{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){d.forEach(this.handlers,function(r){r!==null&&e(r)})}},er=Qn;var mn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Mi=typeof URLSearchParams!="undefined"?URLSearchParams:gn;var Ui=typeof FormData!="undefined"?FormData:null;var Fi=typeof Blob!="undefined"?Blob:null;var Gi={isBrowser:!0,classes:{URLSearchParams:Mi,FormData:Ui,Blob:Fi},protocols:["http","https","file","blob","url","data"]};var rr={};Gn(rr,{hasBrowserEnv:()=>nr,hasStandardBrowserEnv:()=>Aa,hasStandardBrowserWebWorkerEnv:()=>wa,navigator:()=>tr,origin:()=>ba});var nr=typeof window!="undefined"&&typeof document!="undefined",tr=typeof navigator=="object"&&navigator||void 0,Aa=nr&&(!tr||["ReactNative","NativeScript","NS"].indexOf(tr.product)<0),wa=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ba=nr&&window.location.href||"http://localhost";var M=O(O({},rr),Gi);function ir(t,e){return Re(t,new M.classes.URLSearchParams,O({visitor:function(n,r,i,o){return M.isNode&&d.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}function Sa(t){return d.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Ia(t){let e={},n=Object.keys(t),r,i=n.length,o;for(r=0;r<i;r++)o=n[r],e[o]=t[o];return e}function Ca(t){function e(n,r,i,o){let s=n[o++];if(s==="__proto__")return!0;let a=Number.isFinite(+s),l=o>=n.length;return s=!s&&d.isArray(i)?i.length:s,l?(d.hasOwnProp(i,s)?i[s]=[i[s],r]:i[s]=r,!a):((!i[s]||!d.isObject(i[s]))&&(i[s]=[]),e(n,r,i[s],o)&&d.isArray(i[s])&&(i[s]=Ia(i[s])),!a)}if(d.isFormData(t)&&d.isFunction(t.entries)){let n={};return d.forEachEntry(t,(r,i)=>{e(Sa(r),i,n,0)}),n}return null}var hn=Ca;function Ta(t,e,n){if(d.isString(t))try{return(e||JSON.parse)(t),d.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}var or={transitional:mn,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){let r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=d.isObject(e);if(o&&d.isHTMLForm(e)&&(e=new FormData(e)),d.isFormData(e))return i?JSON.stringify(hn(e)):e;if(d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e)||d.isReadableStream(e))return e;if(d.isArrayBufferView(e))return e.buffer;if(d.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return ir(e,this.formSerializer).toString();if((a=d.isFileList(e))||r.indexOf("multipart/form-data")>-1){let l=this.env&&this.env.FormData;return Re(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),Ta(e)):e}],transformResponse:[function(e){let n=this.transitional||or.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(d.isResponse(e)||d.isReadableStream(e))return e;if(e&&d.isString(e)&&(r&&!this.responseType||i)){let s=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(a){if(s)throw a.name==="SyntaxError"?T.from(a,T.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:M.classes.FormData,Blob:M.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],t=>{or.headers[t]={}});var Je=or;var Ra=d.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Hi=t=>{let e={},n,r,i;return t&&t.split("\n").forEach(function(s){i=s.indexOf(":"),n=s.substring(0,i).trim().toLowerCase(),r=s.substring(i+1).trim(),!(!n||e[n]&&Ra[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e};var Ki=Symbol("internals");function Rt(t){return t&&String(t).trim().toLowerCase()}function En(t){return t===!1||t==null?t:d.isArray(t)?t.map(En):String(t)}function Oa(t){let e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}var Pa=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function sr(t,e,n,r,i){if(d.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!d.isString(e)){if(d.isString(r))return e.indexOf(r)!==-1;if(d.isRegExp(r))return r.test(e)}}function va(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function xa(t,e){let n=d.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,o,s){return this[r].call(this,e,i,o,s)},configurable:!0})})}var Ze=class{constructor(e){e&&this.set(e)}set(e,n,r){let i=this;function o(a,l,c){let u=Rt(l);if(!u)throw new Error("header name must be a non-empty string");let p=d.findKey(i,u);(!p||i[p]===void 0||c===!0||c===void 0&&i[p]!==!1)&&(i[p||l]=En(a))}let s=(a,l)=>d.forEach(a,(c,u)=>o(c,u,l));if(d.isPlainObject(e)||e instanceof this.constructor)s(e,n);else if(d.isString(e)&&(e=e.trim())&&!Pa(e))s(Hi(e),n);else if(d.isObject(e)&&d.isIterable(e)){let a={},l,c;for(let u of e){if(!d.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(l=a[c])?d.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}s(a,n)}else e!=null&&o(n,e,r);return this}get(e,n){if(e=Rt(e),e){let r=d.findKey(this,e);if(r){let i=this[r];if(!n)return i;if(n===!0)return Oa(i);if(d.isFunction(n))return n.call(this,i,r);if(d.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Rt(e),e){let r=d.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||sr(this,this[r],r,n)))}return!1}delete(e,n){let r=this,i=!1;function o(s){if(s=Rt(s),s){let a=d.findKey(r,s);a&&(!n||sr(r,r[a],a,n))&&(delete r[a],i=!0)}}return d.isArray(e)?e.forEach(o):o(e),i}clear(e){let n=Object.keys(this),r=n.length,i=!1;for(;r--;){let o=n[r];(!e||sr(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){let n=this,r={};return d.forEach(this,(i,o)=>{let s=d.findKey(r,o);if(s){n[s]=En(i),delete n[o];return}let a=e?va(o):String(o).trim();a!==o&&delete n[o],n[a]=En(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let n=Object.create(null);return d.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&d.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){let r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){let r=(this[Ki]=this[Ki]={accessors:{}}).accessors,i=this.prototype;function o(s){let a=Rt(s);r[a]||(xa(i,s),r[a]=!0)}return d.isArray(e)?e.forEach(o):o(e),this}};Ze.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);d.reduceDescriptors(Ze.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});d.freezeMethods(Ze);var K=Ze;function Ot(t,e){let n=this||Je,r=e||n,i=K.from(r.headers),o=r.data;return d.forEach(t,function(a){o=a.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function Pt(t){return!!(t&&t.__CANCEL__)}function Vi(t,e,n){T.call(this,t==null?"canceled":t,T.ERR_CANCELED,e,n),this.name="CanceledError"}d.inherits(Vi,T,{__CANCEL__:!0});var de=Vi;function vt(t,e,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new T("Request failed with status code "+n.status,[T.ERR_BAD_REQUEST,T.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function ar(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Na(t,e){t=t||10;let n=new Array(t),r=new Array(t),i=0,o=0,s;return e=e!==void 0?e:1e3,function(l){let c=Date.now(),u=r[o];s||(s=c),n[i]=l,r[i]=c;let p=o,b=0;for(;p!==i;)b+=n[p++],p=p%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),c-s<e)return;let w=u&&c-u;return w?Math.round(b*1e3/w):void 0}}var Wi=Na;function _a(t,e){let n=0,r=1e3/e,i,o,s=(c,u=Date.now())=>{n=u,i=null,o&&(clearTimeout(o),o=null),t(...c)};return[(...c)=>{let u=Date.now(),p=u-n;p>=r?s(c,u):(i=c,o||(o=setTimeout(()=>{o=null,s(i)},r-p)))},()=>i&&s(i)]}var $i=_a;var Qe=(t,e,n=3)=>{let r=0,i=Wi(50,250);return $i(o=>{let s=o.loaded,a=o.lengthComputable?o.total:void 0,l=s-r,c=i(l),u=s<=a;r=s;let p={loaded:s,total:a,progress:a?s/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-s)/c:void 0,event:o,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(p)},n)},cr=(t,e)=>{let n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},lr=t=>(...e)=>d.asap(()=>t(...e));var zi=M.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,M.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(M.origin),M.navigator&&/(msie|trident)/i.test(M.navigator.userAgent)):()=>!0;var Yi=M.hasStandardBrowserEnv?{write(t,e,n,r,i,o,s){if(typeof document=="undefined")return;let a=["".concat(t,"=").concat(encodeURIComponent(e))];d.isNumber(n)&&a.push("expires=".concat(new Date(n).toUTCString())),d.isString(r)&&a.push("path=".concat(r)),d.isString(i)&&a.push("domain=".concat(i)),o===!0&&a.push("secure"),d.isString(s)&&a.push("SameSite=".concat(s)),document.cookie=a.join("; ")},read(t){if(typeof document=="undefined")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function ur(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function dr(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function xt(t,e,n){let r=!ur(e);return t&&(r||n==!1)?dr(t,e):e}var ji=t=>t instanceof K?O({},t):t;function se(t,e){e=e||{};let n={};function r(c,u,p,b){return d.isPlainObject(c)&&d.isPlainObject(u)?d.merge.call({caseless:b},c,u):d.isPlainObject(u)?d.merge({},u):d.isArray(u)?u.slice():u}function i(c,u,p,b){if(d.isUndefined(u)){if(!d.isUndefined(c))return r(void 0,c,p,b)}else return r(c,u,p,b)}function o(c,u){if(!d.isUndefined(u))return r(void 0,u)}function s(c,u){if(d.isUndefined(u)){if(!d.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,p){if(p in e)return r(c,u);if(p in t)return r(void 0,c)}let l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(c,u,p)=>i(ji(c),ji(u),p,!0)};return d.forEach(Object.keys(O(O({},t),e)),function(u){let p=l[u]||i,b=p(t[u],e[u],u);d.isUndefined(b)&&p!==a||(n[u]=b)}),n}var yn=t=>{let e=se({},t),{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=e;if(e.headers=s=K.from(s),e.url=Tt(xt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),d.isFormData(n)){if(M.hasStandardBrowserEnv||M.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(d.isFunction(n.getHeaders)){let l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,p])=>{c.includes(u.toLowerCase())&&s.set(u,p)})}}if(M.hasStandardBrowserEnv&&(r&&d.isFunction(r)&&(r=r(e)),r||r!==!1&&zi(e.url))){let l=i&&o&&Yi.read(o);l&&s.set(i,l)}return e};var ka=typeof XMLHttpRequest!="undefined",qi=ka&&function(t){return new Promise(function(n,r){let i=yn(t),o=i.data,s=K.from(i.headers).normalize(),{responseType:a,onUploadProgress:l,onDownloadProgress:c}=i,u,p,b,w,f;function I(){w&&w(),f&&f(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(i.method.toUpperCase(),i.url,!0),h.timeout=i.timeout;function R(){if(!h)return;let C=K.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),V={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:C,config:t,request:h};vt(function(W){n(W),I()},function(W){r(W),I()},V),h=null}"onloadend"in h?h.onloadend=R:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(R)},h.onabort=function(){h&&(r(new T("Request aborted",T.ECONNABORTED,t,h)),h=null)},h.onerror=function(N){let V=N&&N.message?N.message:"Network Error",L=new T(V,T.ERR_NETWORK,t,h);L.event=N||null,r(L),h=null},h.ontimeout=function(){let N=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",V=i.transitional||mn;i.timeoutErrorMessage&&(N=i.timeoutErrorMessage),r(new T(N,V.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,t,h)),h=null},o===void 0&&s.setContentType(null),"setRequestHeader"in h&&d.forEach(s.toJSON(),function(N,V){h.setRequestHeader(V,N)}),d.isUndefined(i.withCredentials)||(h.withCredentials=!!i.withCredentials),a&&a!=="json"&&(h.responseType=i.responseType),c&&([b,f]=Qe(c,!0),h.addEventListener("progress",b)),l&&h.upload&&([p,w]=Qe(l),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",w)),(i.cancelToken||i.signal)&&(u=C=>{h&&(r(!C||C.type?new de(null,t,h):C),h.abort(),h=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));let x=ar(i.url);if(x&&M.protocols.indexOf(x)===-1){r(new T("Unsupported protocol "+x+":",T.ERR_BAD_REQUEST,t));return}h.send(o||null)})};var La=(t,e)=>{let{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i,o=function(c){if(!i){i=!0,a();let u=c instanceof Error?c:this.reason;r.abort(u instanceof T?u:new de(u instanceof Error?u.message:u))}},s=e&&setTimeout(()=>{s=null,o(new T("timeout ".concat(e," of ms exceeded"),T.ETIMEDOUT))},e),a=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(o):c.removeEventListener("abort",o)}),t=null)};t.forEach(c=>c.addEventListener("abort",o));let{signal:l}=r;return l.unsubscribe=()=>d.asap(a),l}},Xi=La;var Da=function*(t,e){let n=t.byteLength;if(!e||n<e){yield t;return}let r=0,i;for(;r<n;)i=r+e,yield t.slice(r,i),r=i},Ba=function(t,e){return Hn(this,null,function*(){try{for(var n=ii(Ma(t)),r,i,o;r=!(i=yield new ke(n.next())).done;r=!1){let s=i.value;yield*Ve(Da(s,e))}}catch(i){o=[i]}finally{try{r&&(i=n.return)&&(yield new ke(i.call(n)))}finally{if(o)throw o[0]}}})},Ma=function(t){return Hn(this,null,function*(){if(t[Symbol.asyncIterator]){yield*Ve(t);return}let e=t.getReader();try{for(;;){let{done:n,value:r}=yield new ke(e.read());if(n)break;yield r}}finally{yield new ke(e.cancel())}})},pr=(t,e,n,r)=>{let i=Ba(t,e),o=0,s,a=l=>{s||(s=!0,r&&r(l))};return new ReadableStream({async pull(l){try{let{done:c,value:u}=await i.next();if(c){a(),l.close();return}let p=u.byteLength;if(n){let b=o+=p;n(b)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),i.return()}},{highWaterMark:2})};var Ji=64*1024,{isFunction:An}=d,Ua=(({Request:t,Response:e})=>({Request:t,Response:e}))(d.global),{ReadableStream:Zi,TextEncoder:Qi}=d.global,eo=(t,...e)=>{try{return!!t(...e)}catch(n){return!1}},Fa=t=>{t=d.merge.call({skipUndefined:!0},Ua,t);let{fetch:e,Request:n,Response:r}=t,i=e?An(e):typeof fetch=="function",o=An(n),s=An(r);if(!i)return!1;let a=i&&An(Zi),l=i&&(typeof Qi=="function"?(f=>I=>f.encode(I))(new Qi):async f=>new Uint8Array(await new n(f).arrayBuffer())),c=o&&a&&eo(()=>{let f=!1,I=new n(M.origin,{body:new Zi,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!I}),u=s&&a&&eo(()=>d.isReadableStream(new r("").body)),p={stream:u&&(f=>f.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!p[f]&&(p[f]=(I,h)=>{let R=I&&I[f];if(R)return R.call(I);throw new T("Response type '".concat(f,"' is not supported"),T.ERR_NOT_SUPPORT,h)})});let b=async f=>{if(f==null)return 0;if(d.isBlob(f))return f.size;if(d.isSpecCompliantForm(f))return(await new n(M.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(d.isArrayBufferView(f)||d.isArrayBuffer(f))return f.byteLength;if(d.isURLSearchParams(f)&&(f=f+""),d.isString(f))return(await l(f)).byteLength},w=async(f,I)=>{let h=d.toFiniteNumber(f.getContentLength());return h==null?b(I):h};return async f=>{let{url:I,method:h,data:R,signal:x,cancelToken:C,timeout:N,onDownloadProgress:V,onUploadProgress:L,responseType:W,headers:le,withCredentials:ut="same-origin",fetchOptions:ne}=yn(f),Se=e||fetch;W=W?(W+"").toLowerCase():"text";let j=Xi([x,C&&C.toAbortSignal()],N),dt=null,_e=j&&j.unsubscribe&&(()=>{j.unsubscribe()}),Xr;try{if(L&&c&&h!=="get"&&h!=="head"&&(Xr=await w(le,R))!==0){let Ce=new n(I,{method:"POST",body:R,duplex:"half"}),He;if(d.isFormData(R)&&(He=Ce.headers.get("content-type"))&&le.setContentType(He),Ce.body){let[Fn,Qt]=cr(Xr,Qe(lr(L)));R=pr(Ce.body,Ji,Fn,Qt)}}d.isString(ut)||(ut=ut?"include":"omit");let ue=o&&"credentials"in n.prototype,Jr=$(O({},ne),{signal:j,method:h.toUpperCase(),headers:le.normalize().toJSON(),body:R,duplex:"half",credentials:ue?ut:void 0});dt=o&&new n(I,Jr);let Ie=await(o?Se(dt,ne):Se(I,Jr)),Zr=u&&(W==="stream"||W==="response");if(u&&(V||Zr&&_e)){let Ce={};["status","statusText","headers"].forEach(Qr=>{Ce[Qr]=Ie[Qr]});let He=d.toFiniteNumber(Ie.headers.get("content-length")),[Fn,Qt]=V&&cr(He,Qe(lr(V),!0))||[];Ie=new r(pr(Ie.body,Ji,Fn,()=>{Qt&&Qt(),_e&&_e()}),Ce)}W=W||"text";let is=await p[d.findKey(p,W)||"text"](Ie,f);return!Zr&&_e&&_e(),await new Promise((Ce,He)=>{vt(Ce,He,{data:is,headers:K.from(Ie.headers),status:Ie.status,statusText:Ie.statusText,config:f,request:dt})})}catch(ue){throw _e&&_e(),ue&&ue.name==="TypeError"&&/Load failed|fetch/i.test(ue.message)?Object.assign(new T("Network Error",T.ERR_NETWORK,f,dt),{cause:ue.cause||ue}):T.from(ue,ue&&ue.code,f,dt)}}},Ga=new Map,fr=t=>{let e=t&&t.env||{},{fetch:n,Request:r,Response:i}=e,o=[r,i,n],s=o.length,a=s,l,c,u=Ga;for(;a--;)l=o[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:Fa(e)),u=c;return c},wd=fr();var gr={http:fn,xhr:qi,fetch:{get:fr}};d.forEach(gr,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(n){}Object.defineProperty(t,"adapterName",{value:e})}});var to=t=>"- ".concat(t),Ka=t=>d.isFunction(t)||t===null||t===!1;function Va(t,e){t=d.isArray(t)?t:[t];let{length:n}=t,r,i,o={};for(let s=0;s<n;s++){r=t[s];let a;if(i=r,!Ka(r)&&(i=gr[(a=String(r)).toLowerCase()],i===void 0))throw new T("Unknown adapter '".concat(a,"'"));if(i&&(d.isFunction(i)||(i=i.get(e))))break;o[a||"#"+s]=i}if(!i){let s=Object.entries(o).map(([l,c])=>"adapter ".concat(l," ")+(c===!1?"is not supported by the environment":"is not available in the build")),a=n?s.length>1?"since :\n"+s.map(to).join("\n"):" "+to(s[0]):"as no adapter specified";throw new T("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i}var wn={getAdapter:Va,adapters:gr};function mr(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new de(null,t)}function bn(t){return mr(t),t.headers=K.from(t.headers),t.data=Ot.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),wn.getAdapter(t.adapter||Je.adapter,t)(t).then(function(r){return mr(t),r.data=Ot.call(t,t.transformResponse,r),r.headers=K.from(r.headers),r},function(r){return Pt(r)||(mr(t),r&&r.response&&(r.response.data=Ot.call(t,t.transformResponse,r.response),r.response.headers=K.from(r.response.headers))),Promise.reject(r)})}var Sn="1.13.2";var In={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{In[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});var no={};In.transitional=function(e,n,r){function i(o,s){return"[Axios v"+Sn+"] Transitional option '"+o+"'"+s+(r?". "+r:"")}return(o,s,a)=>{if(e===!1)throw new T(i(s," has been removed"+(n?" in "+n:"")),T.ERR_DEPRECATED);return n&&!no[s]&&(no[s]=!0,console.warn(i(s," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,s,a):!0}};In.spelling=function(e){return(n,r)=>(console.warn("".concat(r," is likely a misspelling of ").concat(e)),!0)};function Wa(t,e,n){if(typeof t!="object")throw new T("options must be an object",T.ERR_BAD_OPTION_VALUE);let r=Object.keys(t),i=r.length;for(;i-- >0;){let o=r[i],s=e[o];if(s){let a=t[o],l=a===void 0||s(a,o,t);if(l!==!0)throw new T("option "+o+" must be "+l,T.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new T("Unknown option "+o,T.ERR_BAD_OPTION)}}var Nt={assertOptions:Wa,validators:In};var pe=Nt.validators,et=class{constructor(e){this.defaults=e||{},this.interceptors={request:new er,response:new er}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;let o=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+="\n"+o):r.stack=o}catch(s){}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=se(this.defaults,n);let{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&Nt.assertOptions(r,{silentJSONParsing:pe.transitional(pe.boolean),forcedJSONParsing:pe.transitional(pe.boolean),clarifyTimeoutError:pe.transitional(pe.boolean)},!1),i!=null&&(d.isFunction(i)?n.paramsSerializer={serialize:i}:Nt.assertOptions(i,{encode:pe.function,serialize:pe.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Nt.assertOptions(n,{baseUrl:pe.spelling("baseURL"),withXsrfToken:pe.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=o&&d.merge(o.common,o[n.method]);o&&d.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),n.headers=K.concat(s,o);let a=[],l=!0;this.interceptors.request.forEach(function(I){typeof I.runWhen=="function"&&I.runWhen(n)===!1||(l=l&&I.synchronous,a.unshift(I.fulfilled,I.rejected))});let c=[];this.interceptors.response.forEach(function(I){c.push(I.fulfilled,I.rejected)});let u,p=0,b;if(!l){let f=[bn.bind(this),void 0];for(f.unshift(...a),f.push(...c),b=f.length,u=Promise.resolve(n);p<b;)u=u.then(f[p++],f[p++]);return u}b=a.length;let w=n;for(;p<b;){let f=a[p++],I=a[p++];try{w=f(w)}catch(h){I.call(this,h);break}}try{u=bn.call(this,w)}catch(f){return Promise.reject(f)}for(p=0,b=c.length;p<b;)u=u.then(c[p++],c[p++]);return u}getUri(e){e=se(this.defaults,e);let n=xt(e.baseURL,e.url,e.allowAbsoluteUrls);return Tt(n,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){et.prototype[e]=function(n,r){return this.request(se(r||{},{method:e,url:n,data:(r||{}).data}))}});d.forEach(["post","put","patch"],function(e){function n(r){return function(o,s,a){return this.request(se(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}et.prototype[e]=n(),et.prototype[e+"Form"]=n(!0)});var _t=et;var hr=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});let r=this;this.promise.then(i=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o,s=new Promise(a=>{r.subscribe(a),o=a}).then(i);return s.cancel=function(){r.unsubscribe(o)},s},e(function(o,s,a){r.reason||(r.reason=new de(o,s,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){let e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},ro=hr;function Er(t){return function(n){return t.apply(null,n)}}function yr(t){return d.isObject(t)&&t.isAxiosError===!0}var Ar={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ar).forEach(([t,e])=>{Ar[e]=t});var io=Ar;function oo(t){let e=new _t(t),n=bt(_t.prototype.request,e);return d.extend(n,_t.prototype,e,{allOwnKeys:!0}),d.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return oo(se(t,i))},n}var G=oo(Je);G.Axios=_t;G.CanceledError=de;G.CancelToken=ro;G.isCancel=Pt;G.VERSION=Sn;G.toFormData=Re;G.AxiosError=T;G.Cancel=G.CanceledError;G.all=function(e){return Promise.all(e)};G.spread=Er;G.isAxiosError=yr;G.mergeConfig=se;G.AxiosHeaders=K;G.formToJSON=t=>hn(d.isHTMLForm(t)?new FormData(t):t);G.getAdapter=wn.getAdapter;G.HttpStatusCode=io;G.default=G;var kt=G;var{Axios:yp,AxiosError:Ap,CanceledError:wp,isCancel:bp,CancelToken:Sp,VERSION:Ip,all:Cp,Cancel:Tp,isAxiosError:Rp,spread:Op,toFormData:Pp,AxiosHeaders:vp,HttpStatusCode:xp,formToJSON:Np,getAdapter:_p,mergeConfig:kp}=kt;var fe={NETWORK_ERROR:"network_error",API_ERROR:"api_error",AUTH_REQUIRED:"auth_required",TOKEN_EXPIRED:"token_expired",NOT_FOUND:"not_found",VALIDATION_ERROR:"validation_error",CIRCUIT_BREAKER:"circuit_breaker",PAYMENT_FAILED:"payment_failed",CARD_DECLINED:"card_declined",SESSION_EXPIRED:"session_expired",RATE_LIMITED:"rate_limited",TIMEOUT:"timeout",UNKNOWN:"unknown"},ye=class extends Error{constructor(e,n){var r;super(e),this.name="TagadaError",this.code=n.code,this.statusCode=n.statusCode,this.retryable=(r=n.retryable)!=null?r:!1,this.details=n.details,Object.setPrototypeOf(this,new.target.prototype)}},Oe=class extends ye{constructor(e,n,r){var i,o;super(e,{code:(i=r==null?void 0:r.code)!=null?i:fe.API_ERROR,statusCode:n,retryable:(o=r==null?void 0:r.retryable)!=null?o:n>=500,details:r==null?void 0:r.details}),this.name="TagadaApiError"}},Lt=class extends ye{constructor(e="Network request failed"){super(e,{code:fe.NETWORK_ERROR,retryable:!0}),this.name="TagadaNetworkError"}},Dt=class extends ye{constructor(e="Authentication required",n=401){super(e,{code:fe.AUTH_REQUIRED,statusCode:n,retryable:!1}),this.name="TagadaAuthError"}};var Bt=class extends ye{constructor(e){super(e,{code:fe.CIRCUIT_BREAKER,retryable:!1}),this.name="TagadaCircuitBreakerError"}};var Mt=class{constructor(e){this.currentToken=null;this.tokenProvider=null;this.requestHistory=new Map;this.WINDOW_MS=5e3;this.MAX_REQUESTS=30;this.axios=kt.create({baseURL:e.baseURL,timeout:e.timeout||6e4,headers:O({"Content-Type":"application/json"},e.headers)}),typeof setInterval!="undefined"&&setInterval(()=>this.cleanupHistory(),1e4),this.axios.interceptors.request.use(async n=>{var r,i;if(n.url)try{this.checkRequestLimit("".concat((r=n.method)==null?void 0:r.toUpperCase(),":").concat(n.url))}catch(o){return console.error("[SDK] \u{1F6D1} Request blocked by Circuit Breaker:",o),Promise.reject(o)}if(!n.skipAuth&&!this.currentToken&&this.tokenProvider)try{console.log("[SDK] Waiting for token...");let o=await this.tokenProvider();o&&(this.updateToken(o),n.headers["x-cms-token"]=o)}catch(o){console.error("[SDK] Failed to get token from provider:",o)}return!n.skipAuth&&this.currentToken&&(n.headers["x-cms-token"]=this.currentToken),console.log("[SDK] Making ".concat((i=n.method)==null?void 0:i.toUpperCase()," request to: ").concat(n.baseURL||"").concat(n.url)),n},n=>(console.error("[SDK] Request error:",n),Promise.reject(n instanceof Error?n:new Error(String(n))))),this.axios.interceptors.response.use(n=>n,n=>(console.error("[SDK] Response error:",n.message),n instanceof ye?Promise.reject(n):kt.isAxiosError(n)?Promise.reject(this.toTagadaError(n)):Promise.reject(n instanceof Error?n:new Error(String(n)))))}setTokenProvider(e){this.tokenProvider=e}async get(e,n){return(await this.axios.get(e,n)).data}async post(e,n,r){return(await this.axios.post(e,n,r)).data}async put(e,n,r){return(await this.axios.put(e,n,r)).data}async patch(e,n,r){return(await this.axios.patch(e,n,r)).data}async delete(e,n){return(await this.axios.delete(e,n)).data}setHeader(e,n){this.axios.defaults.headers.common[e]=n}removeHeader(e){delete this.axios.defaults.headers.common[e]}updateToken(e){this.currentToken=e,e?this.setHeader("x-cms-token",e):(this.removeHeader("x-cms-token"),console.log("[SDK] Token removed from ApiClient"))}getCurrentToken(){return this.currentToken}updateConfig(e){e.baseURL&&(this.axios.defaults.baseURL=e.baseURL),e.timeout&&(this.axios.defaults.timeout=e.timeout),e.headers&&Object.assign(this.axios.defaults.headers.common,e.headers),console.log("[SDK] ApiClient configuration updated")}checkRequestLimit(e){let n=Date.now(),r=this.requestHistory.get(e);if(!r){this.requestHistory.set(e,{count:1,firstRequestTime:n});return}if(n-r.firstRequestTime>this.WINDOW_MS){this.requestHistory.set(e,{count:1,firstRequestTime:n});return}if(r.count++,r.count>this.MAX_REQUESTS)throw new Bt("Circuit Breaker: Too many requests to ".concat(e," (").concat(r.count," in ").concat(this.WINDOW_MS,"ms)"))}cleanupHistory(){let e=Date.now();for(let[n,r]of this.requestHistory.entries())e-r.firstRequestTime>this.WINDOW_MS&&this.requestHistory.delete(n)}toTagadaError(e){var o,s,a,l,c;let n=(o=e.response)==null?void 0:o.status,r=(s=e.response)==null?void 0:s.data,i=(l=(a=r==null?void 0:r.message)!=null?a:r==null?void 0:r.error)!=null?l:e.message;return e.response?n===401||n===403?new Dt(i,n):n===429?new Oe(i,429,{code:fe.RATE_LIMITED,retryable:!0}):n===404?new Oe(i,404,{code:fe.NOT_FOUND,retryable:!1}):new Oe(i,n!=null?n:0,{code:(c=r==null?void 0:r.code)!=null?c:fe.API_ERROR,details:r,retryable:(n!=null?n:0)>=500}):e.code==="ECONNABORTED"?new Oe("Request timed out",0,{code:fe.TIMEOUT,retryable:!0}):new Lt(i)}};var $a="2.0.6",za=500,so="user-agent",st="",ao="?",U={FUNCTION:"function",OBJECT:"object",STRING:"string",UNDEFINED:"undefined"},Z="browser",Ae="cpu",he="device",ae="engine",ee="os",it="result",E="name",g="type",y="vendor",A="version",q="architecture",zt="major",m="model",Wt="console",P="mobile",_="tablet",H="smarttv",ge="wearable",Cn="xr",$t="embedded",tt="inapp",kr="brands",Ue="formFactors",Lr="fullVersionList",ot="platform",Dr="platformVersion",Nn="bitness",Ne="sec-ch-ua",Ya=Ne+"-full-version-list",ja=Ne+"-arch",qa=Ne+"-"+Nn,Xa=Ne+"-form-factors",Ja=Ne+"-"+P,Za=Ne+"-"+m,So=Ne+"-"+ot,Qa=So+"-version",Io=[kr,Lr,P,m,ot,Dr,q,Ue,Nn],Tn="Amazon",nt="Apple",co="ASUS",lo="BlackBerry",Me="Google",uo="Huawei",wr="Lenovo",po="Honor",Rn="LG",br="Microsoft",Sr="Motorola",Ir="Nvidia",fo="OnePlus",Cr="OPPO",Ut="Samsung",go="Sharp",Ft="Sony",Tr="Xiaomi",Rr="Zebra",mo="Chrome",ho="Chromium",Pe="Chromecast",Pn="Edge",Gt="Firefox",Ht="Opera",Or="Facebook",Eo="Sogou",rt="Mobile ",Kt=" Browser",Nr="Windows",ec=typeof window!==U.UNDEFINED,Q=ec&&window.navigator?window.navigator:void 0,ve=Q&&Q.userAgentData?Q.userAgentData:void 0,tc=function(t,e){var n={},r=e;if(!vn(e)){r={};for(var i in e)for(var o in e[i])r[o]=e[i][o].concat(r[o]?r[o]:[])}for(var s in t)n[s]=r[s]&&r[s].length%2===0?r[s].concat(t[s]):t[s];return n},_n=function(t){for(var e={},n=0;n<t.length;n++)e[t[n].toUpperCase()]=t[n];return e},_r=function(t,e){if(typeof t===U.OBJECT&&t.length>0){for(var n in t)if(xe(e)==xe(t[n]))return!0;return!1}return Yt(t)?xe(e)==xe(t):!1},vn=function(t,e){for(var n in t)return/^(browser|cpu|device|engine|os)$/.test(n)||(e?vn(t[n]):!1)},Yt=function(t){return typeof t===U.STRING},Pr=function(t){if(t){for(var e=[],n=at(/\\?\"/g,t).split(","),r=0;r<n.length;r++)if(n[r].indexOf(";")>-1){var i=xn(n[r]).split(";v=");e[r]={brand:i[0],version:i[1]}}else e[r]=xn(n[r]);return e}},xe=function(t){return Yt(t)?t.toLowerCase():t},vr=function(t){return Yt(t)?at(/[^\d\.]/g,t).split(".")[0]:void 0},we=function(t){for(var e in t)if(t.hasOwnProperty(e)){var n=t[e];typeof n==U.OBJECT&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},at=function(t,e){return Yt(e)?e.replace(t,st):e},Vt=function(t){return at(/\\?\"/g,t)},xn=function(t,e){return t=at(/^\s\s*/,String(t)),typeof e===U.UNDEFINED?t:t.substring(0,e)},xr=function(t,e){if(!(!t||!e))for(var n=0,r,i,o,s,a,l;n<e.length&&!a;){var c=e[n],u=e[n+1];for(r=i=0;r<c.length&&!a&&c[r];)if(a=c[r++].exec(t),a)for(o=0;o<u.length;o++)l=a[++i],s=u[o],typeof s===U.OBJECT&&s.length>0?s.length===2?typeof s[1]==U.FUNCTION?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===U.FUNCTION&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=l?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=l?s[1].call(this,l,s[2]):void 0:s.length==3?this[s[0]]=l?l.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=l?s[3].apply(this,[l.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=l||void 0;n+=2}},me=function(t,e){for(var n in e)if(typeof e[n]===U.OBJECT&&e[n].length>0){for(var r=0;r<e[n].length;r++)if(_r(e[n][r],t))return n===ao?void 0:n}else if(_r(e[n],t))return n===ao?void 0:n;return e.hasOwnProperty("*")?e["*"]:t},yo={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},Ao={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},nc={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},wo={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[A,[E,rt+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[A,[E,Pn+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[A,[E,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[E,A],[/opios[\/ ]+([\w\.]+)/i],[A,[E,Ht+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[A,[E,Ht+" GX"]],[/\bopr\/([\w\.]+)/i],[A,[E,Ht]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[A,[E,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[A,[E,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser|palemoon)\/([-\w\.]+)/i,/(heytap|ovi|115|surf|qwant)browser\/([\d\.]+)/i,/(qwant)(?:ios|mobile)\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[E,A],[/quark(?:pc)?\/([-\w\.]+)/i],[A,[E,"Quark"]],[/\bddg\/([\w\.]+)/i],[A,[E,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[A,[E,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[A,[E,"WeChat"]],[/konqueror\/([\w\.]+)/i],[A,[E,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[A,[E,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[A,[E,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[A,[E,"Smart "+wr+Kt]],[/(avast|avg)\/([\w\.]+)/i],[[E,/(.+)/,"$1 Secure"+Kt],A],[/\bfocus\/([\w\.]+)/i],[A,[E,Gt+" Focus"]],[/\bopt\/([\w\.]+)/i],[A,[E,Ht+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[A,[E,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[A,[E,"Dolphin"]],[/coast\/([\w\.]+)/i],[A,[E,Ht+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[A,[E,"MIUI"+Kt]],[/fxios\/([\w\.-]+)/i],[A,[E,rt+Gt]],[/\bqihoobrowser\/?([\w\.]*)/i],[A,[E,"360"]],[/\b(qq)\/([\w\.]+)/i],[[E,/(.+)/,"$1Browser"],A],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[E,/(.+)/,"$1"+Kt],A],[/samsungbrowser\/([\w\.]+)/i],[A,[E,Ut+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[A,[E,Eo+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[E,Eo+" Mobile"],A],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[E,A],[/(lbbrowser|rekonq)/i],[E],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[A,E],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[E,Or],A,[g,tt]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(bing)(?:web|sapphire)\/([\w\.]+)/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[E,A,[g,tt]],[/\bgsa\/([\w\.]+) .*safari\//i],[A,[E,"GSA"],[g,tt]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[A,[E,"TikTok"],[g,tt]],[/\[(linkedin)app\]/i],[E,[g,tt]],[/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i],[[E,/(.+)/,"Zalo"],A,[g,tt]],[/(chromium)[\/ ]([-\w\.]+)/i],[E,A],[/headlesschrome(?:\/([\w\.]+)| )/i],[A,[E,mo+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[A,[E,Pn+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[E,mo+" WebView"],A],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[A,[E,"Android"+Kt]],[/chrome\/([\w\.]+) mobile/i],[A,[E,rt+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[E,A],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[A,[E,rt+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[E,rt+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[A,E],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[E,[A,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[E,A],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[E,rt+Gt],A],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[E,"Netscape"],A],[/(wolvic|librewolf)\/([\w\.]+)/i],[E,A],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[A,[E,Gt+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+(?= .+rv\:.+gecko\/\d+)|[0-4][\w\.]+(?!.+compatible))/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[E,[A,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[E,[A,/[^\d\.]+./,st]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[q,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[q,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[q,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[q,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[q,"arm"]],[/ sun4\w[;\)]/i],[[q,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i,/((ppc|powerpc)(64)?)( mac|;|\))/i,/(?:osf1|[freopnt]{3,4}bsd) (alpha)/i],[[q,/ower/,st,xe]],[/mc680.0/i],[[q,"68k"]],[/winnt.+\[axp/i],[[q,"alpha"]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[m,[y,Ut],[g,_]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[m,[y,Ut],[g,P]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)[\/\);]/i],[m,[y,nt],[g,P]],[/\b(?:ios|apple\w+)\/.+[\(\/](ipad)/i,/\b(ipad)[\d,]*[;\] ].+(mac |i(pad)?)os/i],[m,[y,nt],[g,_]],[/(macintosh);/i],[m,[y,nt]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[m,[y,go],[g,P]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[m,[y,po],[g,_]],[/honor([-\w ]+)[;\)]/i],[m,[y,po],[g,P]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[m,[y,uo],[g,_]],[/(?:huawei) ?([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i],[m,[y,uo],[g,P]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b(?:xiao)?((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[m,/_/g," "],[y,Tr],[g,_]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note|max|cc)?[_ ]?(?:\d{0,2}\w?)[_ ]?(?:plus|se|lite|pro)?( 5g|lte)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[m,/_/g," "],[y,Tr],[g,P]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[m,[y,fo],[g,P]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[m,[y,Cr],[g,P]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[m,[y,me,{OnePlus:["203","304","403","404","413","415"],"*":Cr}],[g,_]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[m,[y,"BLU"],[g,P]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[m,[y,"Vivo"],[g,P]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[m,[y,"Realme"],[g,P]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[m,[y,wr],[g,_]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[m,[y,wr],[g,P]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[m,[y,Sr],[g,P]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[m,[y,Sr],[g,_]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[m,[y,Rn],[g,_]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[m,[y,Rn],[g,P]],[/(nokia) (t[12][01])/i],[y,m,[g,_]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*?))( bui|\)|;|\/)/i],[[m,/_/g," "],[g,P],[y,"Nokia"]],[/(pixel (c|tablet))\b/i],[m,[y,Me],[g,_]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[m,[y,Me],[g,P]],[/(google) (pixelbook( go)?)/i],[y,m],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[m,[y,Ft],[g,P]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[m,"Xperia Tablet"],[y,Ft],[g,_]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[m,[y,Tn],[g,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[m,/(.+)/g,"Fire Phone $1"],[y,Tn],[g,P]],[/(playbook);[-\w\),; ]+(rim)/i],[m,y,[g,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/(?:blackberry|\(bb10;) (\w+)/i],[m,[y,lo],[g,P]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[m,[y,co],[g,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[m,[y,co],[g,P]],[/(nexus 9)/i],[m,[y,"HTC"],[g,_]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[y,[m,/_/g," "],[g,P]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[m,[y,"TCL"],[g,_]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[m,[y,"TCL"],[g,P]],[/(itel) ((\w+))/i],[[y,xe],m,[g,me,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[m,[y,"Acer"],[g,_]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[m,[y,"Meizu"],[g,P]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[m,[y,"Ulefone"],[g,P]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[m,[y,"Energizer"],[g,P]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[m,[y,"Cat"],[g,P]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[m,[y,"Smartfren"],[g,P]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[m,[y,"Nothing"],[g,P]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[m,[y,"Archos"],[g,_]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[m,[y,"Archos"],[g,P]],[/; (n159v)/i],[m,[y,"HMD"],[g,P]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[y,m,[g,_]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl|wiko)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i,/(hisense) ([ehv][\w ]+)\)/i,/droid[^;]+; (philips)[_ ]([sv-x][\d]{3,4}[xz]?)/i],[y,m,[g,P]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[y,m,[g,_]],[/(surface duo)/i],[m,[y,br],[g,_]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[m,[y,"Fairphone"],[g,P]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[m,[y,Ir],[g,_]],[/(sprint) (\w+)/i],[y,m,[g,P]],[/(kin\.[onetw]{3})/i],[[m,/\./g," "],[y,br],[g,P]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[m,[y,Rr],[g,_]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[m,[y,Rr],[g,P]],[/(philips)[\w ]+tv/i,/smart-tv.+(samsung)/i],[y,[g,H]],[/hbbtv.+maple;(\d+)/i],[[m,/^/,"SmartTV"],[y,Ut],[g,H]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[y,m,[g,H]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[y,Rn],[g,H]],[/(apple) ?tv/i],[y,[m,nt+" TV"],[g,H]],[/crkey.*devicetype\/chromecast/i],[[m,Pe+" Third Generation"],[y,Me],[g,H]],[/crkey.*devicetype\/([^/]*)/i],[[m,/^/,"Chromecast "],[y,Me],[g,H]],[/fuchsia.*crkey/i],[[m,Pe+" Nest Hub"],[y,Me],[g,H]],[/crkey/i],[[m,Pe],[y,Me],[g,H]],[/(portaltv)/i],[m,[y,Or],[g,H]],[/droid.+aft(\w+)( bui|\))/i],[m,[y,Tn],[g,H]],[/(shield \w+ tv)/i],[m,[y,Ir],[g,H]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[m,[y,go],[g,H]],[/(bravia[\w ]+)( bui|\))/i],[m,[y,Ft],[g,H]],[/(mi(tv|box)-?\w+) bui/i],[m,[y,Tr],[g,H]],[/Hbbtv.*(technisat) (.*);/i],[y,m,[g,H]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[y,/.+\/(\w+)/,"$1",me,{LG:"lge"}],[m,xn],[g,H]],[/(playstation \w+)/i],[m,[y,Ft],[g,Wt]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[m,[y,br],[g,Wt]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[y,m,[g,Wt]],[/droid.+; (shield)( bui|\))/i],[m,[y,Ir],[g,Wt]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[m,[y,Ut],[g,ge]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[y,m,[g,ge]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[m,[y,Cr],[g,ge]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[m,[y,nt],[g,ge]],[/(opwwe\d{3})/i],[m,[y,fo],[g,ge]],[/(moto 360)/i],[m,[y,Sr],[g,ge]],[/(smartwatch 3)/i],[m,[y,Ft],[g,ge]],[/(g watch r)/i],[m,[y,Rn],[g,ge]],[/droid.+; (wt63?0{2,3})\)/i],[m,[y,Rr],[g,ge]],[/droid.+; (glass) \d/i],[m,[y,Me],[g,Cn]],[/(pico) ([\w ]+) os\d/i],[y,m,[g,Cn]],[/(quest( \d| pro)?s?).+vr/i],[m,[y,Or],[g,Cn]],[/mobile vr; rv.+firefox/i],[[g,Cn]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[y,[g,$t]],[/(aeobc)\b/i],[m,[y,Tn],[g,$t]],[/(homepod).+mac os/i],[m,[y,nt],[g,$t]],[/windows iot/i],[[g,$t]],[/droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i],[m,[g,H]],[/\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i],[[g,H]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew|; hmsc).+?(mobile|vr|\d) safari/i],[m,[g,me,{mobile:"Mobile",xr:"VR","*":_}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[g,_]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[g,P]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[m,[y,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[A,[E,Pn+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[E,A],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[A,[E,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[E,A],[/ladybird\//i],[[E,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[A,E]],os:[[/(windows nt) (6\.[23]); arm/i],[[E,/N/,"R"],[A,me,yo]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[E,A],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[A,/(;|\))/g,"",me,yo],[E,Nr]],[/(windows ce)\/?([\d\.]*)/i],[E,A],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w\.]+)/i,/cfnetwork\/.+darwin/i],[[A,/_/g,"."],[E,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[E,"macOS"],[A,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[A,[E,Pe+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[A,[E,Pe+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[A,[E,Pe+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[A,[E,Pe+" Linux"]],[/crkey\/([\d\.]+)/i],[A,[E,Pe]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[A,E],[/(ubuntu) ([\w\.]+) like android/i],[[E,/(.+)/,"$1 Touch"],A],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[E,A],[/\(bb(10);/i],[A,[E,lo]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[A,[E,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[A,[E,Gt+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[A,[E,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[A,me,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[E,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[A,[E,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[E,"Chrome OS"],A],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[E,A],[/(sunos) ?([\d\.]*)/i],[[E,"Solaris"],A],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[E,A]]},On=function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return we.call(t.init,[[Z,[E,A,zt,g]],[Ae,[q]],[he,[g,m,y]],[ae,[E,A]],[ee,[E,A]]]),we.call(t.isIgnore,[[Z,[A,zt]],[ae,[A]],[ee,[A]]]),we.call(t.isIgnoreRgx,[[Z,/ ?browser$/i],[ee,/ ?os$/i]]),we.call(t.toString,[[Z,[E,A]],[Ae,[q]],[he,[y,m]],[ae,[E,A]],[ee,[E,A]]]),t}(),rc=function(t,e){var n=On.init[e],r=On.isIgnore[e]||0,i=On.isIgnoreRgx[e]||0,o=On.toString[e]||0;function s(){we.call(this,n)}return s.prototype.getItem=function(){return t},s.prototype.withClientHints=function(){return ve?ve.getHighEntropyValues(Io).then(function(a){return t.setCH(new Co(a,!1)).parseCH().get()}):t.parseCH().get()},s.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=it&&(s.prototype.is=function(a){var l=!1;for(var c in this)if(this.hasOwnProperty(c)&&!_r(r,c)&&xe(i?at(i,this[c]):this[c])==xe(i?at(i,a):a)){if(l=!0,a!=U.UNDEFINED)break}else if(a==U.UNDEFINED&&l){l=!l;break}return l},s.prototype.toString=function(){var a=st;for(var l in o)typeof this[o[l]]!==U.UNDEFINED&&(a+=(a?" ":st)+this[o[l]]);return a||U.UNDEFINED}),ve||(s.prototype.then=function(a){var l=this,c=function(){for(var p in l)l.hasOwnProperty(p)&&(this[p]=l[p])};c.prototype={is:s.prototype.is,toString:s.prototype.toString};var u=new c;return a(u),u}),new s};function Co(t,e){if(t=t||{},we.call(this,Io),e)we.call(this,[[kr,Pr(t[Ne])],[Lr,Pr(t[Ya])],[P,/\?1/.test(t[Ja])],[m,Vt(t[Za])],[ot,Vt(t[So])],[Dr,Vt(t[Qa])],[q,Vt(t[ja])],[Ue,Pr(t[Xa])],[Nn,Vt(t[qa])]]);else for(var n in t)this.hasOwnProperty(n)&&typeof t[n]!==U.UNDEFINED&&(this[n]=t[n])}function bo(t,e,n,r){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(Q&&Q.userAgent==this.ua)switch(this.itemType){case Z:Q.brave&&typeof Q.brave.isBrave==U.FUNCTION&&this.set(E,"Brave");break;case he:!this.get(g)&&ve&&ve[P]&&this.set(g,P),this.get(m)=="Macintosh"&&Q&&typeof Q.standalone!==U.UNDEFINED&&Q.maxTouchPoints&&Q.maxTouchPoints>2&&this.set(m,"iPad").set(g,_);break;case ee:!this.get(E)&&ve&&ve[ot]&&this.set(E,ve[ot]);break;case it:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set(Z,o(Z)).set(Ae,o(Ae)).set(he,o(he)).set(ae,o(ae)).set(ee,o(ee))}return this},this.parseUA=function(){switch(this.itemType!=it&&xr.call(this.data,this.ua,this.rgxMap),this.itemType){case Z:this.set(zt,vr(this.get(A)));break;case ee:if(this.get(E)=="iOS"&&this.get(A)=="18.6"){var i=/\) Version\/([\d\.]+)/.exec(this.ua);i&&parseInt(i[1].substring(0,2),10)>=26&&this.set(A,i[1])}break}return this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case Z:case ae:var s=i[Lr]||i[kr],a;if(s)for(var l=0;l<s.length;l++){var c=s[l].brand||s[l],u=s[l].version;this.itemType==Z&&!/not.a.brand/i.test(c)&&(!a||/Chrom/.test(a)&&c!=ho||a==Pn&&/WebView2/.test(c))&&(c=me(c,nc),a=this.get(E),a&&!/Chrom/.test(a)&&/Chrom/.test(c)||this.set(E,c).set(A,u).set(zt,vr(u)),a=c),this.itemType==ae&&c==ho&&this.set(A,u)}break;case Ae:var p=i[q];p&&(p&&i[Nn]=="64"&&(p+="64"),xr.call(this.data,p+";",o));break;case he:if(i[P]&&this.set(g,P),i[m]&&(this.set(m,i[m]),!this.get(g)||!this.get(y))){var b={};xr.call(b,"droid 9; "+i[m]+")",o),!this.get(g)&&b.type&&this.set(g,b.type),!this.get(y)&&b.vendor&&this.set(y,b.vendor)}if(i[Ue]){var w;if(typeof i[Ue]!="string")for(var f=0;!w&&f<i[Ue].length;)w=me(i[Ue][f++],Ao);else w=me(i[Ue],Ao);this.set(g,w)}break;case ee:var I=i[ot];if(I){var h=i[Dr];I==Nr&&(h=parseInt(vr(h),10)>=13?"11":"10"),this.set(E,I).set(A,h)}this.get(E)==Nr&&i[m]=="Xbox"&&this.set(E,"Xbox").set(A,void 0);break;case it:var R=this.data,x=function(C){return R[C].getItem().setCH(i).parseCH().get()};this.set(Z,x(Z)).set(Ae,x(Ae)).set(he,x(he)).set(ae,x(ae)).set(ee,x(ee))}return this},we.call(this,[["itemType",t],["ua",e],["uaCH",r],["rgxMap",n],["data",rc(this,t)]]),this}function te(t,e,n){if(typeof t===U.OBJECT?(vn(t,!0)?(typeof e===U.OBJECT&&(n=e),e=t):(n=t,e=void 0),t=void 0):typeof t===U.STRING&&!vn(e,!0)&&(n=e,e=void 0),n)if(typeof n.append===U.FUNCTION){var r={};n.forEach(function(u,p){r[String(p).toLowerCase()]=u}),n=r}else{var i={};for(var o in n)n.hasOwnProperty(o)&&(i[String(o).toLowerCase()]=n[o]);n=i}if(!(this instanceof te))return new te(t,e,n).getResult();var s=typeof t===U.STRING?t:n&&n[so]?n[so]:Q&&Q.userAgent?Q.userAgent:st,a=new Co(n,!0),l=e?tc(wo,e):wo,c=function(u){return u==it?function(){return new bo(u,s,l,a).set("ua",s).set(Z,this.getBrowser()).set(Ae,this.getCPU()).set(he,this.getDevice()).set(ae,this.getEngine()).set(ee,this.getOS()).get()}:function(){return new bo(u,s,l[u],a).parseUA().get()}};return we.call(this,[["getBrowser",c(Z)],["getCPU",c(Ae)],["getDevice",c(he)],["getEngine",c(ae)],["getOS",c(ee)],["getResult",c(it)],["getUA",function(){return s}],["setUA",function(u){return Yt(u)&&(s=xn(u,za)),this}]]).setUA(s),this}te.VERSION=$a;te.BROWSER=_n([E,A,zt,g]);te.CPU=_n([q]);te.DEVICE=_n([m,y,g,Wt,P,H,_,ge,$t]);te.ENGINE=te.OS=_n([E,A]);var $p=Object.freeze({115:"115",2345:"2345",360:"360",ALIPAY:"Alipay",AMAYA:"Amaya",ANDROID:"Android Browser",ARORA:"Arora",AVANT:"Avant",AVAST:"Avast Secure Browser",AVG:"AVG Secure Browser",BAIDU:"Baidu Browser",BASILISK:"Basilisk",BING:"Bing",BLAZER:"Blazer",BOLT:"Bolt",BOWSER:"Bowser",BRAVE:"Brave",CAMINO:"Camino",CHIMERA:"Chimera",CHROME:"Chrome",CHROME_HEADLESS:"Chrome Headless",CHROME_MOBILE:"Mobile Chrome",CHROME_WEBVIEW:"Chrome WebView",CHROMIUM:"Chromium",COBALT:"Cobalt",COC_COC:"Coc Coc",CONKEROR:"Conkeror",DAUM:"Daum",DILLO:"Dillo",DOLPHIN:"Dolphin",DOOBLE:"Dooble",DORIS:"Doris",DRAGON:"Dragon",DUCKDUCKGO:"DuckDuckGo",ECOSIA:"Ecosia",EDGE:"Edge",EDGE_WEBVIEW:"Edge WebView",EDGE_WEBVIEW2:"Edge WebView2",EPIPHANY:"Epiphany",FACEBOOK:"Facebook",FALKON:"Falkon",FIREBIRD:"Firebird",FIREFOX:"Firefox",FIREFOX_FOCUS:"Firefox Focus",FIREFOX_MOBILE:"Mobile Firefox",FIREFOX_REALITY:"Firefox Reality",FENNEC:"Fennec",FLOCK:"Flock",FLOW:"Flow",GO:"GoBrowser",GOOGLE_SEARCH:"GSA",HELIO:"Helio",HEYTAP:"HeyTap",HONOR:"Honor",HUAWEI:"Huawei Browser",ICAB:"iCab",ICE:"ICE Browser",ICEAPE:"IceApe",ICECAT:"IceCat",ICEDRAGON:"IceDragon",ICEWEASEL:"IceWeasel",IE:"IE",INSTAGRAM:"Instagram",IRIDIUM:"Iridium",IRON:"Iron",JASMINE:"Jasmine",KONQUEROR:"Konqueror",KAKAO:"KakaoTalk",KHTML:"KHTML",K_MELEON:"K-Meleon",KLAR:"Klar",KLARNA:"Klarna",KINDLE:"Kindle",LENOVO:"Smart Lenovo Browser",LADYBIRD:"Ladybird",LG:"LG Browser",LIBREWOLF:"LibreWolf",LIEBAO:"LBBROWSER",LINE:"Line",LINKEDIN:"LinkedIn",LINKS:"Links",LUNASCAPE:"Lunascape",LYNX:"Lynx",MAEMO:"Maemo Browser",MAXTHON:"Maxthon",MIDORI:"Midori",MINIMO:"Minimo",MIUI:"MIUI Browser",MOZILLA:"Mozilla",MOSAIC:"Mosaic",NAVER:"Naver",NETFRONT:"NetFront",NETSCAPE:"Netscape",NETSURF:"Netsurf",NOKIA:"Nokia Browser",OBIGO:"Obigo",OCULUS:"Oculus Browser",OMNIWEB:"OmniWeb",OPERA:"Opera",OPERA_COAST:"Opera Coast",OPERA_GX:"Opera GX",OPERA_MINI:"Opera Mini",OPERA_MOBI:"Opera Mobi",OPERA_TABLET:"Opera Tablet",OPERA_TOUCH:"Opera Touch",OTTER:"Otter",OVI:"OviBrowser",PALEMOON:"PaleMoon",PHANTOMJS:"PhantomJS",PHOENIX:"Phoenix",PICOBROWSER:"Pico Browser",POLARIS:"Polaris",PUFFIN:"Puffin",QQ:"QQBrowser",QQ_LITE:"QQBrowserLite",QUARK:"Quark",QUPZILLA:"QupZilla",QUTEBROWSER:"qutebrowser",QWANT:"Qwant",REKONQ:"rekonq",ROCKMELT:"Rockmelt",SAFARI:"Safari",SAFARI_MOBILE:"Mobile Safari",SAILFISH:"Sailfish Browser",SAMSUNG:"Samsung Internet",SEAMONKEY:"SeaMonkey",SILK:"Silk",SKYFIRE:"Skyfire",SLEIPNIR:"Sleipnir",SLIMBOAT:"SlimBoat",SLIMBROWSER:"SlimBrowser",SLIMJET:"Slimjet",SNAPCHAT:"Snapchat",SOGOU_EXPLORER:"Sogou Explorer",SOGOU_MOBILE:"Sogou Mobile",SURF:"Surf",SWIFTFOX:"Swiftfox",TESLA:"Tesla",TIKTOK:"TikTok",TIZEN:"Tizen Browser",TWITTER:"Twitter",UC:"UCBrowser",UP:"UP.Browser",VIVALDI:"Vivaldi",VIVO:"Vivo Browser",W3M:"w3m",WATERFOX:"Waterfox",WEBKIT:"WebKit",WECHAT:"WeChat",WEIBO:"Weibo",WHALE:"Whale",WOLVIC:"Wolvic",YANDEX:"Yandex",ZALO:"Zalo"});var jt=Object.freeze({CRAWLER:"crawler",CLI:"cli",EMAIL:"email",FETCHER:"fetcher",INAPP:"inapp",MEDIAPLAYER:"mediaplayer",LIBRARY:"library"}),To=Object.freeze({"68K":"68k",ALPHA:"alpha",ARM:"arm",ARM_64:"arm64",ARM_HF:"armhf",AVR:"avr",AVR_32:"avr32",IA64:"ia64",IRIX:"irix",IRIX_64:"irix64",MIPS:"mips",MIPS_64:"mips64",PA_RISC:"pa-risc",PPC:"ppc",SPARC:"sparc",SPARC_64:"sparc64",X86:"ia32",X86_64:"amd64"});var zp=Object.freeze({CONSOLE:"console",DESKTOP:"desktop",EMBEDDED:"embedded",MOBILE:"mobile",SMARTTV:"smarttv",TABLET:"tablet",WEARABLE:"wearable",XR:"xr"});var Yp=Object.freeze({ACER:"Acer",ADVAN:"Advan",ALCATEL:"Alcatel",APPLE:"Apple",AMAZON:"Amazon",ARCHOS:"Archos",ASUS:"ASUS",ATT:"AT&T",BENQ:"BenQ",BLACKBERRY:"BlackBerry",BLU:"BLU",CAT:"Cat",DELL:"Dell",ENERGIZER:"Energizer",ESSENTIAL:"Essential",FACEBOOK:"Facebook",FAIRPHONE:"Fairphone",GEEKSPHONE:"GeeksPhone",GENERIC:"Generic",GOOGLE:"Google",HISENSE:"Hisense",HMD:"HMD",HP:"HP",HTC:"HTC",HUAWEI:"Huawei",IMO:"IMO",INFINIX:"Infinix",ITEL:"itel",JOLLA:"Jolla",KOBO:"Kobo",LAVA:"Lava",LENOVO:"Lenovo",LG:"LG",MEIZU:"Meizu",MICROMAX:"Micromax",MICROSOFT:"Microsoft",MOTOROLA:"Motorola",NEXIAN:"Nexian",NINTENDO:"Nintendo",NOKIA:"Nokia",NOTHING:"Nothing",NVIDIA:"Nvidia",ONEPLUS:"OnePlus",OPPO:"OPPO",OUYA:"Ouya",PALM:"Palm",PANASONIC:"Panasonic",PEBBLE:"Pebble",PHILIPS:"Philips",PICO:"Pico",POLYTRON:"Polytron",REALME:"Realme",RETROID:"Retroid",RIM:"RIM",ROKU:"Roku",SAMSUNG:"Samsung",SHARP:"Sharp",SIEMENS:"Siemens",SMARTFREN:"Smartfren",SONY:"Sony",SPRINT:"Sprint",TCL:"TCL",TECHNISAT:"TechniSAT",TECNO:"TECNO",TESLA:"Tesla",ULEFONE:"Ulefone",VIVO:"Vivo",VIZIO:"Vizio",VODAFONE:"Vodafone",WIKO:"Wiko",XBOX:"Xbox",XIAOMI:"Xiaomi",ZEBRA:"Zebra",ZTE:"ZTE"});var Ro=Object.freeze({AMAYA:"Amaya",ARKWEB:"ArkWeb",BLINK:"Blink",EDGEHTML:"EdgeHTML",FLOW:"Flow",GECKO:"Gecko",GOANNA:"Goanna",ICAB:"iCab",KHTML:"KHTML",LIBWEB:"LibWeb",LINKS:"Links",LYNX:"Lynx",NETFRONT:"NetFront",NETSURF:"NetSurf",PRESTO:"Presto",SERVO:"Servo",TASMAN:"Tasman",TRIDENT:"Trident",W3M:"w3m",WEBKIT:"WebKit"});var Oo=Object.freeze({AIX:"AIX",AMIGA_OS:"Amiga OS",ANDROID:"Android",ANDROID_X86:"Android-x86",ARCAOS:"ArcaOS",ARCH:"Arch",BADA:"Bada",BEOS:"BeOS",BLACKBERRY:"BlackBerry",CENTOS:"CentOS",CHROME_OS:"Chrome OS",CHROMECAST:"Chromecast",CHROMECAST_ANDROID:"Chromecast Android",CHROMECAST_FUCHSIA:"Chromecast Fuchsia",CHROMECAST_LINUX:"Chromecast Linux",CHROMECAST_SMARTSPEAKER:"Chromecast SmartSpeaker",CONTIKI:"Contiki",DEBIAN:"Debian",DEEPIN:"Deepin",DRAGONFLY:"DragonFly",ELEMENTARY_OS:"elementary OS",FEDORA:"Fedora",FIREFOX_OS:"Firefox OS",FREEBSD:"FreeBSD",FUCHSIA:"Fuchsia",GENTOO:"Gentoo",GHOSTBSD:"GhostBSD",GNU:"GNU",HAIKU:"Haiku",HARMONYOS:"HarmonyOS",HP_UX:"HP-UX",HURD:"Hurd",IOS:"iOS",JOLI:"Joli",KAIOS:"KaiOS",KNOPPIX:"Knoppix",KUBUNTU:"Kubuntu",LINPUS:"Linpus",LINSPIRE:"Linspire",LINUX:"Linux",MACOS:"macOS",MAEMO:"Maemo",MAGEIA:"Mageia",MANDRIVA:"Mandriva",MANJARO:"Manjaro",MEEGO:"MeeGo",MINIX:"Minix",MINT:"Mint",MORPH_OS:"Morph OS",NETBSD:"NetBSD",NETRANGE:"NetRange",NETTV:"NetTV",NINTENDO:"Nintendo",OPENHARMONY:"OpenHarmony",OPENBSD:"OpenBSD",OPENVMS:"OpenVMS",OS2:"OS/2",PALM:"Palm",PC_BSD:"PC-BSD",PCLINUXOS:"PCLinuxOS",PICO:"Pico",PLAN9:"Plan9",PLAYSTATION:"PlayStation",QNX:"QNX",RASPBIAN:"Raspbian",REDHAT:"RedHat",RIM_TABLET_OS:"RIM Tablet OS",RISC_OS:"RISC OS",SABAYON:"Sabayon",SAILFISH:"Sailfish",SERENITYOS:"SerenityOS",SERIES40:"Series40",SLACKWARE:"Slackware",SOLARIS:"Solaris",SUSE:"SUSE",SYMBIAN:"Symbian",TIZEN:"Tizen",UBUNTU:"Ubuntu",UBUNTU_TOUCH:"Ubuntu Touch",UNIX:"Unix",VECTORLINUX:"VectorLinux",WATCHOS:"watchOS",WEBOS:"WebOS",WINDOWS:"Windows",WINDOWS_CE:"Windows CE",WINDOWS_IOT:"Windows IoT",WINDOWS_MOBILE:"Windows Mobile",WINDOWS_PHONE:"Windows Phone",WINDOWS_RT:"Windows RT",XBOX:"Xbox",XUBUNTU:"Xubuntu",ZENWALK:"Zenwalk"});var Po=Object.freeze({BrowserName:{CLI:{CURL:"curl",ELINKS:"ELinks",HTTPIE:"HTTPie",LYNX:"Lynx",WGET:"Wget"},Crawler:{AHREFS_BOT:"AhrefsBot",AI2_BOT:"AI2Bot",AIHIT_BOT:"aiHitBot",ALGOLIA_CRAWLER:"Algolia Crawler",APPLE_BOT:"Applebot",APPLE_BOT_EXTENDED:"Applebot-Extended",ASK_TEOMA:"Teoma",AMAZON_BOT:"Amazonbot",AMAZON_CONTXBOT:"contxbot",ANTHROPIC_AI:"anthropic-ai",ANTHROPIC_CLAUDE_BOT:"ClaudeBot",ANTHROPIC_CLAUDE_SEARCHBOT:"Claude-SearchBot",ANTHROPIC_CLAUDE_WEB:"Claude-Web",ARCHIVEORG_BOT:"archive.org_bot",BAIDU_ADS:"Baidu-ADS",BAIDU_SPIDER:"Baiduspider",BAIDU_SPIDER_ADS:"Baiduspider-ads",BAIDU_SPIDER_CPRO:"Baiduspider-cpro",BAIDU_SPIDER_FAVO:"Baiduspider-favo",BAIDU_SPIDER_IMAGE:"Baiduspider-image",BAIDU_SPIDER_NEWS:"Baiduspider-news",BAIDU_SPIDER_RENDER:"Baiduspider-render",BAIDU_SPIDER_VIDEO:"Baiduspider-video",BLEX_BOT:"BLEXBot",BOTIFY:"botify",BRAVE_BOT:"Bravebot",BYTEDANCE_BYTESPIDER:"Bytespider",BYTEDANCE_TIKTOKSPIDER:"TikTokSpider",COMMON_CRAWL_CCBOT:"CCBot",COCCOC_BOT_WEB:"coccocbot-web",COCCOC_BOT_IMAGE:"coccocbot-image",COHERE_TRAINING_DATA_CRAWLER:"cohere-training-data-crawler",COTOYOGI:"Cotoyogi",COVEO_BOT:"Coveobot",CRITEO_BOT:"CriteoBot",DATAFORSEO_BOT:"DataForSeoBot",DAUM:"Daum",DAUM_DAUMOA:"Daumoa",DAUM_DAUMOA_IMAGE:"Daumoa-image",DEEPSEEK_BOT:"DeepSeekBot",DIFFBOT:"Diffbot",DUCKDUCKGO_BOT:"DuckDuckBot",DUCKDUCKGO_FAVICONS_BOT:"DuckDuckGo-Favicons-Bot",ELASTIC:"Elastic",ELASTIC_SWIFTYPE_BOT:"Swiftbot",EXALEAD_EXABOT:"Exabot",FIRECRAWL_AGENT:"FirecrawlAgent",FREESPOKE:"Freespoke",GOOGLE_ADSBOT:"AdsBot-Google",GOOGLE_ADSBOT_MOBILE:"Adsbot-Google-Mobile",GOOGLE_ADSENSE:"AdSense",GOOGLE_APIS:"APIs-Google",GOOGLE_BOT:"Googlebot",GOOGLE_BOT_IMAGE:"Googlebot-Image",GOOGLE_BOT_NEWS:"Googlebot-News",GOOGLE_BOT_VIDEO:"Googlebot-Video",GOOGLE_CLOUDVERTEXBOT:"Google-CloudVertexBot",GOOGLE_EXTENDED:"Google-Extended",GOOGLE_INSPECTIONTOOL:"Google-InspectionTool",GOOGLE_OTHER:"GoogleOther",GOOGLE_OTHER_IMAGE:"GoogleOther-Image",GOOGLE_OTHER_VIDEO:"GoogleOther-Video",GOOGLE_SAFETY:"Google-Safety",GOOGLE_STOREBOT:"Storebot-Google",HIVE_IMAGESIFTBOT:"ImagesiftBot",HUAWEI_PANGUBOT:"PanguBot",HUAWEI_PETALBOT:"PetalBot",HUGGINGFACE_BOT:"HuggingFace-Bot",HUNTER_VELENPUBLICWEBCRAWLER:"VelenPublicWebCrawler",IA_ARCHIVER:"ia_archiver",IASK_BOT:"iAskBot",KAGI_BOT:"Kagibot",KANGAROO_BOT:"Kangaroo Bot",LINE_SPIDER:"Linespider",LINKEDIN_BOT:"LinkedInBot",MAGPIE_CRAWLER:"magpie-crawler",MARGINALIA:"marginalia",META_EXTERNALAGENT:"meta-externalagent",META_FACEBOOKBOT:"FacebookBot",META_FACEBOOKCATALOG:"facebookcatalog",META_FACEBOOKEXTERNALHIT:"facebookexternalhit",MAJESTIC_MJ12BOT:"MJ12bot",MICROSOFT_BINGBOT:"Bingbot",MICROSOFT_MSNBOT:"msnbot",MICROSOFT_ADIDXBOT:"adidxbot",MOJEEK_BOT:"MojeekBot",MOZ_DOTBOT:"DotBot",ONCRAWL:"OnCrawl",ONESPOT_SCRAPERBOT:"Onespot-ScraperBot",OPENAI_GPTBOT:"GPTBot",OPENAI_SEARCH_BOT:"OAI-SearchBot",PERPLEXITY_BOT:"PerplexityBot",QIHOO_360_SPIDER:"360Spider",QWANT_BOT:"Qwantbot",QWANT_BOT_NEWS:"Qwantbot-news",REPLICATE_BOT:"Replicate-Bot",RUNPOD_BOT:"RunPod-Bot",SB_INTUITIONS_BOT:"SBIntuitionsBot",SEEKPORT_BOT:"SeekportBot",SEMRUSH_BOT:"SemrushBot",SEMRUSH_BOT_BACKLINK:"SemrushBot-BA",SEMRUSH_BOT_CONTENTSHAKE:"SemrushBot-OCOB",SEMRUSH_BOT_SEO_CHECKER:"SemrushBot-SI",SEZNAM_BOT:"SeznamBot",SITEIMPROVE:"Siteimprove",SOGOU_PIC_SPIDER:"Sogou Pic Spider",SOGOU_WEB_SPIDER:"Sogou web spider",STARTPAGE:"Startpage",SURLY_BOT:"SurdotlyBot",TIMPI_BOT:"Timpibot",TOGETHER_BOT:"Together-Bot",TURNITIN_BOT:"TurnitinBot",TWIN_AGENT:"TwinAgent",VERCEL_V0BOT:"v0bot",WEBZIO:"webzio",WEBZIO_EXTENDED:"Webzio-Extended",WEBZIO_OMGILI:"omgili",WEBZIO_OMGILI_BOT:"omgilibot",XAI_BOT:"xAI-Bot",YAHOO_JAPAN:"Y!J-BRW",YAHOO_SLURP:"Yahoo! Slurp",YANDEX_ACCESSIBILITY_BOT:"YandexAccessibilityBot",YANDEX_ADDITIONAL_BOT:"YandexAdditionalBot",YANDEX_ADNET:"YandexAdNet",YANDEX_BLOGS:"YandexBlogs",YANDEX_BOT:"YandexBot",YANDEX_BOT_MIRRORDETECTOR:"YandexBot MirrorDetector",YANDEX_COMBOT:"YandexComBot",YANDEX_FAVICONS:"YandexFavicons",YANDEX_IMAGE_RESIZER:"YandexImageResizer",YANDEX_IMAGES:"YandexImages",YANDEX_MARKET:"YandexMarket",YANDEX_MEDIA:"YandexMedia",YANDEX_METRIKA:"YandexMetrika",YANDEX_MOBILE_BOT:"YandexMobileBot",YANDEX_MOBILE_SCREENSHOT_BOT:"YandexMobileScreenShotBot",YANDEX_NEWS:"YandexNews",YANDEX_ONTODB:"YandexOntoDB",YANDEX_ONTODB_API:"YandexOntoDBAPI",YANDEX_PARTNER:"YandexPartner",YANDEX_RCA:"YandexRCA",YANDEX_RENDERRESOURCES_BOT:"YandexRenderResourcesBot",YANDEX_SCREENSHOT_BOT:"YandexScreenshotBot",YANDEX_SPRAV_BOT:"YandexSpravBot",YANDEX_TRACKER:"YandexTracker",YANDEX_VERTICALS:"YandexVerticals",YANDEX_VERTIS:"YandexVertis",YANDEX_VIDEO:"YandexVideo",YANDEX_VIDEO_PARSER:"YandexVideoParser",YANDEX_WEBMASTER:"YandexWebmaster",YEP_BOT:"YepBot",YETI:"Yeti",YISOU_SPIDER:"YisouSpider",YOU_BOT:"YouBot",ZHIPU_CHATGLM_SPIDER:"ChatGLM-Spider",ZUM_BOT:"ZumBot"},Email:{AIRMAIL:"Airmail",APPLE_MAIL:"Mail",BLUEMAIL:"BlueMail",DAUM_MAIL:"DaumMail",EVOLUTION:"Evolution",EM_CLIENT:"eM Client",FOXMAIL:"Foxmail",KMAIL:"KMail",KMAIL2:"kmail2",KONTACT:"Kontact",MICROSOFT_OUTLOOK:"Microsoft Outlook",MICROSOFT_OUTLOOK_MAC:"MacOutlook",NAVER_MAILAPP:"NaverMailApp",POLYMAIL:"Polymail",PROTON_MAIL:"ProtonMail",SPARK_MAIL:"SparkDesktop",SPARROW:"Sparrow",THUNDERBIRD:"Thunderbird",YAHOO_MAIL:"Yahoo",ZIMBRA:"Zimbra",ZOHO_MAIL:"ZohoMail-Desktop"},Fetcher:{AHREFS_SITEAUDIT:"AhrefsSiteAudit",ANTHROPIC_CLAUDE_USER:"Claude-User",ASANA:"Asana",BETTER_UPTIME_BOT:"Better Uptime Bot",BITLY_BOT:"bitlybot",BLUESKY:"Bluesky",BUFFER_LINKPREVIEWBOT:"BufferLinkPreviewBot",COHERE_AI:"Cohere-AI",DISCORD_BOT:"Discordbot",DUCKDUCKGO_ASSISTBOT:"DuckAssistBot",GOOGLE_CHROME_LIGHTHOUSE:"Chrome-Lighthouse",GOOGLE_FEEDFETCHER:"FeedFetcher-Google",GOOGLE_GEMINI_DEEP_RESEARCH:"Gemini-Deep-Research",GOOGLE_IMAGEPROXY:"GoogleImageProxy",GOOGLE_PAGERENDERER:"Google-PageRenderer",GOOGLE_READ_ALOUD:"Google-Read-Aloud",GOOGLE_PRODUCER:"GoogleProducer",GOOGLE_SITE_VERIFICATION:"Google-Site-Verification",HUBSPOT_PAGE_FETCHER:"HubSpot Page Fetcher",IFRAMELY:"Iframely",KAKAOTALK_SCRAP:"kakaotalk-scrap",KEYBASE_BOT:"KeybaseBot",META_EXTERNALFETCHER:"meta-externalfetcher",META_WHATSAPP:"WhatsApp",MICROSOFT_BINGPREVIEW:"BingPreview",MICROSOFT_PREVIEW:"MicrosoftPreview",MISTRALAI_USER:"MistralAI-User",NAVER_BLUENO:"Blueno",ONCRAWL_ROGERBOT:"rogerbot",OPENAI_CHATGPT_USER:"ChatGPT-User",PERPLEXITY_USER:"Perplexity-User",PINTEREST_BOT:"Pinterestbot",SEMRUSH_SITEAUDITBOT:"SiteAuditBot",SLACK_BOT:"Slackbot",SLACK_BOT_LINKEXPANDING:"Slackbot-LinkExpanding",SLACK_IMGPROXY:"Slack-ImgProxy",SNAP_URL_PREVIEW:"Snap URL Preview",SKYPE_URIPREVIEW:"SkypeUriPreview",TELEGRAM_BOT:"TelegramBot",UPTIMEROBOT:"UptimeRobot",VERCEL_FAVICON_BOT:"vercel-favicon-bot",VERCEL_SCREENSHOT_BOT:"vercel-screenshot-bot",VERCEL_BOT:"Vercelbot",VERCEL_FLAGS:"vercelflags",VERCEL_TRACING:"verceltracing",X_TWITTERBOT:"Twitterbot",YANDEX_CALENDAR:"YandexCalendar",YANDEX_DIRECT:"YandexDirect",YANDEX_DIRECTDYN:"YandexDirectDyn",YANDEX_DIRECTFETCHER:"YaDirectFetcher",YANDEX_FORDOMAIN:"YandexForDomain",YANDEX_PAGECHECKER:"YandexPagechecker",YANDEX_SEARCHSHOP:"YandexSearchShop",YANDEX_SITELINKS:"YandexSitelinks",YANDEX_USERPROXY:"YandexUserproxy",ZOOMINFO_BOT:"Zoombot"},InApp:{DISCORD:"Discord",EVERNOTE:"Evernote",FIGMA:"Figma",FLIPBOARD:"Flipboard",MATTERMOST:"Mattermost",TEAMS:"Teams",NOTION:"Notion",POSTMAN:"Postman",RAMBOX:"Rambox",ROCKETCHAT:"Rocket.Chat",SLACK:"Slack",TIKTOK_LITE:"TikTok Lite",VSCODE:"VS Code",YAHOO_JAPAN:"Yahoo! Japan"},Library:{ADOBE_AIR:"AdobeAIR",AIOHTTP:"aiohttp",APACHE_HTTPCLIENT:"Apache-HttpClient",AXIOS:"axios",GO_HTTP_CLIENT:"go-http-client",GOT:"got",GUZZLEHTTP:"GuzzleHttp",JAVA:"Java",JAVA_HTTPCLIENT:"Java-http-client",JSDOM:"jsdom",LIBWWW_PERL:"libwww-perl",LUA_RESTY_HTTP:"lua-resty-http",NEEDLE:"Needle",NUTCH:"Nutch",OKHTTP:"OkHttp",NODE_FETCH:"node-fetch",NODE_SUPERAGENT:"node-superagent",PHP_SOAP:"PHP-SOAP",POSTMAN_RUNTIME:"PostmanRuntime",PYTHON_HTTPX:"python-httpx",PYTHON_URLLIB:"python-urllib",PYTHON_URLLIB3:"python-urllib3",PYTHON_REQUESTS:"python-requests",SCRAPY:"Scrapy"}},DeviceVendor:{Vehicle:{BMW:"BMW",BYD:"BYD",JEEP:"Jeep",RIVIAN:"Rivian",TESLA:"Tesla",VOLVO:"Volvo"}}});var D="model",F="name",v="type",k="vendor",z="version",Fe="mobile",X="tablet",Br="crawler",ic="cli",vo="email",xo="fetcher",ct="inapp",qt="mediaplayer",oc="library",sc=Object.freeze({browser:[[/(wget|curl|lynx|elinks|httpie)[\/ ]\(?([\w\.-]+)/i],[F,z,[v,ic]]]}),_o=Object.freeze({browser:[[/((?:adidx|ahrefs|amazon|bing|brave|cc|contx|coveo|criteo|dot|duckduck(?:go-favicons-)?|exa|facebook|gpt|iask|kagi|kangaroo |linkedin|mj12|mojeek|oai-search|onespot-scraper|perplexity|sbintuitions|semrush|seznam|surdotly|swift|yep)bot)\/([\w\.-]+)/i,/(algolia crawler(?: renderscript)?)\/?([\w\.]*)/i,/(applebot(?:-extended)?)\/?([\w\.]*)/i,/(baiduspider[-imagevdonwsfcpr]{0,7})\/?([\w\.]*)/i,/(claude(?:bot|-searchbot|-web)|anthropic-ai)\/?([\w\.]*)/i,/(coccocbot-(?:image|web))\/([\w\.]+)/i,/(daum(?:oa)?(?:-image)?)[ \/]([\w\.]+)/i,/(facebook(?:externalhit|catalog)|meta-externalagent)\/([\w\.]+)/i,/(google(?:bot|other|-inspectiontool)(?:-image|-video|-news)?|storebot-google)\/?([\w\.]*)/i,/(ia_archiver|archive\.org_bot)\/?([\w\.]*)/i,/(oncrawl) mobile\/([\w\.]+)/i,/(qwantbot(?:-news)?)[-\w]*\/?([\w\.]*)/i,/((?:semrush|splitsignal)bot[-abcfimostw]*)\/?([\w\.-]*)/i,/(sogou (?:pic|head|web|orion|news) spider)\/([\w\.]+)/i,/(y!?j-(?:asr|br[uw]|dscv|mmp|vsidx|wsc))\/([\w\.]+)/i,/(yandex(?:(?:mobile)?(?:accessibility|additional|com|renderresources|screenshot|sprav)?bot(?!.+mirror)|image(?:s|resizer)|adnet|blogs|favicons|market|media|metrika|news|ontodb(?:api)?|partner|rca|tracker|turbo|verti(?:cal)?s|webmaster|video(?:parser)?))\/([\w\.]+)/i,/(yeti)\/([\w\.]+)/i,/((?:aihit|blex|diff|huggingface-|msn|pangu|replicate-|runpod-|timpi|together-|xai-|you|zum)bot|(?:magpie-|velenpublicweb)crawler|(?:chatglm-|line|screaming frog seo |yisou)spider|cotoyogi|firecrawlagent|freespoke|omgili(?:bot)?|openai image downloader|startpageprivateimageproxy|twinagent|webzio-extended)\/?([\w\.]*)/i],[F,z,[v,Br]],[/(yandexbot\/([\w\.]+); mirrordetector)/i],[[F,/\/.+;/ig,""],z,[v,Br]],[/((?:adsbot|apis|mediapartners)-google(?:-mobile)?|google-?(?:other|cloudvertexbot|extended|safety))/i,/\b((ai2|aspiegel|dataforseo|deepseek|imagesift|petal|seekport|turnitin|v0)bot|360spider-?(image|video)?|baidu-ads|botify|(byte|tiktok)spider|cohere-training-data-crawler|elastic(?=\/s)|marginalia|siteimprove(?=bot|\.com)|teoma|webzio|yahoo! slurp)/i],[F,[v,Br]]]}),qp=Object.freeze({device:[[/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[k,D,[v,X]],[/(u304aa)/i],[D,[k,"AT&T"],[v,Fe]],[/\bsie-(\w*)/i],[D,[k,"Siemens"],[v,Fe]],[/\b(rct\w+) b/i],[D,[k,"RCA"],[v,X]],[/\b(venue[\d ]{2,7}) b/i],[D,[k,"Dell"],[v,X]],[/\b(q(?:mv|ta)\w+) b/i],[D,[k,"Verizon"],[v,X]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[D,[k,"Barnes & Noble"],[v,X]],[/\b(tm\d{3}\w+) b/i],[D,[k,"NuVision"],[v,X]],[/\b(k88) b/i],[D,[k,"ZTE"],[v,X]],[/\b(nx\d{3}j) b/i],[D,[k,"ZTE"],[v,Fe]],[/\b(gen\d{3}) b.+49h/i],[D,[k,"Swiss"],[v,Fe]],[/\b(zur\d{3}) b/i],[D,[k,"Swiss"],[v,X]],[/^((zeki)?tb.*\b) b/i],[D,[k,"Zeki"],[v,X]],[/\b([yr]\d{2}) b/i,/\b(?:dragon[- ]+touch |dt)(\w{5}) b/i],[D,[k,"Dragon Touch"],[v,X]],[/\b(ns-?\w{0,9}) b/i],[D,[k,"Insignia"],[v,X]],[/\b((nxa|next)-?\w{0,9}) b/i],[D,[k,"NextBook"],[v,X]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[k,"Voice"],D,[v,Fe]],[/\b(lvtel\-)?(v1[12]) b/i],[[k,"LvTel"],D,[v,Fe]],[/\b(ph-1) /i],[D,[k,"Essential"],[v,Fe]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[D,[k,"Envizen"],[v,X]],[/\b(trio[-\w\. ]+) b/i],[D,[k,"MachSpeed"],[v,X]],[/\btu_(1491) b/i],[D,[k,"Rotor"],[v,X]]]}),Xp=Object.freeze({browser:[[/((?:air|blue|daum|fox|poly|proton)mail|emclient|evolution|kmail2?|kontact|(?:microsoft |mac)?outlook(?:-express)?|navermailapp|(?!chrom.+)sparrow|sparkdesktop|thunderbird|yahoo|zohomail-desktop)(?:m.+ail; |[\/ ])([\w\.]+)/i,/(mail)\/([\w\.]+) cf/i],[F,z,[v,vo]],[/zdesktop\/([\w\.]+)/i],[z,[F,"Zimbra"],[v,vo]]]}),No=Object.freeze({browser:[[/(asana|ahrefssiteaudit|(?:bing|microsoft)preview|blueno|(?:chatgpt|claude|mistralai|perplexity)-user|cohere-ai|hubspot page fetcher|mastodon|(?:bitly|bufferlinkpreview|discord|duckassist|linkedin|pinterest|reddit|roger|siteaudit|twitter|uptimero|zoom)bot|google-site-verification|iframely|kakaotalk-scrap|meta-externalfetcher|y!?j-dlc|yandex(?:calendar|direct(?:dyn)?|fordomain|pagechecker|searchshop)|yadirectfetcher)\/([\w\.]+)/i,/(bluesky) cardyb\/([\w\.]+)/i,/(skypeuripreview) preview\/([\w\.]+)/i,/(slack(?:bot)?(?:-imgproxy|-linkexpanding)?) ([\w\.]+)/i,/(whatsapp)\/([\w\.]+)/i],[F,z,[v,xo]],[/((?:better uptime |keybase|telegram|vercel)bot|chrome-lighthouse|feedfetcher-google|gemini-deep-research|google(?:imageproxy|-read-aloud|-pagerenderer|producer)|snap url preview|vercel(flags|tracing|-(favicon|screenshot)-bot)|yandex(?:sitelinks|userproxy))/i],[F,[v,xo]]],os:[[/whatsapp\/[\d\.]+ (a|i)/i],[[F,t=>t=="A"?"Android":"iOS"]]]}),Jp=Object.freeze({browser:[[/\b(discord|figma|mattermost|notion|postman|rambox|rocket.chat|slack|teams)\/([\w\.]+).+(electron\/|; ios)/i,/(flipboard)\/([\w\.]+)/i],[F,z,[v,ct]],[/(evernote) win/i,/(teams)mobile-(ios|and)/i],[F,[v,ct]],[/chatlyio\/([\d\.]+)/i],[z,[F,"Slack"],[v,ct]],[/ultralite app_version\/([\w\.]+)/i],[z,[F,"TikTok Lite"],[v,ct]],[/\) code\/([\d\.]+).+electron\//i],[z,[F,"VS Code"],[v,ct]],[/jp\.co\.yahoo\.(?:android\.yjtop|ipn\.appli)\/([\d\.]+)/i],[z,[F,"Yahoo! Japan"],[v,ct]]]}),Zp=Object.freeze({browser:[[/(apple(?:coremedia|tv))\/([\w\._]+)/i,/(coremedia) v([\w\._]+)/i,/(ares|clementine|music player daemon|nexplayer|ossproxy) ([\w\.-]+)/i,/^(aqualung|audacious|audimusicstream|amarok|bass|bsplayer|core|gnomemplayer|gvfs|irapp|lyssna|music on console|nero (?:home|scout)|nokia\d+|nsplayer|psp-internetradioplayer|quicktime|rma|radioapp|radioclientapplication|soundtap|stagefright|streamium|totem|videos|xbmc|xine|xmms)\/([\w\.-]+)/i,/(lg player|nexplayer) ([\d\.]+)/i,/player\/(nexplayer|lg player) ([\w\.-]+)/i,/(gstreamer) souphttpsrc.+libsoup\/([\w\.-]+)/i,/(htc streaming player) [\w_]+ \/ ([\d\.]+)/i,/(lavf)([\d\.]+)/i,/(mplayer)(?: |\/)(?:(?:sherpya-){0,1}svn)(?:-| )(r\d+(?:-\d+[\w\.-]+))/i,/ (songbird)\/([\w\.-]+)/i,/(winamp)(?:3 version|mpeg| ) ([\w\.-]+)/i,/(vlc)(?:\/| media player - version )([\w\.-]+)/i,/^(foobar2000|itunes|smp)\/([\d\.]+)/i,/com\.(riseupradioalarm)\/([\d\.]*)/i,/(mplayer)(?:\s|\/| unknown-)([\w\.\-]+)/i,/(windows)\/([\w\.-]+) upnp\/[\d\.]+ dlnadoc\/[\d\.]+ home media server/i],[F,z,[v,qt]],[/(flrp)\/([\w\.-]+)/i],[[F,"Flip Player"],z,[v,qt]],[/(fstream|media player classic|inlight radio|mplayer|nativehost|nero showtime|ocms-bot|queryseekspider|tapinradio|tunein radio|winamp|yourmuze)/i],[F,[v,qt]],[/(htc_one_s|windows-media-player|wmplayer)\/([\w\.-]+)/i],[[F,/[_-]/g," "],z,[v,qt]],[/(rad.io|radio.(?:de|at|fr)) ([\d\.]+)/i],[[F,"rad.io"],z,[v,qt]]]}),ac=Object.freeze({browser:[[/^(apache-httpclient|axios|(?:go|java)-http-client|got|guzzlehttp|java|libwww-perl|lua-resty-http|needle|node-(?:fetch|superagent)|okhttp|php-soap|postmanruntime|python-(?:httpx|urllib[23]?|requests)|scrapy)\/([\w\.]+)/i,/(adobeair|aiohttp|jsdom)\/([\w\.]+)/i,/(nutch)-([\w\.-]+)(\(|$)/i,/\((java)\/([\w\.]+)/i],[F,z,[v,oc]]]}),Qp=Object.freeze({device:[[/aftlbt962e2/i],[[k,"BMW"]],[/dilink.+(byd) auto/i],[k],[/aftlft962x3/i],[[k,"Jeep"],[D,"Wagooner"]],[/(rivian) (r1t)/i],[k,D],[/vcc.+netfront/i],[[k,"Volvo"]]]}),ko=Object.freeze({browser:[...sc.browser,...No.browser,..._o.browser,...ac.browser],os:[...No.os]});var S={ANDORRA:{ANDORRA:"Europe/Andorra"},AUSTRIA:{VIENNA:"Europe/Vienna"},BELGIUM:{BRUSSELS:"Europe/Brussels"},BULGARIA:{SOFIA:"Europe/Sofia"},CROATIA:{ZAGREB:"Europe/Zagreb"},CYPRUS:{NICOSIA_EUROPE:"Europe/Nicosia",NICOSIA_ASIA:"Asia/Nicosia",FAMAGUSTA:"Asia/Famagusta"},CZECHIA:{PRAGUE:"Europe/Prague"},DENMARK:{COPENHAGEN:"Europe/Copenhagen",FAROE:"Atlantic/Faroe"},ESTONIA:{TALLINN:"Europe/Tallinn"},FINLAND:{HELSINKI:"Europe/Helsinki",MARIEHAMN:"Europe/Mariehamn"},FRANCE:{PARIS:"Europe/Paris",CAYENNE:"America/Cayenne",GUADELOUPE:"America/Guadeloupe",MARIGOT:"America/Marigot",MARTINIQUE:"America/Martinique",MAYOTTE:"Indian/Mayotte",REUNION:"Indian/Reunion"},GERMANY:{BERLIN:"Europe/Berlin",BUSINGEN:"Europe/Busingen"},GREECE:{ATHENS:"Europe/Athens"},HUNGARY:{BUDAPEST:"Europe/Budapest"},ICELAND:{REYKJAVIK:"Atlantic/Reykjavik"},IRELAND:{DUBLIN:"Europe/Dublin"},ITALY:{ROME:"Europe/Rome"},LATVIA:{RIGA:"Europe/Riga"},LIECHTENSTEIN:{VADUZ:"Europe/Vaduz"},LITHUANIA:{VILNIUS:"Europe/Vilnius"},LUXEMBOURG:{LUXEMBOURG:"Europe/Luxembourg"},MALTA:{MALTA:"Europe/Malta"},MONACO:{MONACO:"Europe/Monaco"},NETHERLANDS:{AMSTERDAM:"Europe/Amsterdam",ARUBA:"America/Aruba",CURACAO:"America/Curacao",KRALENDIJK:"America/Kralendijk",LOWER_PRINCES:"America/Lower_Princes"},NORWAY:{OSLO:"Europe/Oslo",JAN_MAYEN:"Atlantic/Jan_Mayen",LONGYEARBYEN:"Arctic/Longyearbyen"},POLAND:{WARSAW:"Europe/Warsaw"},PORTUGAL:{LISBON:"Europe/Lisbon",AZORES:"Atlantic/Azores",MADEIRA:"Atlantic/Madeira"},ROMANIA:{BUCHAREST:"Europe/Bucharest"},SAN_MARINO:{SAN_MARINO:"Europe/San_Marino"},SLOVAKIA:{BRATISLAVA:"Europe/Bratislava"},SLOVENIA:{LJUBLJANA:"Europe/Ljubljana"},SPAIN:{MADRID:"Europe/Madrid",CANARY:"Atlantic/Canary",CEUTA:"Africa/Ceuta"},SWEDEN:{STOCKHOLM:"Europe/Stockholm"},SWITZERLAND:{ZURICH:"Europe/Zurich"},VATICAN:{VATICAN:"Europe/Vatican"}},cc=[S.AUSTRIA.VIENNA,S.BELGIUM.BRUSSELS,S.BULGARIA.SOFIA,S.CROATIA.ZAGREB,S.CYPRUS.NICOSIA_EUROPE,S.CYPRUS.NICOSIA_ASIA,S.CYPRUS.FAMAGUSTA,S.CZECHIA.PRAGUE,S.DENMARK.COPENHAGEN,S.ESTONIA.TALLINN,S.FINLAND.HELSINKI,S.FINLAND.MARIEHAMN,S.FRANCE.PARIS,S.GERMANY.BERLIN,S.GREECE.ATHENS,S.HUNGARY.BUDAPEST,S.IRELAND.DUBLIN,S.ITALY.ROME,S.LATVIA.RIGA,S.LITHUANIA.VILNIUS,S.LUXEMBOURG.LUXEMBOURG,S.MALTA.MALTA,S.NETHERLANDS.AMSTERDAM,S.POLAND.WARSAW,S.PORTUGAL.LISBON,S.ROMANIA.BUCHAREST,S.SLOVAKIA.BRATISLAVA,S.SLOVENIA.LJUBLJANA,S.SPAIN.MADRID,S.SWEDEN.STOCKHOLM,S.FRANCE.CAYENNE,S.FRANCE.GUADELOUPE,S.FRANCE.MARIGOT,S.FRANCE.MARTINIQUE,S.FRANCE.MAYOTTE,S.FRANCE.REUNION,S.PORTUGAL.AZORES,S.PORTUGAL.MADEIRA,S.SPAIN.CANARY],Lo=[S.ICELAND.REYKJAVIK,S.LIECHTENSTEIN.VADUZ,S.NORWAY.OSLO,S.NORWAY.JAN_MAYEN],tf=[...cc,...Lo],nf=[S.SWITZERLAND.ZURICH,...Lo],rf=[S.AUSTRIA.VIENNA,S.BELGIUM.BRUSSELS,S.BULGARIA.SOFIA,S.CROATIA.ZAGREB,S.CZECHIA.PRAGUE,S.DENMARK.COPENHAGEN,S.ESTONIA.TALLINN,S.FINLAND.HELSINKI,S.FINLAND.MARIEHAMN,S.FRANCE.PARIS,S.GERMANY.BERLIN,S.GREECE.ATHENS,S.HUNGARY.BUDAPEST,S.ITALY.ROME,S.LATVIA.RIGA,S.LITHUANIA.VILNIUS,S.LUXEMBOURG.LUXEMBOURG,S.MALTA.MALTA,S.NETHERLANDS.AMSTERDAM,S.POLAND.WARSAW,S.PORTUGAL.LISBON,S.PORTUGAL.AZORES,S.PORTUGAL.MADEIRA,S.ROMANIA.BUCHAREST,S.SLOVAKIA.BRATISLAVA,S.SLOVENIA.LJUBLJANA,S.SPAIN.MADRID,S.SPAIN.CANARY,S.SWEDEN.STOCKHOLM,S.ANDORRA.ANDORRA,S.GERMANY.BUSINGEN,S.ICELAND.REYKJAVIK,S.LIECHTENSTEIN.VADUZ,S.MONACO.MONACO,S.NORWAY.OSLO,S.SAN_MARINO.SAN_MARINO,S.SPAIN.CEUTA,S.SWITZERLAND.ZURICH,S.VATICAN.VATICAN];function Mr(){var t;return typeof window!="undefined"&&((window==null?void 0:window.matchMedia("(display-mode: standalone)").matches)||((t=window.navigator)===null||t===void 0?void 0:t.standalone)||document.referrer.startsWith("android-app://")||(window==null?void 0:window.Windows)||/trident.+(msapphost|webview)\//i.test(navigator.userAgent)||document.referrer.startsWith("app-info://platform/microsoft-store"))}var{Crawler:hf}=Po.BrowserName,Ur=(t,e,n)=>typeof t=="string"?te(t,e,n):t;var Do=t=>{let e=Ur(t);if(e.os.is(Oo.MACOS)){if(e.cpu.is(To.ARM))return!0;if(typeof t!="string"&&typeof window!="undefined")try{let n=document.createElement("canvas"),r=n.getContext("webgl2")||n.getContext("webgl")||n.getContext("experimental-webgl"),i=r.getExtension("WEBGL_debug_renderer_info");if(r.getParameter(i.UNMASKED_RENDERER_WEBGL).match(/apple m\d/i))return!0}catch(n){return!1}}return!1};var Bo=t=>[jt.CLI,jt.CRAWLER,jt.FETCHER,jt.LIBRARY].includes(Ur(t,ko).browser.type),Mo=t=>Ur(t).engine.is(Ro.BLINK);function lc(){return{width:window.screen.width,height:window.screen.height}}function uc(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return console.error("Failed to get timezone:",t),"UTC"}}function Uo(){try{return navigator.language||"en-US"}catch(t){return console.error("Failed to get browser locale:",t),"en-US"}}function Fo(){if(typeof window=="undefined")return{userAgent:{name:"",browser:{major:"",name:"",version:""},os:{name:"",version:""},device:void 0,engine:{name:"",version:""},cpu:{architecture:""}},screenResolution:{width:0,height:0},timeZone:"UTC",flags:{isBot:!1,isChromeFamily:!1,isStandalonePWA:!1,isAppleSilicon:!1}};let e=new te().getResult(),n;try{n={isBot:Bo(e),isChromeFamily:Mo(e),isStandalonePWA:Mr(),isAppleSilicon:Do(e)}}catch(r){console.error("Failed to compute device flags:",r),n={isBot:!1,isChromeFamily:!1,isStandalonePWA:!1,isAppleSilicon:!1}}return{userAgent:{name:e.ua,browser:{major:e.browser.major||"",name:e.browser.name||"",version:e.browser.version||"",type:e.browser.type},os:{name:e.os.name||"",version:e.os.version||""},device:e.device.model||e.device.type||e.device.vendor?{model:e.device.model,type:e.device.type,vendor:e.device.vendor}:void 0,engine:{name:e.engine.name||"",version:e.engine.version||""},cpu:{architecture:e.cpu.architecture||""}},screenResolution:lc(),timeZone:uc(),flags:n}}function Go(){if(typeof window=="undefined")return{};let t=new URLSearchParams(window.location.search);return{locale:t.get("locale")||void 0,currency:t.get("currency")||void 0,utmSource:t.get("utm_source")||void 0,utmMedium:t.get("utm_medium")||void 0,utmCampaign:t.get("utm_campaign")||void 0}}var kn=class{constructor(){this.listeners=new Map}on(e,n){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(n),()=>this.off(e,n)}off(e,n){this.listeners.has(e)&&this.listeners.get(e).delete(n)}async emit(e,n){if(this.listeners.has(e)){let r=Array.from(this.listeners.get(e));await Promise.all(r.map(i=>{try{return Promise.resolve(i(n))}catch(o){return console.error('[EventBus] Error in listener for event "'.concat(e,'":'),o),Promise.resolve()}}))}}clear(){this.listeners.clear()}};Vn();function Xt(t){try{let e=t.split(".");if(e.length!==3)return console.error("Invalid JWT token format"),null;let n=e[1],r=n+"=".repeat((4-n.length%4)%4),i=atob(r),o=JSON.parse(i);return o.exp&&Date.now()>=o.exp*1e3?(console.warn("JWT token is expired"),null):{sessionId:o.sessionId,storeId:o.storeId,accountId:o.accountId,customerId:o.customerId,role:o.role,isValid:!0,isLoading:!1}}catch(e){return console.error("Failed to decode JWT token:",e),null}}function Ho(t){try{let e=t.split(".");if(e.length!==3)return!0;let n=e[1],r=n+"=".repeat((4-n.length%4)%4),i=atob(r),o=JSON.parse(i);return o.exp?Date.now()>=o.exp*1e3:!1}catch(e){return console.error("Failed to check token expiration:",e),!0}}en();var lt={},dc=["","VITE_","REACT_APP_","NEXT_PUBLIC_"];function be(t,e=dc){var n,r,i;for(let o of e){let s=o?"".concat(o).concat(t):t;if(typeof process!="undefined"&&((n=process==null?void 0:process.env)!=null&&n[s]))return console.log("process.env[".concat(s,"]"),process.env[s]),process.env[s];if(typeof lt!="undefined"&&((r=lt==null?void 0:lt.env)!=null&&r[s]))return console.log("import.meta.env[".concat(s,"]"),lt.env[s]),lt.env[s];if(typeof window!="undefined"&&((i=window==null?void 0:window.__TAGADA_ENV__)!=null&&i[s]))return console.log("window.__TAGADA_ENV__[".concat(s,"]"),window.__TAGADA_ENV__[s]),window.__TAGADA_ENV__[s]}}var pc=async(t="default")=>{try{if((be("TAGADA_ENV")||be("TAGADA_ENVIRONMENT"))==="production"||!gt(!0))return null;let n=await fetch("/.local.json");if(!n.ok)return null;let r=await n.json(),i={},o=!1;try{let a=await fetch("/config/".concat(t,".tgd.json"));a.ok||(a=await fetch("/config/".concat(t,".json"))),a.ok&&(i=await a.json(),o=!0)}catch(a){}if(!o&&t!=="default"){console.warn("\u26A0\uFE0F Config variant '".concat(t,"' not found, falling back to 'default'"));try{let a=await fetch("/config/default.tgd.json");a.ok||(a=await fetch("/config/default.json")),a.ok&&(i=await a.json(),o=!0,console.log("\u2705 Fallback to 'default' config successful"))}catch(a){}}o||console.warn(t==="default"?"\u26A0\uFE0F No 'default' config found. Create /config/default.tgd.json":"\u26A0\uFE0F Neither '".concat(t,"' nor 'default' config found. Create /config/default.tgd.json"));let s={storeId:r.storeId,accountId:r.accountId,basePath:r.basePath,config:i};return console.log("\u{1F6E0}\uFE0F Using local development plugin config:",s),s}catch(e){return null}},fc=async()=>{try{if((be("TAGADA_ENV")||be("TAGADA_ENVIRONMENT"))==="production"||!gt(!0))return null;try{console.log("\u{1F6E0}\uFE0F [V2] Attempting to load /config/funnel.local.json...");let r=await fetch("/config/funnel.local.json");if(r.ok){let i=await r.json();console.log("\u{1F6E0}\uFE0F [V2] \u2705 Loaded local funnel config (NEW format):",i);let{loadLocalFunnelConfig:o}=await Promise.resolve().then(()=>(cn(),bi));if(await o(),i.staticResources){let s={};for(let[a,l]of Object.entries(i.staticResources))s[a]={id:l};return s}return null}}catch(r){console.log("\u{1F6E0}\uFE0F [V2] funnel.local.json not found, trying legacy format...")}console.log("\u{1F6E0}\uFE0F [V2] Attempting to load /config/resources.static.json (legacy)...");let e=await fetch("/config/resources.static.json");if(!e.ok)return console.log("\u{1F6E0}\uFE0F [V2] No local static resources found"),null;let n=await e.json();return console.log("\u{1F6E0}\uFE0F [V2] \u2705 Loaded legacy static resources:",n),n}catch(t){return console.error("\u{1F6E0}\uFE0F [V2] \u274C Error loading static resources:",t),null}},Ln=t=>{if(typeof document=="undefined")return;let e=document.querySelector('meta[name="'.concat(t,'"]'));return(e==null?void 0:e.getAttribute("content"))||void 0};var gc=async()=>{try{if(typeof document=="undefined")return null;let t=Ln("x-plugin-store-id"),e=Ln("x-plugin-account-id");if(!t)return null;let n=Ln("x-plugin-base-path")||"/",r={};try{let o=Ln("x-plugin-config");if(o){let s=decodeURIComponent(o);r=JSON.parse(s)}}catch(o){console.warn("\u26A0\uFE0F Failed to parse plugin config from meta tag:",o)}e||console.warn("\u26A0\uFE0F Plugin config: Account ID not found in meta tags");let i={storeId:t,accountId:e,basePath:n,config:r};return console.log("\u{1F680} [HIGHEST PRIORITY] Plugin config loaded from meta tags (runtime injected config):",{storeId:t,accountId:e,basePath:n,configKeys:Object.keys(r),configSize:JSON.stringify(r).length}),i}catch(t){return console.warn("\u26A0\uFE0F Error loading production config from meta tags:",t),null}},Ko=async(t="default",e)=>{var s,a;console.log("\u{1F527} [V2] loadPluginConfig called with variant:",t);let n=await fc(),r=await gc();if(r){let l=$(O({},r),{staticResources:n!=null?n:void 0});return console.log("\u2705 [V2] Using INJECTED config from meta tags (HIGHEST PRIORITY)"),l}if(e){let l={storeId:e.storeId,accountId:e.accountId,basePath:(s=e.basePath)!=null?s:"/",config:(a=e.config)!=null?a:{},staticResources:n!=null?n:void 0};return console.log("\u2705 [V2] Using raw config parameter (PRIORITY 2)"),l}let i=await hc();if(i){let l=$(O({},i),{staticResources:n!=null?n:void 0});return console.log("\u2705 [V2] Using environment variables config (PRIORITY 3 - build time)"),l}let o=await pc(t);if(o){let l=$(O({},o),{staticResources:n!=null?n:void 0});return console.log("\u2705 [V2] Using local dev config files (PRIORITY 4)"),l}return console.warn("\u26A0\uFE0F [V2] No plugin config found - using defaults"),{basePath:"/",config:{},staticResources:n!=null?n:void 0}};async function mc(t="default",e){try{if(!gt())return null;if(e)return e;let n=["/config/".concat(t,".config.json"),"/config/".concat(t,".tgd.json"),"/config/".concat(t,".json")];for(let r of n)try{let i=await fetch(r);if(i.ok)return await i.json()}catch(i){continue}return console.warn("\u26A0\uFE0F [loadLocalConfig] No config found for '".concat(t,"'")),null}catch(n){return console.error("[loadLocalConfig] Error loading config:",n),null}}async function hc(){try{if(!gt())return;let t=be("TAGADA_STORE_ID"),e=be("TAGADA_ACCOUNT_ID"),n=be("TAGADA_BASE_PATH"),r=be("TAGADA_CONFIG_NAME");if(!t||!e)return;let i=await mc(r);if(!i)return;let o={storeId:t,accountId:e,basePath:n||"/",config:i};return console.log("\u{1F6E0}\uFE0F [createRawPluginConfig] Using environment variables (build-time config):",{hasStoreId:!!o.storeId,hasAccountId:!!o.accountId,basePath:o.basePath,hasConfig:!!o.config}),o}catch(t){console.error("[createRawPluginConfig] Error creating config:",t);return}}sn();ze();ze();var Fr=new Map,Gr=new Set;function Ec(){return typeof window=="undefined"?null:new URLSearchParams(window.location.search).get("authCode")}async function Vo(t,e,n,r=!1){if(Gr.has(t))throw r&&console.log("[AuthHandoff] Code already resolved, skipping duplicate request"),new Error("Auth code already resolved");let i=Fr.get(t);if(i)return r&&console.log("[AuthHandoff] Resolution already in progress, waiting for existing request"),i;r&&console.log("[AuthHandoff] Resolving authCode:",t.substring(0,15)+"...");let o=(async()=>{try{let s=await fetch("".concat(n,"/api/v1/cms/auth/resolve-handoff"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,storeId:e})});if(!s.ok){let l=await s.json().catch(()=>({message:"Unknown error"}));throw new Error(l.message||"Failed to resolve auth handoff: ".concat(s.status))}let a=await s.json();return r&&console.log("[AuthHandoff] \u2705 Resolved successfully:",{customerId:a.customer.id,role:a.customer.role,hasContext:Object.keys(a.context).length>0}),r&&console.log("[AuthHandoff] Storing new token (overriding existing)"),re(a.token),yc(r),Gr.add(t),a}catch(s){throw console.error("[AuthHandoff] \u274C Failed to resolve:",s),s}finally{Fr.delete(t)}})();return Fr.set(t,o),o}function yc(t=!1){if(typeof window=="undefined")return;let e=new URL(window.location.href);e.searchParams.has("authCode")&&(e.searchParams.delete("authCode"),window.history.replaceState({},"",e.pathname+e.search+e.hash),t&&console.log("[AuthHandoff] Cleaned authCode from URL"))}function Wo(){let t=Ec();return!(!t||!t.startsWith("ah_")||Gr.has(t))}var Dn=class{constructor(e={}){this.bus=new kn;this.eventDispatcher=new We;this.tokenPromise=null;this.tokenResolver=null;this.isInitializingSession=!1;this.lastSessionInitError=null;this.sessionInitRetryCount=0;this.MAX_SESSION_INIT_RETRIES=3;var a,l,c,u;this.config=e,this.instanceId=Math.random().toString(36).substr(2,9),this.boundHandleStorageChange=this.handleStorageChange.bind(this),this.boundHandlePageshow=p=>{if(p.persisted)if(this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Page restored from BFcache (back button), re-initializing funnel...")),this.funnel&&this.state.session&&this.state.store){this.funnel.resetInitialization();let b=this.getAccountId(),f=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("funnelId")||void 0;this.funnel.autoInitialize({customerId:this.state.session.customerId,sessionId:this.state.session.sessionId},{id:this.state.store.id,accountId:b},f).catch(I=>{console.error("[TagadaClient] Funnel re-initialization failed:",I)})}else this.sessionInitRetryCount=0,this.initialize()},console.log("[TagadaClient ".concat(this.instanceId,"] Initializing...")),console.log("[TagadaClient ".concat(this.instanceId,"] Config:"),{debugMode:e.debugMode,hasRawPluginConfig:!!e.rawPluginConfig,rawPluginConfig:e.rawPluginConfig,features:e.features}),pi(this.config.debugMode)&&this.config.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Preview mode active - state cleared"));let r=this.resolveEnvironment(),i=ai(r);e.customApiConfig&&(i=$(O(O({},i),e.customApiConfig),{apiConfig:O(O({},i.apiConfig),e.customApiConfig.apiConfig)}),this.config.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Applied custom API config:"),i.apiConfig.baseUrl)),this.state={auth:{isAuthenticated:!1,isLoading:!1,customer:null,session:null},session:null,customer:null,locale:{locale:"en-US",language:"en",region:"US",messages:{}},currency:{code:"USD",symbol:"$",name:"US Dollar"},store:null,environment:i,isLoading:!0,isInitialized:!1,isSessionInitialized:!1,pluginConfig:{basePath:"/",config:{}},pluginConfigLoading:!0,debugMode:(a=e.debugMode)!=null?a:r!=="production",token:null},console.log("[TagadaClient ".concat(this.instanceId,"] Initial state:"),{pluginConfigLoading:this.state.pluginConfigLoading,hasRawPluginConfig:!!e.rawPluginConfig}),this.apiClient=new Mt({baseURL:i.apiConfig.baseUrl});let o=(l=e.features)==null?void 0:l.funnel;if(o!==!1){let p=typeof o=="object"?o:{};this.funnel=new wt({apiClient:this.apiClient,debugMode:this.state.debugMode,pluginConfig:this.state.pluginConfig,environment:this.state.environment,autoRedirect:p.autoRedirect,funnelId:(c=e.rawPluginConfig)==null?void 0:c.funnelId,stepId:(u=e.rawPluginConfig)==null?void 0:u.stepId})}this.apiClient.setTokenProvider(this.waitForToken.bind(this)),typeof window!="undefined"&&(window.addEventListener("storage",this.boundHandleStorageChange),window.addEventListener("pageshow",this.boundHandlePageshow)),this.setupConfigHotReload(),this.initialize()}destroy(){typeof window!="undefined"&&(window.removeEventListener("storage",this.boundHandleStorageChange),window.removeEventListener("pageshow",this.boundHandlePageshow)),this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Destroyed")),this.eventDispatcher.clear(),this.bus.clear()}handleStorageChange(){if(mt()===this.state.token){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Token unchanged (ignoring event)"));return}if(this.isInitializingSession){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Session initialization in progress, skipping storage change"));return}if(this.sessionInitRetryCount>=this.MAX_SESSION_INIT_RETRIES&&this.lastSessionInitError){this.state.debugMode&&console.error("[TagadaClient ".concat(this.instanceId,"] Max session init retries reached, giving up"),this.lastSessionInitError);return}this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Storage changed, re-initializing token...")),this.initializeToken()}subscribe(e){return this.eventDispatcher.subscribe(e)}getState(){return this.state}updateState(e){this.state=O(O({},this.state),e),this.eventDispatcher.notify(this.state)}resolveEnvironment(){return this.config.environment?this.config.environment:ft()}async initialize(){try{await this.initializePluginConfig(),this.state.pluginConfig.storeId?await this.initializeToken():(console.warn("[TagadaClient] No store ID found in plugin config. Skipping token initialization."),this.updateState({isLoading:!1,isInitialized:!0}))}catch(e){console.error("[TagadaClient] Initialization failed:",e),this.updateState({isLoading:!1,isInitialized:!0})}}async initializePluginConfig(){if(console.log("[TagadaClient ".concat(this.instanceId,"] initializePluginConfig called"),{pluginConfigLoading:this.state.pluginConfigLoading,hasRawPluginConfig:!!this.config.rawPluginConfig}),!this.state.pluginConfigLoading){console.log("[TagadaClient ".concat(this.instanceId,"] Plugin config already loading or loaded, skipping..."));return}try{let e=this.config.localConfig||"default";console.log("[TagadaClient ".concat(this.instanceId,"] Loading plugin config with variant: ").concat(e));let n=await Ko(e,this.config.rawPluginConfig);console.log("[TagadaClient ".concat(this.instanceId,"] Plugin config loaded:"),n),this.updateState({pluginConfig:n,pluginConfigLoading:!1}),this.funnel&&this.funnel.setConfig({pluginConfig:n,environment:this.state.environment})}catch(e){console.error("[TagadaClient] Failed to load plugin config:",e),this.updateState({pluginConfig:{basePath:"/",config:{}},pluginConfigLoading:!1})}}async initializeToken(){var e;if(Wo()){let n=this.state.pluginConfig.storeId;if(!n)return console.error("[TagadaClient] Cannot resolve authCode: storeId not found in config"),this.fallbackToNormalFlow();console.log("[TagadaClient ".concat(this.instanceId,"] \u{1F510} Cross-domain auth detected, resolving..."));try{let r=new URLSearchParams(window.location.search).get("authCode");if(!r)return this.fallbackToNormalFlow();let i=await Vo(r,n,this.state.environment.apiConfig.baseUrl,this.state.debugMode);console.log("[TagadaClient ".concat(this.instanceId,"] \u2705 Auth handoff resolved:"),{customerId:i.customer.id,role:i.customer.role,hasContext:Object.keys(i.context).length>0}),this.setToken(i.token);let o=Xt(i.token);o?(this.updateState({session:o}),await this.initializeSession(o),(e=i.context)!=null&&e.funnelSessionId&&this.funnel&&this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Restoring funnel session from handoff context:"),i.context.funnelSessionId)):(console.error("[TagadaClient] Failed to decode token from handoff"),this.updateState({isInitialized:!0,isLoading:!1}));return}catch(r){console.error("[TagadaClient ".concat(this.instanceId,"] \u274C Auth handoff failed, falling back to normal flow:"),r)}}await this.fallbackToNormalFlow()}async fallbackToNormalFlow(){let n=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("token");n&&(this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] \u{1F512} URL token detected, setting immediately to prevent race condition")),this.apiClient.updateToken(n),re(n));let r=mt();console.log("[TagadaClient ".concat(this.instanceId,"] Initializing token (normal flow)..."),{hasExistingToken:!!r,hasQueryToken:!!n,storeId:this.state.pluginConfig.storeId});let i=null,o=!1;if(n?(i=n,o=!0):r&&!Ho(r)&&(i=r),i){this.setToken(i),o&&(this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Persisting query token to storage...")),re(i));let s=Xt(i);s?(this.updateState({session:s}),await this.initializeSession(s)):(console.error("[TagadaClient] Failed to decode token"),this.updateState({isInitialized:!0,isLoading:!1}))}else{let s=this.state.pluginConfig.storeId;console.log("[TagadaClient ".concat(this.instanceId,"] No existing token, creating anonymous token..."),{hasStoreId:!!s,storeId:s}),s?await this.createAnonymousToken(s):(console.warn("[TagadaClient ".concat(this.instanceId,"] No storeId in plugin config, skipping anonymous token creation")),this.updateState({isInitialized:!0,isLoading:!1}))}}setToken(e){this.apiClient.updateToken(e),this.updateState({token:e}),this.tokenResolver&&(this.tokenResolver(e),this.tokenPromise=null,this.tokenResolver=null)}waitForToken(){return this.apiClient.getCurrentToken()?Promise.resolve(this.apiClient.getCurrentToken()):(this.tokenPromise||(this.tokenPromise=new Promise(e=>{this.tokenResolver=e})),this.tokenPromise)}async createAnonymousToken(e){if(typeof window!="undefined"){let r=new URLSearchParams(window.location.search).get("token");if(r){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] \u{1F512} URL has token, skipping anonymous token creation")),this.setToken(r),re(r);let i=Xt(r);i&&(this.updateState({session:i}),await this.initializeSession(i));return}}if(this.isInitializingSession){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Session initialization in progress, skipping anonymous token creation"));return}try{let n=yt();this.state.debugMode&&console.log("[TagadaClient] Creating anonymous token for store:",e,{draft:n});let r=await this.apiClient.post("/api/v1/cms/session/anonymous",{storeId:e,role:"anonymous",draft:n},{skipAuth:!0});this.setToken(r.token),re(r.token);let i=Xt(r.token);i&&(this.updateState({session:i}),await this.initializeSession(i)),this.updateState({isSessionInitialized:!0})}catch(n){console.error("[TagadaClient] Failed to create anonymous token:",n),this.updateState({isInitialized:!0,isLoading:!1})}}async initializeSession(e){var n,r,i,o,s,a,l,c,u,p,b;if(this.isInitializingSession){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Session initialization already in progress, skipping"));return}this.isInitializingSession=!0;try{this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Initializing session..."),{sessionId:e.sessionId});let w=Fo(),f=Go(),I=Uo(),h=yt(),R=new URLSearchParams(window.location.search).get("draft");R!==null&&zn(R==="true");let x={storeId:e.storeId,accountId:e.accountId,customerId:e.customerId,role:e.role,browserLocale:I,queryLocale:f.locale,queryCurrency:f.currency,utmSource:f.utmSource,utmMedium:f.utmMedium,utmCampaign:f.utmCampaign,browser:w.userAgent.browser.name,browserVersion:w.userAgent.browser.version,os:w.userAgent.os.name,osVersion:w.userAgent.os.version,deviceType:(n=w.userAgent.device)==null?void 0:n.type,deviceModel:(r=w.userAgent.device)==null?void 0:r.model,deviceVendor:(i=w.userAgent.device)==null?void 0:i.vendor,userAgent:w.userAgent.name,engineName:w.userAgent.engine.name,engineVersion:w.userAgent.engine.version,cpuArchitecture:w.userAgent.cpu.architecture,isBot:(s=(o=w.flags)==null?void 0:o.isBot)!=null?s:!1,isChromeFamily:(l=(a=w.flags)==null?void 0:a.isChromeFamily)!=null?l:!1,isStandalonePWA:(u=(c=w.flags)==null?void 0:c.isStandalonePWA)!=null?u:!1,isAppleSilicon:(b=(p=w.flags)==null?void 0:p.isAppleSilicon)!=null?b:!1,screenWidth:w.screenResolution.width,screenHeight:w.screenResolution.height,timeZone:w.timeZone,draft:h,fetchMessages:!1},C=await this.apiClient.post("/api/v1/cms/session/v2/init",x);this.lastSessionInitError=null,this.sessionInitRetryCount=0,this.updateSessionState(C,e),this.updateState({isInitialized:!0,isSessionInitialized:!0,isLoading:!1}),this.state.debugMode&&console.log("[TagadaClient] Session initialized successfully")}catch(w){this.lastSessionInitError=w,this.sessionInitRetryCount++,console.error("[TagadaClient] Error initializing session (attempt ".concat(this.sessionInitRetryCount,"/").concat(this.MAX_SESSION_INIT_RETRIES,"):"),w),this.updateState({isInitialized:!0,isLoading:!1})}finally{this.isInitializingSession=!1}}updateSessionState(e,n){var s,a,l,c,u,p,b,w,f,I;if(e.store){let h=e.store,R=$(O({},e.store),{accountId:h.accountId||((s=this.state.pluginConfig)==null?void 0:s.accountId)||n.accountId||"",presentmentCurrencies:h.presentmentCurrencies||[e.store.currency||"USD"],chargeCurrencies:h.chargeCurrencies||[e.store.currency||"USD"]});this.updateState({store:R})}if(e.locale){let h={locale:e.locale,language:e.locale.split("-")[0],region:(a=e.locale.split("-")[1])!=null?a:"US",messages:(l=e.messages)!=null?l:{}};this.updateState({locale:h})}if(e.store){let h={code:e.store.currency,symbol:this.getCurrencySymbol(e.store.currency),name:this.getCurrencyName(e.store.currency)};this.updateState({currency:h})}let r={isAuthenticated:(u=(c=e.customer)==null?void 0:c.isAuthenticated)!=null?u:!1,isLoading:!1,customer:(p=e.customer)!=null?p:null,session:n};this.updateState({customer:(b=e.customer)!=null?b:null,auth:r});let i=(w=this.config.features)==null?void 0:w.funnel,o=typeof i=="object"&&i.skipAutoInit;if(this.funnel&&!o&&n.customerId&&((f=e.store)!=null&&f.id)){let h=e.store.accountId||((I=this.state.pluginConfig)==null?void 0:I.accountId)||n.accountId||"";if(h){let x=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("funnelId")||void 0;this.state.debugMode&&console.log("[TagadaClient] Auto-initializing funnel...",{customerId:n.customerId,storeId:e.store.id,accountId:h,funnelId:x||"auto-detect"}),this.funnel.autoInitialize({customerId:n.customerId,sessionId:n.sessionId},{id:e.store.id,accountId:h},x).catch(C=>{console.error("[TagadaClient] Funnel auto-initialization failed:",C)})}else console.warn("[TagadaClient] Cannot auto-initialize funnel: accountId is missing")}}getCurrencySymbol(e){return{USD:"$",EUR:"\u20AC",GBP:"\xA3",JPY:"\xA5",CAD:"C$",AUD:"A$"}[e]||e}getCurrencyName(e){return{USD:"US Dollar",EUR:"Euro",GBP:"British Pound",JPY:"Japanese Yen",CAD:"Canadian Dollar",AUD:"Australian Dollar"}[e]||e}getAccountId(){var e,n,r;return((e=this.state.store)==null?void 0:e.accountId)||((n=this.state.pluginConfig)==null?void 0:n.accountId)||((r=this.state.session)==null?void 0:r.accountId)||""}updatePluginConfig(e){this.state.debugMode&&console.log("[TagadaClient] Hot-reloading config:",e);let n=O(O({},this.state.pluginConfig.config),e);this.updateState({pluginConfig:$(O({},this.state.pluginConfig),{config:n})}),this.bus.emit("CONFIG_UPDATED",n),this.state.debugMode&&console.log("[TagadaClient] Config updated successfully")}setupConfigHotReload(){if(typeof window=="undefined")return;let e=n=>{var r,i;if(((r=n.data)==null?void 0:r.type)==="TAGADAPAY_CONFIG_UPDATE"){let{config:o}=n.data;this.state.debugMode&&console.log("[TagadaClient] Received config update from parent:",o),this.updatePluginConfig(o)}else if(((i=n.data)==null?void 0:i.type)==="APPLY_STYLES_TO_ELEMENT"){let{elementId:o,styles:s}=n.data;this.state.debugMode&&console.log("[TagadaClient] Received style application request:",{elementId:o,styles:s}),this.applyStylesToElement(o,s)}};window.addEventListener("message",e),this.state.debugMode&&console.log("[TagadaClient] Config hot-reload and style manipulation listeners enabled")}applyStylesToElement(e,n){if(typeof document=="undefined")return;let r="tagada-editor-highlight",i=document.getElementById(r);i&&i.remove();let o=p=>{var C;let w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]).has(p.tagName.toLowerCase()),f=p;if(w){let N=p.parentElement;if((N==null?void 0:N.getAttribute("data-tagada-highlight-wrapper"))==="true"&&N instanceof HTMLElement)f=N;else{let L=document.createElement("div");L.setAttribute("data-tagada-highlight-wrapper","true");let W=window.getComputedStyle(p),le=W.display;if(le==="inline"?L.style.display="inline-block":L.style.display=le,L.style.position="relative",le==="inline"||le.includes("inline")){let ne=W.verticalAlign;ne&&ne!=="baseline"&&(L.style.verticalAlign=ne)}["width","height","minWidth","minHeight","maxWidth","maxHeight","flex","flexGrow","flexShrink","flexBasis","gridColumn","gridRow","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","gridArea","alignSelf","justifySelf","boxSizing","gap","rowGap","columnGap","order","aspectRatio"].forEach(ne=>{let Se=ne.replace(/([A-Z])/g,"-$1").toLowerCase(),j=W.getPropertyValue(Se);j&&j.trim()!==""&&(ne==="flex"&&j!=="none"&&j!=="0 1 auto"?L.style.flex=j:ne==="boxSizing"?L.style.boxSizing=j:L.style.setProperty(Se,j))}),p.style&&["width","height","min-width","min-height","max-width","max-height","flex","flex-grow","flex-shrink","flex-basis","grid-column","grid-row","grid-column-start","grid-column-end","grid-row-start","grid-row-end","grid-area","align-self","justify-self","box-sizing","gap","row-gap","column-gap","order","aspect-ratio"].forEach(Se=>{let j=p.style.getPropertyValue(Se);j&&L.style.setProperty(Se,j)}),(C=p.parentNode)==null||C.insertBefore(L,p),L.appendChild(p),f=L}}let I=getComputedStyle(w?p:f);(f.style.position==="static"||!f.style.position)&&(f.style.position="relative");let h=document.createElement("div");h.id=r,h.style.position="absolute",h.style.inset="0",h.style.pointerEvents="none",h.style.zIndex="9999",h.style.boxSizing="border-box",h.style.background="none",h.style.border="none",h.style.outline="none",h.style.margin="0",h.style.padding="0";let R=I.borderRadius;R&&(h.style.borderRadius=R),f.appendChild(h);let x=n||{boxShadow:"0 0 0 2px rgb(239 68 68)"};if(Object.entries(x).forEach(([N,V])=>{let L=N.includes("-")?N.replace(/-([a-z])/g,(W,le)=>le.toUpperCase()):N;N.includes("-")?h.style.setProperty(N,V):h.style[L]=V}),p.scrollIntoView({behavior:"smooth",block:"center"}),this.state.debugMode){let N=Object.entries(x).map(([V,L])=>"".concat(V,": ").concat(L)).join("; ");console.log("[TagadaClient] Applied styles to highlight div of element #".concat(e,":"),N)}},s=5,a=1e3,l=0,c=p=>{let b=window.getComputedStyle(p);return b.display==="none"||b.visibility==="hidden"||b.opacity==="0"||p.hidden||p.offsetWidth===0||p.offsetHeight===0},u=()=>{let p=document.querySelectorAll('[editor-id~="'.concat(e,'"]'));if(p.length===0){if(l+=1,l>=s){this.state.debugMode&&console.warn('[TagadaClient] Element with editor-id containing "'.concat(e,'" not found after ').concat(s," attempts"));return}this.state.debugMode&&console.warn('[TagadaClient] Element with editor-id containing "'.concat(e,'" not found (attempt ').concat(l,"/").concat(s,"), retrying in ").concat(a/1e3,"s")),setTimeout(u,a);return}let b=null;if(p.length===1)b=p[0];else{for(let w=0;w<p.length;w++)if(!c(p[w])){b=p[w];break}b||(b=p[0])}b&&o(b)};u()}};cn();var Yo="https://cvwnizdbugpz6jwk.public.blob.vercel-storage.com/geodata/v1";var $o=new Map,zo=new Map,Hr=new Map,Kr=new Map;async function Ac(t){let e=$o.get(t);if(e)return e;let n=Hr.get(t);return n||(n=(async()=>{let r="".concat(Yo,"/").concat(t,"/countries.json"),i=await fetch(r);if(!i.ok)throw new Error("Geodata fetch failed: ".concat(r," (").concat(i.status,")"));let o=await i.json();return $o.set(t,o),Hr.delete(t),o})(),Hr.set(t,n),n)}async function wc(t){let e=zo.get(t);if(e)return e;let n=Kr.get(t);return n||(n=(async()=>{let r="".concat(Yo,"/").concat(t,"/regions.json"),i=await fetch(r);if(!i.ok)throw new Error("Geodata fetch failed: ".concat(r," (").concat(i.status,")"));let o=await i.json();return zo.set(t,o),Kr.delete(t),o})(),Kr.set(t,n),n)}async function bc(t="en"){await Promise.all([Ac(t),wc(t)])}typeof globalThis!="undefined"&&typeof fetch!="undefined"&&bc("en").catch(()=>{});var Jt=class{static initialize(e){var n,r;this.apiKey=e,typeof window!="undefined"&&((r=(n=window.google)==null?void 0:n.maps)!=null&&r.places)&&(this.service=new window.google.maps.places.AutocompleteService)}static async searchPlaces(e,n={}){return!this.service||!e.trim()?[]:new Promise((r,i)=>{this.service.getPlacePredictions({input:e,types:n.types||["address"],componentRestrictions:n.componentRestrictions},(o,s)=>{var a,l,c;s===((c=(l=(a=window.google)==null?void 0:a.maps)==null?void 0:l.places)==null?void 0:c.PlacesServiceStatus.OK)&&o?r(o):r([])})})}static async getPlaceDetails(e){var n,r;return typeof window=="undefined"||!((r=(n=window.google)==null?void 0:n.maps)!=null&&r.places)?null:new Promise((i,o)=>{new window.google.maps.places.PlacesService(document.createElement("div")).getDetails({placeId:e,fields:["place_id","formatted_address","address_components","geometry"]},(a,l)=>{var c,u,p;l===((p=(u=(c=window.google)==null?void 0:c.maps)==null?void 0:u.places)==null?void 0:p.PlacesServiceStatus.OK)&&a?i(a):i(null)})})}static extractAddressComponents(e){let n={};for(let r of e.address_components){let i=r.types;i.includes("street_number")?n.streetNumber=r.long_name:i.includes("route")?n.route=r.long_name:i.includes("locality")?(n.city=r.long_name,n.locality=r.long_name):i.includes("administrative_area_level_2")?(n.administrativeAreaLevel2=r.short_name,n.administrativeAreaLevel2Long=r.long_name,n.city||(n.city=r.long_name,n.locality=r.long_name)):i.includes("administrative_area_level_1")?(n.state=r.long_name,n.administrativeAreaLevel1=r.short_name,n.administrativeAreaLevel1Long=r.long_name):i.includes("postal_code")?n.postalCode=r.long_name:i.includes("country")&&(n.country=r.long_name,n.countryCode=r.short_name,n.iso=r.short_name)}return!n.administrativeAreaLevel1&&n.administrativeAreaLevel2&&(n.state=n.administrativeAreaLevel2Long||n.administrativeAreaLevel2,n.administrativeAreaLevel1=n.administrativeAreaLevel2,n.administrativeAreaLevel1Long=n.administrativeAreaLevel2Long),n}};Jt.apiKey=null,Jt.service=null;Kn();ht();var _c=gs(Qo()),kc,Yr=typeof window!="undefined"&&typeof document!="undefined",Lc=Yr?history.pushState.bind(history):null,Dc=Yr?history.replaceState.bind(history):null;function Un(){kc=void 0}Yr&&(window.addEventListener("popstate",Un),window.addEventListener("hashchange",Un),history.pushState=function(...t){return Un(),Lc.apply(this,t)},history.replaceState=function(...t){return Un(),Dc.apply(this,t)});function Bc(){if(typeof window=="undefined"||typeof document=="undefined")return[];let t=De();return t!=null&&t.scripts?t.scripts.filter(e=>e.enabled):[]}function Mc(t,e){let n=t.position||"body-end",r="tagada-stepconfig-script-".concat(e);if(document.getElementById(r))return;let i=t.content.trim(),o=i.match(/^<script[^>]*>([\s\S]*)<\/script>$/i);if(o&&(i=o[1].trim()),!i)return;let s="(function() {\n try {\n // Script: "+t.name+"\n"+i+'\n } catch (error) {\n console.error("[TagadaPay] StepConfig script error:", error);\n }\n})();',a=document.createElement("script");switch(a.id=r,a.setAttribute("data-tagada-stepconfig-script","true"),a.setAttribute("data-script-name",t.name),a.textContent=s,n){case"head-start":document.head.firstChild?document.head.insertBefore(a,document.head.firstChild):document.head.appendChild(a);break;case"head-end":document.head.appendChild(a);break;case"body-start":document.body.firstChild?document.body.insertBefore(a,document.body.firstChild):document.body.appendChild(a);break;case"body-end":default:document.body.appendChild(a);break}}function es(){let t=Bc();t.length!==0&&t.forEach((e,n)=>{Mc(e,n)})}if(typeof window!="undefined"&&typeof document!="undefined"){let t=()=>{document.body?es():document.addEventListener("DOMContentLoaded",es,{once:!0})};"requestIdleCallback"in window?window.requestIdleCallback(t,{timeout:100}):setTimeout(t,0)}function ts(t={}){return new Dn(t)}ze();var qr="1.0.0";function ns(t){return typeof window=="undefined"?null:new URLSearchParams(window.location.search).get(t)}function Y(t,...e){t&&console.log("[TagadaTracker]",...e)}function rs(...t){console.warn("[TagadaTracker]",...t)}function Uc(t){if(!t.storeId||typeof t.storeId!="string")throw new Error("TagadaTracker: storeId is required and must be a non-empty string.");if(!t.accountId||typeof t.accountId!="string")throw new Error("TagadaTracker: accountId is required and must be a non-empty string.");if(!t.stepId||typeof t.stepId!="string")throw new Error("TagadaTracker: stepId is required and must be a non-empty string.");if(t.apiBaseUrl)try{new URL(t.apiBaseUrl)}catch(e){throw new Error('TagadaTracker: apiBaseUrl is not a valid URL: "'.concat(t.apiBaseUrl,'"'))}}async function Fc(t,e,n){let r;for(let i=0;i<=e;i++)try{return await t()}catch(o){if(r=o instanceof Error?o:new Error(String(o)),i<e){let s=Math.min(1e3*2**i,8e3);Y(n,"Retry ".concat(i+1,"/").concat(e," in ").concat(s,"ms...")),await new Promise(a=>setTimeout(a,s))}}throw r}var Zt=class{constructor(){this.config=null;this.client=null;this.initialized=!1;this.initializing=!1;this.unsubscribe=null;this.version=qr}async init(e){var r,i;if(this.initialized)return Y(e.debug||!1,"Already initialized \u2014 returning existing session."),this.getSession();if(this.initializing)return Y(e.debug||!1,"Initialization in progress \u2014 skipping duplicate call."),null;this.initializing=!0,this.config=O({debug:!1},e);let n=this.config.debug;try{Uc(this.config)}catch(o){this.initializing=!1;let s=o instanceof Error?o:new Error(String(o));if(this.config.onError)return this.config.onError(s),null;throw s}Y(n,"\u{1F680} Initializing external tracker v".concat(qr),{storeId:e.storeId,accountId:e.accountId,stepId:e.stepId,funnelId:e.funnelId});try{let o=ns("token");o&&(re(o),Y(n,"\u{1F511} Bootstrapped token from URL")),this.client=ts({debugMode:n,features:{funnel:{skipAutoInit:!0}},rawPluginConfig:{storeId:this.config.storeId,accountId:this.config.accountId},customApiConfig:this.config.apiBaseUrl?{apiConfig:{baseUrl:this.config.apiBaseUrl.trim()}}:void 0}),await this.waitForClientReady();let s=await Fc(()=>this.initializeFunnel(),2,n);Y(n,"\u2705 Session initialized:",s),this.initialized=!0;let a=this.getSession();return a&&((i=(r=this.config).onReady)==null||i.call(r,a)),a}catch(o){let s=o instanceof Error?o:new Error(String(o));if(Y(n,"\u274C Initialization failed:",s),this.config.onError)return this.config.onError(s),null;throw s}finally{this.initializing=!1}}getSession(){var n,r;if(!((r=(n=this.client)==null?void 0:n.funnel)!=null&&r.state.context))return null;let e=this.client.funnel.state.context;return{sessionId:e.sessionId,customerId:e.customerId,storeId:e.storeId,funnelId:e.funnelId,currentStepId:e.currentStepId,cmsToken:this.client.state.token||void 0}}isReady(){var e,n;return this.initialized&&!!((n=(e=this.client)==null?void 0:e.funnel)!=null&&n.state.context)}async navigate(e){if(!this.isReady())throw new Error("TagadaTracker: not initialized. Call init() first.");Y(this.config.debug,"\u{1F680} Navigating:",e);let n=e.autoRedirect!==!1;try{let r=await this.client.funnel.navigate({type:e.eventType,data:e.eventData||{}},{autoRedirect:!1});return r!=null&&r.url?(Y(this.config.debug,"\u2705 Navigation result:",r.url),n&&typeof window!="undefined"&&(window.location.href=e.returnUrl||r.url),{url:r.url}):null}catch(r){throw Y(this.config.debug,"\u274C Navigation failed:",r),r}}async trackEvent(e){if(!this.isReady()){rs("trackEvent called before init \u2014 event dropped:",e.name);return}Y(this.config.debug,"\u{1F4CA} Tracking event:",e.name,e.data);try{await this.client.funnel.navigate({type:e.name,data:e.data||{}},{autoRedirect:!1})}catch(n){Y(this.config.debug,"\u26A0\uFE0F Event tracking failed (non-critical):",e.name)}}getCustomerId(){var e,n,r,i,o;return((n=(e=this.client)==null?void 0:e.state.auth.customer)==null?void 0:n.id)||((o=(i=(r=this.client)==null?void 0:r.funnel)==null?void 0:i.state.context)==null?void 0:o.customerId)||null}getFunnelSessionId(){var e,n,r;return((r=(n=(e=this.client)==null?void 0:e.funnel)==null?void 0:n.state.context)==null?void 0:r.sessionId)||null}buildUrl(e,n){let r=this.getSession();if(!r)return e;let i=new URL(e,typeof window!="undefined"?window.location.origin:void 0);return i.searchParams.set("funnelSessionId",r.sessionId),r.cmsToken&&i.searchParams.set("token",r.cmsToken),r.funnelId&&i.searchParams.set("funnelId",r.funnelId),i.searchParams.set("storeId",r.storeId),n&&Object.entries(n).forEach(([o,s])=>{i.searchParams.set(o,s)}),i.toString()}getClient(){return this.client}async reset(e){var i,o;if(!this.client||!this.config)throw new Error("TagadaTracker: not initialized. Call init() first.");Y(this.config.debug,"\u{1F504} Resetting to step:",e),this.config.stepId=e;let n=await this.initializeFunnel(),r=this.getSession();return r&&((o=(i=this.config).onReady)==null||o.call(i,r)),r}destroy(){var e,n;this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null),this.client&&((n=(e=this.client).destroy)==null||n.call(e)),this.client=null,this.config=null,this.initialized=!1,this.initializing=!1,Y(!1,"\u{1F5D1}\uFE0F Tracker destroyed")}async waitForClientReady(){if(this.client)return new Promise(e=>{var i;if((i=this.client)!=null&&i.state.isInitialized){e();return}let n=!1,r=setTimeout(()=>{var o;n||(n=!0,Y(((o=this.config)==null?void 0:o.debug)||!1,"\u23F1\uFE0F Client ready timeout \u2014 proceeding"),e())},1e4);this.unsubscribe=this.client.subscribe(()=>{var o;!n&&((o=this.client)!=null&&o.state.isInitialized)&&(n=!0,clearTimeout(r),e())})})}async initializeFunnel(){var s,a,l;if(!((s=this.client)!=null&&s.funnel))return null;let e=(a=this.client.state.auth.customer)==null?void 0:a.id,n=(l=this.client.state.auth.session)==null?void 0:l.sessionId;!e&&!n&&rs("No auth session available \u2014 funnel init may fail.");let r={customerId:e||"anon_placeholder",sessionId:n||"sess_placeholder"},i={id:this.config.storeId,accountId:this.config.accountId},o=this.config.stepId;return Y(this.config.debug,"\u{1F50D} Initializing funnel at step:",o),this.client.funnel.initialize(r,i,this.config.funnelId||ns("funnelId")||void 0,o)}},jr=new Zt;typeof window!="undefined"&&(window.TagadaTracker=jr);return ms(Gc);})();
7
- /*! Bundled license information:
8
-
9
- detect-europe-js/dist/esm/index.js:
10
- (*! detectEurope.js v0.1.2
11
- Determine whether a user is from the European Union (EU) area
12
- https://github.com/faisalman/detect-europe-js
13
- Author: Faisal Salman <f@faisalman.com>
14
- MIT License *)
15
-
16
- ua-is-frozen/dist/esm/index.js:
17
- (*! isFrozenUA
18
- A freeze-test for your user-agent string
19
- https://github.com/faisalman/ua-is-frozen
20
- Author: Faisal Salman <f@faisalman.com>
21
- MIT License *)
22
-
23
- is-standalone-pwa/dist/esm/index.js:
24
- (*! isStandalonePWA 0.1.1
25
- Detect if PWA is running in standalone mode
26
- https://github.com/faisalman/is-standalone-pwa
27
- Author: Faisal Salman <f@faisalman.com>
28
- MIT License *)
29
- */
6
+ "use strict";var TagadaTrackerBundle=(()=>{var re=Object.defineProperty,Ct=Object.defineProperties,It=Object.getOwnPropertyDescriptor,wt=Object.getOwnPropertyDescriptors,vt=Object.getOwnPropertyNames,Fe=Object.getOwnPropertySymbols;var Ne=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable;var De=(n,e,t)=>e in n?re(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,h=(n,e)=>{for(var t in e||(e={}))Ne.call(e,t)&&De(n,t,e[t]);if(Fe)for(var t of Fe(e))St.call(e,t)&&De(n,t,e[t]);return n},b=(n,e)=>Ct(n,wt(e));var N=(n,e)=>()=>(n&&(e=n(n=0)),e);var Te=(n,e)=>{for(var t in e)re(n,t,{get:e[t],enumerable:!0})},Tt=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of vt(e))!Ne.call(n,o)&&o!==t&&re(n,o,{get:()=>e[o],enumerable:!(i=It(e,o))||i.enumerable});return n};var bt=n=>Tt(re({},"__esModule",{value:!0}),n);function Ue(n){var i;if(typeof document=="undefined")return null;let t="; ".concat(document.cookie).split("; ".concat(n,"="));return t.length===2&&((i=t.pop())==null?void 0:i.split(";").shift())||null}function Oe(n="local"){let e=Le[n];if(!e)return console.warn("Unknown environment: ".concat(n,". Falling back to local.")),{environment:"local",apiConfig:Le.local};let t=null;if(typeof window!="undefined"&&(t=new URLSearchParams(window.location.search).get("tagadaClientBaseUrl"),!t))try{t=localStorage.getItem("tgd_client_base_url")||Ue("tgd_client_base_url")}catch(o){}return t?(console.log("[SDK] Using custom API base URL override: ".concat(t)),{environment:n,apiConfig:b(h({},e),{baseUrl:t})}):{environment:n,apiConfig:e}}function J(){var o;if(console.log("[SDK] detectEnvironment() called"),typeof window=="undefined")return"local";let e=new URLSearchParams(window.location.search).get("tagadaClientEnv");if(e&&(e==="production"||e==="development"||e==="local"))return console.log("[SDK] Using explicit environment override: ".concat(e)),e;try{let r=localStorage.getItem("tgd_client_env")||Ue("tgd_client_env");if(r&&(r==="production"||r==="development"||r==="local"))return console.log("[SDK] Using persisted environment override: ".concat(r)),r}catch(r){}let t=window.location.hostname,i=window.location.href;if(console.log('[SDK] detectEnvironment() - hostname: "'.concat(t,'"')),t==="localhost"||t.startsWith("127.")||t.startsWith("192.168.")||t.startsWith("10.")||t.includes(".local")||t===""||t==="0.0.0.0"||t.includes("ngrok-free.dev")||t.includes("ngrok-free.app")||t.includes("ngrok.io")||t.includes("ngrok.app")||t.includes(".loclx.io")){if(console.log("[SDK] detectEnvironment() - returning LOCAL"),typeof window!="undefined"&&((o=window==null?void 0:window.__TAGADA_ENV__)!=null&&o.TAGADA_ENVIRONMENT)){let r=window.__TAGADA_ENV__.TAGADA_ENVIRONMENT.toLowerCase();if(r==="production"||r==="development"||r==="local")return console.log("[SDK] Local override detected: ".concat(r)),r}return"local"}return t==="app.tagadapay.com"||t.includes("tagadapay.com")||t.includes("yourproductiondomain.com")?"production":t==="app.tagadapay.dev"||t.includes("tagadapay.dev")||t.includes("vercel.app")||t.includes("netlify.app")||t.includes("surge.sh")||t.includes("github.io")||t.includes("herokuapp.com")||t.includes("railway.app")||i.includes("?env=dev")||i.includes("?dev=true")||i.includes("#dev")?"development":(console.warn("[SDK] Unknown domain: ".concat(t,", defaulting to production")),"production")}function Y(n=!1){return J()!=="local"?!1:n&&typeof window!="undefined"?!window.location.hostname.includes(".cdn."):!0}var Le,se=N(()=>{"use strict";Le={production:{baseUrl:"https://app.tagadapay.com",endpoints:{checkout:{sessionInit:"/api/v1/checkout/session/init",sessionInitAsync:"/api/v1/checkout/session/init-async",sessionStatus:"/api/v1/checkout/session/status",asyncStatus:"/api/public/v1/checkout/async-status"},customer:{profile:"/api/v1/customer/profile",session:"/api/v1/customer/session"},store:{config:"/api/v1/store/config"}}},development:{baseUrl:"https://app.tagadapay.dev",endpoints:{checkout:{sessionInit:"/api/v1/checkout/session/init",sessionInitAsync:"/api/v1/checkout/session/init-async",sessionStatus:"/api/v1/checkout/session/status",asyncStatus:"/api/public/v1/checkout/async-status"},customer:{profile:"/api/v1/customer/profile",session:"/api/v1/customer/session"},store:{config:"/api/v1/store/config"}}},local:{baseUrl:"http://app.localhost:3000",endpoints:{checkout:{sessionInit:"/api/v1/checkout/session/init",sessionInitAsync:"/api/v1/checkout/session/init-async",sessionStatus:"/api/v1/checkout/session/status",asyncStatus:"/api/public/v1/checkout/async-status"},customer:{profile:"/api/v1/customer/profile",session:"/api/v1/customer/session"},store:{config:"/api/v1/store/config"}}}}});var ae,Me=N(()=>{"use strict";ae=class{constructor(e){this.apiClient=e}async initialize(e){return this.apiClient.post("/api/v1/funnel/initialize",e)}async navigate(e){return this.apiClient.post("/api/v1/funnel/navigate",e)}async updateContext(e,t){return this.apiClient.patch("/api/v1/funnel/context/".concat(e),t)}async endSession(e){return this.apiClient.delete("/api/v1/funnel/session/".concat(e))}async getSession(e,t,i){let o=new URLSearchParams;t&&o.append("currentUrl",t),i&&o.append("includeDebugData","true");let r="/api/v1/funnel/session/".concat(e).concat(o.toString()?"?".concat(o):"");return this.apiClient.get(r)}}});var $,be=N(()=>{"use strict";$=class{constructor(){this.listeners=new Set}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(e){this.listeners.forEach(t=>{try{t(e)}catch(i){console.error("Error in event listener:",i)}})}clear(){this.listeners.clear()}}});function x(n){if(typeof window!="undefined")try{let t=localStorage.getItem(le)!==n;localStorage.setItem(le,n),t&&window.dispatchEvent(new Event("storage"))}catch(e){console.error("Failed to save token to localStorage:",e)}}function X(){if(typeof window!="undefined")try{return localStorage.getItem(le)}catch(n){return console.error("Failed to get token from localStorage:",n),null}return null}function B(){if(typeof window!="undefined")try{localStorage.removeItem(le)}catch(n){console.error("Failed to clear token from localStorage:",n)}}var le,j=N(()=>{"use strict";le="cms_token"});function ze(n){typeof document!="undefined"&&(document.cookie="".concat(xe,"=").concat(n,"; path=/; max-age=2592000; SameSite=Lax"))}function $e(){if(typeof document=="undefined")return;let n=document.cookie.split("; ").find(e=>e.startsWith("".concat(xe,"=")));return n?n.split("=")[1]:void 0}function ce(){typeof document!="undefined"&&(document.cookie="".concat(xe,"=; path=/; max-age=0"))}var xe,de=N(()=>{"use strict";xe="tgd-funnel-session-id"});function K(n){if(typeof window=="undefined")return null;try{return localStorage.getItem(n)}catch(e){return null}}function V(n,e){if(typeof window!="undefined")try{localStorage.setItem(n,e)}catch(t){}}function Z(n){var i;if(typeof document=="undefined")return null;let t=document.cookie.split(";").find(o=>o.trim().startsWith("".concat(n,"=")));return t?(i=t.split("=")[1])==null?void 0:i.trim():null}function Q(n,e,t=86400){if(typeof document!="undefined"){if(n==="tgd_draft"||n==="tgd-draft"){console.warn("\u{1F6E1}\uFE0F [SDK] Blocked attempt to set ".concat(n," as cookie - this should only be in localStorage"));return}document.cookie="".concat(n,"=").concat(e,"; path=/; max-age=").concat(t)}}function je(n){typeof document!="undefined"&&(document.cookie="".concat(n,"=; path=/; max-age=0"))}function U(){if(typeof window=="undefined")return{};let n=new URLSearchParams(window.location.search),e,t=n.get("draft");if(t!==null)e=t==="true";else{let y=K(C.DRAFT);y!==null&&(e=y==="true")}let i,o=n.get("funnelTracking");if(o!==null)i=o!=="false";else{let y=K(C.FUNNEL_TRACKING)||Z(C.FUNNEL_TRACKING);y!==null&&(i=y!=="false")}let r=n.get("token")||X()||null,s=n.get("funnelSessionId")||null,a=n.get("funnelId")||null,c,p=n.get("funnelEnv");p&&(p==="staging"||p==="production")&&(c=p);let m=n.get("forceReset")==="true",l,f=n.get("tagadaClientEnv");if(f&&(f==="production"||f==="development"||f==="local"))l=f;else{let y=K(C.CLIENT_ENV)||Z(C.CLIENT_ENV);y&&(y==="production"||y==="development"||y==="local")&&(l=y)}let u,d=n.get("tagadaClientBaseUrl");if(d)u=d;else{let y=K(C.CLIENT_BASE_URL)||Z(C.CLIENT_BASE_URL);y&&(u=y)}let w,g=n.get("currency");if(g)w=g;else{let y=K(C.CURRENCY)||Z(C.CURRENCY);y&&(w=y)}let I,R=n.get("locale");if(R)I=R;else{let y=K(C.LOCALE)||Z(C.LOCALE);y&&(I=y)}return{forceReset:m,token:r,funnelSessionId:s,funnelId:a,draft:e,funnelTracking:i,funnelEnv:c,tagadaClientEnv:l,tagadaClientBaseUrl:u,currency:w,locale:I}}function ee(){var e;return(e=U().draft)!=null?e:!1}function Ee(n){if(typeof window!="undefined")if(n)V(C.DRAFT,"true");else try{localStorage.removeItem(C.DRAFT)}catch(e){}}function Ke(n=!1){let e=null;typeof window!="undefined"&&(e=new URLSearchParams(window.location.search).get("token"));let t=U(),i=t.forceReset||!1;if(!i&&!t.token)return Be(),!1;n&&(console.log("[SDK] Detected params:",t),console.log("[SDK] URL token (direct read):",e?e.substring(0,20)+"...":"none")),i&&(n&&console.log("[SDK] Force reset: Clearing all stored state"),B(),ce(),typeof window!="undefined"&&window.localStorage&&Object.keys(localStorage).forEach(s=>{(s.startsWith("tagadapay_")||s.startsWith("tgd_"))&&(n&&console.log("[SDK] Clearing localStorage: ".concat(s)),localStorage.removeItem(s))}));let o=e||t.token;return o!=null?(n&&console.log("[SDK] Setting token from URL:",o.substring(0,20)+"..."),o===""||o==="null"?B():(x(o),n&&console.log("[SDK] \u2705 Token set in localStorage immediately after clear"))):i&&(n&&console.log("[SDK] Force reset mode (no token in URL)"),B()),Be(),t.funnelSessionId&&n&&console.log("[SDK] Using funnelSessionId from URL:",t.funnelSessionId),i}function Be(){if(typeof window=="undefined")return;let n=new URLSearchParams(window.location.search),e=n.get("draft");e!==null&&Ee(e==="true");let t=n.get("funnelTracking");t!==null&&xt(t!=="false");let i=n.get("tagadaClientEnv");i&&(i==="production"||i==="development"||i==="local")&&Et(i);let o=n.get("tagadaClientBaseUrl");o&&kt(o);let r=n.get("currency");r&&(V(C.CURRENCY,r.toUpperCase()),Q(C.CURRENCY,r.toUpperCase(),86400));let s=n.get("locale");s&&(V(C.LOCALE,s),Q(C.LOCALE,s,86400))}function xt(n){if(typeof window=="undefined")return;let e=n?"true":"false";V(C.FUNNEL_TRACKING,e),Q(C.FUNNEL_TRACKING,e,86400)}function Et(n){typeof window!="undefined"&&(V(C.CLIENT_ENV,n),Q(C.CLIENT_ENV,n,86400))}function Ve(){if(typeof window!="undefined")try{localStorage.removeItem(C.CLIENT_ENV),je(C.CLIENT_ENV)}catch(n){}}function kt(n){typeof window!="undefined"&&(V(C.CLIENT_BASE_URL,n),Q(C.CLIENT_BASE_URL,n,86400))}function Ge(){if(typeof window!="undefined")try{localStorage.removeItem(C.CLIENT_BASE_URL),je(C.CLIENT_BASE_URL)}catch(n){}}function He(){var e;return(e=U().funnelTracking)!=null?e:!0}var C,ue=N(()=>{"use strict";j();de();C={DRAFT:"tgd_draft",FUNNEL_TRACKING:"tgd_funnel_tracking",FORCE_RESET:"tgd_force_reset",CLIENT_ENV:"tgd_client_env",CLIENT_BASE_URL:"tgd_client_base_url",CURRENCY:"tgd_currency",LOCALE:"tgd_locale"}});var qe={};Te(qe,{injectPreviewModeIndicator:()=>At,isIndicatorInjected:()=>_t,removePreviewModeIndicator:()=>Pt});function ke(n){if(typeof window=="undefined"||typeof document=="undefined")return;let e=window.location.hostname,t=e.split("."),i=["",e,"."+e];for(let a=1;a<t.length;a++){let c=t.slice(a).join(".");i.push(c),i.push("."+c)}let o=window.location.pathname.split("/").filter(a=>a),r=["/"],s="";o.forEach(a=>{s+="/"+a,r.push(s)}),i.forEach(a=>{r.forEach(c=>{let p="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=").concat(c),m=a?"; domain=".concat(a):"";document.cookie=p+m,document.cookie=p+m+"; secure",document.cookie=p+m+"; SameSite=None; secure",document.cookie=p+m+"; SameSite=Lax",document.cookie=p+m+"; SameSite=Strict"})})}function Rt(){if(typeof window=="undefined"||!confirm("\u{1F6AA} Leave Preview Mode?\n\nThis will clear ALL cookies and localStorage (including Shopify session, cart, and preview settings) and reload the page.\n\nAre you sure?"))return;let e=new URL(window.location.href);["draft","funnelEnv","funnelTracking","tagadaClientEnv","tagadaClientBaseUrl","forceReset","funnelId","funnelSessionId","token"].forEach(r=>e.searchParams.delete(r)),window.history.replaceState({},"",e.href);try{let r=Object.getOwnPropertyDescriptor(Document.prototype,"cookie")||Object.getOwnPropertyDescriptor(HTMLDocument.prototype,"cookie");r&&r.set&&Object.defineProperty(document,"cookie",{configurable:!0,enumerable:!0,get:function(){return r.get?r.get.call(this):""},set:function(s){if(typeof s=="string"){let a=s.toLowerCase();if(a.includes("tgd_draft")||a.includes("tgd-draft")||a.includes("tgd.draft")||a.includes("tgddraft")){if(a.includes("max-age=0")||a.includes("expires=thu, 01 jan 1970")){r.set&&r.set.call(this,s);return}console.warn("\u{1F6E1}\uFE0F [TagadaPay] BLOCKED: tgd_draft should never be a cookie");return}}r.set&&r.set.call(this,s)}})}catch(r){console.warn("[TagadaPay] Could not install cookie blocker:",r)}if(window.localStorage)try{localStorage.removeItem("tgd_draft"),localStorage.removeItem("tgd_funnel_tracking"),localStorage.removeItem("tgd_client_env"),localStorage.removeItem("tgd_client_base_url"),localStorage.removeItem("cms_token")}catch(r){console.warn("[TagadaPay] Failed to clear some localStorage keys:",r)}B(),ce(),Ve(),Ge(),window.localStorage&&localStorage.clear(),window.sessionStorage&&sessionStorage.clear(),["tgd-funnel-session-id","tgd_draft","tgd_funnel_tracking","tgd_client_env","tgd_client_base_url","cms_token","tagadapay_session"].forEach(r=>ke(r)),["tgd-draft","tgd_draft","tgd.draft","tgddraft"].forEach(r=>ke(r)),document.cookie&&document.cookie.split(";").forEach(s=>{let a=s.split("=")[0].trim();if(!a)return;let c=window.location.hostname,p=c.split("."),m=["",c,"."+c];for(let d=1;d<p.length;d++){let w=p.slice(d).join(".");m.push(w),m.push("."+w)}let l=window.location.pathname.split("/").filter(d=>d),f=["/"],u="";l.forEach(d=>{u+="/"+d,f.push(u)}),m.forEach(d=>{f.forEach(w=>{let g="".concat(a,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=").concat(w),I=d?"; domain=".concat(d):"";document.cookie=g+I,document.cookie=g+I+"; secure",document.cookie=g+I+"; SameSite=None; secure",document.cookie=g+I+"; SameSite=Lax",document.cookie=g+I+"; SameSite=Strict",document.cookie=g+I+"; secure; SameSite=None",document.cookie=g+I+"; secure; SameSite=Lax",document.cookie=g+I+"; secure; SameSite=Strict"})})}),setTimeout(()=>{window.localStorage&&localStorage.length>0&&localStorage.clear(),ke("tgd_draft"),typeof window.stop=="function"&&window.stop(),window.location.replace(e.href)},10)}function At(){if(fe||typeof window=="undefined"||typeof document=="undefined")return;let n=U(),e=ee(),t=!He(),i=!!(n.tagadaClientEnv||n.tagadaClientBaseUrl);if(!e&&!t&&!i)return;let o=document.createElement("div");o.id="tgd-preview-indicator",o.style.cssText='\n position: fixed;\n bottom: 16px;\n right: 16px;\n z-index: 999999;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n ';let r=document.createElement("div");r.style.cssText="\n background: ".concat(e?"#ff9500":"#007aff",";\n color: white;\n padding: 8px 12px;\n border-radius: 8px;\n font-size: 13px;\n font-weight: 600;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n cursor: pointer;\n transition: all 0.2s ease;\n display: flex;\n align-items: center;\n gap: 6px;\n "),r.innerHTML='\n <span style="font-size: 16px;">\u{1F50D}</span>\n <span>'.concat(e?"Preview Mode":"Dev Mode","</span>\n ");let s=document.createElement("div");s.style.cssText="\n position: absolute;\n bottom: calc(100% + 8px);\n right: 0;\n background: white;\n border: 1px solid #e5e5e5;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n padding: 12px;\n min-width: 250px;\n font-size: 12px;\n line-height: 1.5;\n display: none;\n ",s.style.paddingTop="20px";let a=document.createElement("div");a.style.cssText="\n position: absolute;\n bottom: 100%;\n left: 0;\n right: 0;\n height: 8px;\n display: none;\n ";let c='<div style="margin-bottom: 8px; font-weight: 600; color: #1d1d1f;">Current Environment</div>';c+='<div style="display: flex; flex-direction: column; gap: 6px;">',e&&(c+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>Draft Mode:</span>\n <span style="color: #ff9500; font-weight: 600;">ON</span>\n </div>\n '),t&&(c+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>Tracking:</span>\n <span style="color: #ff3b30; font-weight: 600;">DISABLED</span>\n </div>\n '),n.funnelEnv&&(c+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>Funnel Env:</span>\n <span style="color: #1d1d1f; font-weight: 600; font-family: monospace; font-size: 11px;">\n '.concat(n.funnelEnv,"\n </span>\n </div>\n ")),n.tagadaClientEnv&&(c+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>API Env:</span>\n <span style="color: #1d1d1f; font-weight: 600; font-family: monospace; font-size: 11px;">\n '.concat(n.tagadaClientEnv,"\n </span>\n </div>\n ")),n.tagadaClientBaseUrl&&(c+='\n <div style="color: #86868b;">\n <div style="margin-bottom: 4px;">API URL:</div>\n <div style="color: #1d1d1f; font-weight: 600; font-family: monospace; font-size: 10px; word-break: break-all; background: #f5f5f7; padding: 4px 6px; border-radius: 4px;">\n '.concat(n.tagadaClientBaseUrl,"\n </div>\n </div>\n ")),n.funnelId&&(c+='\n <div style="color: #86868b; margin-top: 4px; padding-top: 8px; border-top: 1px solid #e5e5e5;">\n <div style="margin-bottom: 4px;">Funnel ID:</div>\n <div style="color: #1d1d1f; font-family: monospace; font-size: 10px; word-break: break-all; background: #f5f5f7; padding: 4px 6px; border-radius: 4px;">\n '.concat(n.funnelId,"\n </div>\n </div>\n ")),c+="</div>",c+='\n <div style="margin-top: 12px; padding-top: 8px; border-top: 1px solid #e5e5e5; font-size: 11px; color: #86868b; text-align: center;">\n Add <code style="background: #f5f5f7; padding: 2px 4px; border-radius: 3px;">?forceReset=true</code> to reset\n </div>\n ',c+='\n <div style="margin-top: 12px; padding-top: 8px; border-top: 1px solid #e5e5e5;">\n <button id="tgd-leave-preview" style="\n background: #ff3b30;\n color: white;\n border: none;\n border-radius: 6px;\n padding: 10px 12px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n transition: opacity 0.2s;\n width: 100%;\n ">\n \u{1F6AA} Leave Preview Mode\n </button>\n </div>\n ',s.innerHTML=c;let p=!1,m=()=>{p=!0,s.style.display="block",a.style.display="block"},l=()=>{p=!1,setTimeout(()=>{p||(s.style.display="none",a.style.display="none")},100)};r.addEventListener("mouseenter",m),r.addEventListener("mouseleave",l),a.addEventListener("mouseenter",m),a.addEventListener("mouseleave",l),s.addEventListener("mouseenter",m),s.addEventListener("mouseleave",l);let f=s.querySelector("#tgd-leave-preview");f&&(f.addEventListener("mouseenter",()=>{f.style.opacity="0.8"}),f.addEventListener("mouseleave",()=>{f.style.opacity="1"}),f.addEventListener("click",u=>{u.stopPropagation(),Rt()})),o.appendChild(r),o.appendChild(a),o.appendChild(s),document.body.appendChild(o),G=o,fe=!0}function Pt(){G&&G.parentNode&&(G.parentNode.removeChild(G),G=null,fe=!1)}function _t(){return fe}var G,fe,We=N(()=>{"use strict";ue();j();de();G=null,fe=!1});var rt={};Te(rt,{FunnelClient:()=>ne,TrackingProvider:()=>Ze,findMethod:()=>tt,getAssignedOrderBumpOfferIds:()=>Bt,getAssignedPaymentFlowId:()=>it,getAssignedPixels:()=>$t,getAssignedResources:()=>ot,getAssignedScripts:()=>zt,getAssignedStaticResources:()=>Mt,getAssignedStepConfig:()=>P,getAssignedUpsellOfferIds:()=>jt,getEnabledMethods:()=>Qe,getExpressMethods:()=>et,getExpressMethodsByProcessor:()=>Ft,getLocalFunnelConfig:()=>nt,isMethodEnabled:()=>Dt,loadLocalFunnelConfig:()=>Ut});function Qe(n){return n?Object.values(n).filter(e=>e.enabled):[]}function et(n){return Qe(n).filter(e=>e.express)}function Ft(n){let e={};for(let t of et(n)){let i=t.processorId||t.integrationId||t.provider;e[i]||(e[i]=[]),e[i].push(t)}return e}function tt(n,e){if(n){for(let t of Object.values(n))if(t.method===e&&t.enabled)return t}}function Dt(n,e){return!!tt(n,e)}function Nt(){if(typeof window!="undefined"){if(window.__TGD_FUNNEL_ID__)return window.__TGD_FUNNEL_ID__;if(typeof document!="undefined"){let n=document.querySelector('meta[name="x-funnel-id"]');return(n==null?void 0:n.getAttribute("content"))||void 0}}}function ge(){if(typeof window!="undefined"){if(window.__TGD_FUNNEL_VARIANT_ID__)return window.__TGD_FUNNEL_VARIANT_ID__;if(typeof document!="undefined"){let n=document.querySelector('meta[name="x-funnel-variant-id"]');return(n==null?void 0:n.getAttribute("content"))||void 0}}}function te(){if(typeof window!="undefined"){if(window.__TGD_FUNNEL_STEP_ID__)return window.__TGD_FUNNEL_STEP_ID__;if(typeof document!="undefined"){let n=document.querySelector('meta[name="x-funnel-step-id"]');return(n==null?void 0:n.getAttribute("content"))||void 0}}}function Ye(n){if(!n||typeof n!="string")return;let e=n.trim();if(!e)return;let t=[()=>JSON.parse(e),()=>JSON.parse(decodeURIComponent(e)),()=>JSON.parse(decodeURIComponent(decodeURIComponent(e)))];for(let i of t)try{let o=i();if(o&&typeof o=="object")return o}catch(o){}typeof console!="undefined"&&console.warn("[SDK] Failed to parse stepConfig:",e.substring(0,100))}function Lt(){if(typeof window=="undefined")return!1;let n=window.location.hostname;return n==="localhost"||n==="127.0.0.1"||n.endsWith(".localhost")&&!n.includes(".cdn.")}async function Ut(){if(!Lt())return null;if(E!==void 0)return E;if(Re)return await new Promise(n=>setTimeout(n,100)),E!=null?E:null;Re=!0;try{console.log("\u{1F6E0}\uFE0F [SDK] Loading local funnel config from /config/funnel.local.json...");let n=await fetch("/config/funnel.local.json");if(!n.ok)return console.log("\u{1F6E0}\uFE0F [SDK] funnel.local.json not found (this is fine in production)"),E=null,null;let e=await n.json();return console.log("\u{1F6E0}\uFE0F [SDK] \u2705 Loaded local funnel config:",e),E=e,e}catch(n){return console.log("\u{1F6E0}\uFE0F [SDK] funnel.local.json not available:",n),E=null,null}finally{Re=!1}}function nt(){return E!=null?E:null}function Ot(n){let e=h(h({},n.staticResources),n.resources);return{payment:n.paymentFlowId?{paymentFlowId:n.paymentFlowId}:void 0,resources:Object.keys(e).length>0?e:void 0,scripts:n.scripts,pixels:n.pixels,orderBumps:n.orderBumps,upsellOffers:n.upsellOffers}}function P(){if(typeof window=="undefined")return;let n=nt();if(n)return console.log("\u{1F6E0}\uFE0F [SDK] Using local funnel.local.json (overrides injected)"),Ot(n);let e=window.__TGD_STEP_CONFIG__;if(e){let t=Ye(e);if(t)return t}if(typeof document!="undefined"){let t=document.querySelector('meta[name="x-step-config"]'),i=t==null?void 0:t.getAttribute("content");if(i){let o=Ye(i);if(o)return o}}}function it(){var t,i;let n=P(),e=(t=n==null?void 0:n.paymentSetupConfig)==null?void 0:t.card;if(e!=null&&e.paymentFlowId)return e.paymentFlowId;if((i=n==null?void 0:n.payment)!=null&&i.paymentFlowId)return n.payment.paymentFlowId;if(typeof window!="undefined"){if(window.__TGD_PAYMENT_FLOW_ID__)return window.__TGD_PAYMENT_FLOW_ID__;if(typeof document!="undefined"){let o=document.querySelector('meta[name="x-payment-flow-id"]');return(o==null?void 0:o.getAttribute("content"))||void 0}}}function ot(){let n=P(),e=n==null?void 0:n.staticResources,t=n==null?void 0:n.resources;if(!(!e&&!t))return h(h({},e),t)}function Mt(){return ot()}function zt(n){let e=P();if(!(e!=null&&e.scripts))return;let t=e.scripts.filter(i=>i.enabled);return n&&(t=t.filter(i=>i.position===n||!i.position&&n==="head-end")),t.length>0?t:void 0}function Xe(n){let e="containerId"in n?"containerId":"pixelId",t=n[e];if(!t||!t.includes(";")&&!t.includes(","))return[n];let i=t.split(/[;,]/).map(o=>o.trim()).filter(o=>o.length>0);return i.length<=1?[n]:i.map(o=>b(h({},n),{[e]:o}))}function $t(){let n=P(),e=n==null?void 0:n.pixels;if(!e||typeof e!="object")return;let t={};for(let[i,o]of Object.entries(e))o&&(Array.isArray(o)?t[i]=o.flatMap(r=>Xe(r)):typeof o=="object"&&(t[i]=Xe(o)));return Object.keys(t).length>0?t:void 0}function Bt(){let n=P();if(n!=null&&n.orderBumps&&n.orderBumps.mode==="custom")return n.orderBumps.enabledOfferIds}function jt(){let n=P();if(n!=null&&n.upsellOffers&&n.upsellOffers.mode==="custom")return n.upsellOffers.enabledUpsellIds}var Je,Ze,E,Re,ne,pe=N(()=>{"use strict";se();Me();be();ue();de();Je=()=>Promise.resolve().then(()=>(We(),qe)).then(n=>n.injectPreviewModeIndicator()),Ze=(r=>(r.FACEBOOK="facebook",r.TIKTOK="tiktok",r.SNAPCHAT="snapchat",r.PINTEREST="pinterest",r.GTM="gtm",r))(Ze||{});Re=!1;ne=class{constructor(e){this.eventDispatcher=new $;this.isInitializing=!1;this.initializationAttempted=!1;this.config=e,this.resource=new ae(e.apiClient),this.state={context:null,isLoading:!1,isInitialized:!1,isNavigating:!1,error:null,sessionError:null}}setConfig(e){this.config=h(h({},this.config),e)}subscribe(e){return this.eventDispatcher.subscribe(e)}getState(){return this.state}getDetectedSessionId(){var i;if((i=this.state.context)!=null&&i.sessionId)return this.state.context.sessionId;if(typeof window=="undefined")return null;let t=new URLSearchParams(window.location.search).get("funnelSessionId");return t||$e()||null}resetInitialization(){this.initializationAttempted=!1,this.isInitializing=!1,this.updateState({context:null,isInitialized:!1})}async autoInitialize(e,t,i){if(this.state.context)return this.state.context;if(this.isInitializing||this.initializationAttempted)return null;this.initializationAttempted=!0,this.isInitializing=!0,this.updateState({isLoading:!0,error:null});try{let o=this.getDetectedSessionId(),a=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("funnelId")||i,c=Nt(),p=ge(),m=te(),l=U(),f=this.config.funnelId||c||a,u=this.config.stepId||m,d=typeof window!="undefined"?new URLSearchParams(window.location.search):null,w=d==null?void 0:d.get("funnelEnv");this.config.debugMode&&console.log("\u{1F680} [FunnelClient] Auto-initializing...",{existingSessionId:o,effectiveFunnelId:f,funnelVariantId:p,funnelStepId:u,draft:l.draft,funnelTracking:l.funnelTracking,funnelEnv:w,tagadaClientEnv:l.tagadaClientEnv,tagadaClientBaseUrl:l.tagadaClientBaseUrl,source:{funnelId:this.config.funnelId?"config":c?"injected":a?"url/prop":"none",stepId:this.config.stepId?"config":m?"injected":"none"}});let g=await this.resource.initialize({cmsSession:{customerId:e.customerId,sessionId:e.sessionId,storeId:t.id,accountId:t.accountId},funnelId:f,existingSessionId:o||void 0,currentUrl:typeof window!="undefined"?window.location.href:void 0,funnelVariantId:p,funnelStepId:u,draft:l.draft,funnelTracking:l.funnelTracking,funnelEnv:w||void 0,tagadaClientEnv:l.tagadaClientEnv,tagadaClientBaseUrl:l.tagadaClientBaseUrl,currency:l.currency,locale:l.locale});if(g.success&&g.context){let I=this.enrichContext(g.context);return this.handleSessionSuccess(I),Je(),I}else throw new Error(g.error||"Failed to initialize funnel session")}catch(o){let r=o instanceof Error?o:new Error(String(o));throw this.updateState({error:r,isLoading:!1}),this.config.debugMode&&console.error("\u274C [FunnelClient] Init failed:",r),r}finally{this.isInitializing=!1}}async initialize(e,t,i,o){this.updateState({isLoading:!0,error:null});try{let r=ge(),s=te();this.config.debugMode&&(r&&console.log("\u{1F3AF} [FunnelClient] Detected A/B test variant:",r),s&&console.log("\u{1F3AF} [FunnelClient] Detected step ID:",s));let a=await this.resource.initialize({cmsSession:{customerId:e.customerId,sessionId:e.sessionId,storeId:t.id,accountId:t.accountId},funnelId:i,entryStepId:o,currentUrl:typeof window!="undefined"?window.location.href:void 0,funnelVariantId:r,funnelStepId:s});if(a.success&&a.context){let c=this.enrichContext(a.context);return this.handleSessionSuccess(c),Je(),c}else throw new Error(a.error||"Failed to initialize")}catch(r){let s=r instanceof Error?r:new Error(String(r));throw this.updateState({error:s,isLoading:!1}),s}}async navigate(e,t){var i,o,r,s,a,c;if(t!=null&&t.waitForSession&&!((i=this.state.context)!=null&&i.sessionId)){this.config.debugMode&&console.log("\u23F3 [FunnelClient] Waiting for session before navigation...");let p=5e3,m=Date.now();for(;!((o=this.state.context)!=null&&o.sessionId)&&Date.now()-m<p;)await new Promise(l=>setTimeout(l,100));(r=this.state.context)!=null&&r.sessionId&&this.config.debugMode&&console.log("\u2705 [FunnelClient] Session ready, proceeding with navigation")}if(!((s=this.state.context)!=null&&s.sessionId))throw new Error("No active session");this.updateState({isNavigating:!0,isLoading:!0});try{let p=ge(),m=te(),l=typeof window!="undefined"?window.location.href:void 0;!m&&this.config.stepId&&(m=this.config.stepId,this.config.debugMode&&console.log("\u{1F50D} [FunnelClient.navigate] Using stepId from config (no injection):",m)),!p&&this.config.variantId&&(p=this.config.variantId,this.config.debugMode&&console.log("\u{1F50D} [FunnelClient.navigate] Using variantId from config (no injection):",p)),this.config.debugMode&&console.log("\u{1F50D} [FunnelClient.navigate] Sending to backend:",{sessionId:this.state.context.sessionId,currentUrl:l,funnelStepId:m||"(not found)",funnelVariantId:p||"(not found)",hasInjectedStepId:!!te(),hasInjectedVariantId:!!ge(),usedConfigFallback:!te()&&!!this.config.stepId,customerTags:(t==null?void 0:t.customerTags)||"(none)",deviceId:(t==null?void 0:t.deviceId)||"(none)"});let f=(t==null?void 0:t.fireAndForget)||!1,u=await this.resource.navigate({sessionId:this.state.context.sessionId,event:e,currentUrl:l,funnelStepId:m,funnelVariantId:p,fireAndForget:f,customerTags:t==null?void 0:t.customerTags,deviceId:t==null?void 0:t.deviceId});if(!u.success||!u.result)throw new Error(u.error||"Navigation failed");let d=u.result;if(d.queued)return this.updateState({isNavigating:!1,isLoading:!1}),d.sessionId&&d.sessionId!==((a=this.state.context)==null?void 0:a.sessionId)&&(this.config.debugMode&&console.log("\u{1F525} [FunnelClient] Session ID updated: ".concat((c=this.state.context)==null?void 0:c.sessionId," \u2192 ").concat(d.sessionId)),this.state.context&&(this.state.context.sessionId=d.sessionId)),this.config.debugMode&&console.log("\u{1F525} [FunnelClient] Navigation queued (fire-and-forget mode)"),d;let w=(t==null?void 0:t.autoRedirect)!==void 0?t.autoRedirect:this.config.autoRedirect!==!1;return this.updateState({isNavigating:!1,isLoading:!1}),w&&(d!=null&&d.url)&&typeof window!="undefined"&&(this.config.debugMode&&console.log("\u{1F680} [FunnelClient] Auto-redirecting to:",d.url,"(skipped session refresh - next page will initialize)"),window.location.replace(d.url)),d}catch(p){let m=p instanceof Error?p:new Error(String(p));throw this.updateState({error:m,isNavigating:!1,isLoading:!1}),m}}async goToStep(e,t){return this.navigate({type:"direct_navigation",data:{targetStepId:e}},t)}async refreshSession(){var e;if((e=this.state.context)!=null&&e.sessionId)try{let t=await this.resource.getSession(this.state.context.sessionId);if(t.success&&t.context){let i=this.enrichContext(t.context);return this.updateState({context:i,sessionError:null}),i}}catch(t){this.updateState({sessionError:t instanceof Error?t:new Error(String(t))})}}async updateContext(e){var t;if(!((t=this.state.context)!=null&&t.sessionId))throw new Error("No active session");this.updateState({isLoading:!0});try{let i=await this.resource.updateContext(this.state.context.sessionId,{contextUpdates:e});if(i.success)await this.refreshSession();else throw new Error(i.error||"Failed to update context")}finally{this.updateState({isLoading:!1})}}async endSession(){var e;if((e=this.state.context)!=null&&e.sessionId)try{await this.resource.endSession(this.state.context.sessionId)}finally{this.state.context=null,this.updateState({context:null,isInitialized:!1})}}updateState(e){this.state=h(h({},this.state),e),this.eventDispatcher.notify(this.state)}handleSessionSuccess(e){ze(e.sessionId),this.updateState({context:e,isLoading:!1,isInitialized:!0,error:null,sessionError:null})}enrichContext(e){var s,a;if((((s=this.config.environment)==null?void 0:s.environment)||J())!=="local")return e;let i=((a=this.config.pluginConfig)==null?void 0:a.staticResources)||{};if(Object.keys(i).length===0)return e;let o=e.static||{};return Object.keys(i).every(c=>o[c]===i[c])&&Object.keys(o).length===Object.keys(i).length?e:b(h({},e),{static:h(h({},i),o)})}}});var mn={};Te(mn,{TRACKER_VERSION:()=>_e,TagadaExternalTracker:()=>Se,TagadaTracker:()=>yt});se();pe();var _={NETWORK_ERROR:"network_error",API_ERROR:"api_error",AUTH_REQUIRED:"auth_required",TOKEN_EXPIRED:"token_expired",NOT_FOUND:"not_found",VALIDATION_ERROR:"validation_error",CIRCUIT_BREAKER:"circuit_breaker",PAYMENT_FAILED:"payment_failed",CARD_DECLINED:"card_declined",SESSION_EXPIRED:"session_expired",RATE_LIMITED:"rate_limited",TIMEOUT:"timeout",UNKNOWN:"unknown"},L=class extends Error{constructor(e,t){var i;super(e),this.name="TagadaError",this.code=t.code,this.statusCode=t.statusCode,this.retryable=(i=t.retryable)!=null?i:!1,this.details=t.details,Object.setPrototypeOf(this,new.target.prototype)}},O=class extends L{constructor(e,t,i){var o,r;super(e,{code:(o=i==null?void 0:i.code)!=null?o:_.API_ERROR,statusCode:t,retryable:(r=i==null?void 0:i.retryable)!=null?r:t>=500,details:i==null?void 0:i.details}),this.name="TagadaApiError"}},me=class extends L{constructor(e="Network request failed"){super(e,{code:_.NETWORK_ERROR,retryable:!0}),this.name="TagadaNetworkError"}},he=class extends L{constructor(e="Authentication required",t=401){super(e,{code:_.AUTH_REQUIRED,statusCode:t,retryable:!1}),this.name="TagadaAuthError"}};var ye=class extends L{constructor(e){super(e,{code:_.CIRCUIT_BREAKER,retryable:!1}),this.name="TagadaCircuitBreakerError"}};var Ce=class{constructor(e){this.currentToken=null;this.tokenProvider=null;this.requestHistory=new Map;this.WINDOW_MS=5e3;this.MAX_REQUESTS=30;this.baseURL=e.baseURL,this.timeout=e.timeout||6e4,this.defaultHeaders=h({"Content-Type":"application/json"},e.headers),typeof setInterval!="undefined"&&setInterval(()=>this.cleanupHistory(),1e4)}setTokenProvider(e){this.tokenProvider=e}async get(e,t){return this.request("GET",e,void 0,t)}async post(e,t,i){return this.request("POST",e,t,i)}async put(e,t,i){return this.request("PUT",e,t,i)}async patch(e,t,i){return this.request("PATCH",e,t,i)}async delete(e,t){return this.request("DELETE",e,void 0,t)}setHeader(e,t){this.defaultHeaders[e]=t}removeHeader(e){delete this.defaultHeaders[e]}updateToken(e){this.currentToken=e,e?this.setHeader("x-cms-token",e):(this.removeHeader("x-cms-token"),console.log("[SDK] Token removed from ApiClient"))}getCurrentToken(){return this.currentToken}updateConfig(e){e.baseURL&&(this.baseURL=e.baseURL),e.timeout&&(this.timeout=e.timeout),e.headers&&Object.assign(this.defaultHeaders,e.headers),console.log("[SDK] ApiClient configuration updated")}async request(e,t,i,o){let r="".concat(e,":").concat(t);try{this.checkRequestLimit(r)}catch(l){throw console.error("[SDK] \u{1F6D1} Request blocked by Circuit Breaker:",l),l}if(!(o!=null&&o.skipAuth)&&!this.currentToken&&this.tokenProvider)try{console.log("[SDK] Waiting for token...");let l=await this.tokenProvider();l&&this.updateToken(l)}catch(l){console.error("[SDK] Failed to get token from provider:",l)}let s=h({},this.defaultHeaders);o!=null&&o.headers&&Object.assign(s,o.headers),!(o!=null&&o.skipAuth)&&this.currentToken&&(s["x-cms-token"]=this.currentToken);let a="".concat(this.baseURL).concat(t);if(o!=null&&o.params){let l=new URLSearchParams(o.params);a+="?".concat(l.toString())}console.log("[SDK] Making ".concat(e," request to: ").concat(a));let c=new AbortController,p=setTimeout(()=>c.abort(),this.timeout),m=o!=null&&o.signal?Kt([o.signal,c.signal]):c.signal;try{let l={method:e,headers:s,signal:m};i!==void 0&&(l.body=JSON.stringify(i));let f=await fetch(a,l);if(!f.ok){let d=await this.safeParseJson(f);throw this.toTagadaError(f.status,d,f.statusText)}return await f.json()}catch(l){throw l instanceof L?l:l instanceof DOMException&&l.name==="AbortError"?new O("Request timed out",0,{code:_.TIMEOUT,retryable:!0}):l instanceof TypeError?new me(l.message):l instanceof Error?l:new Error(String(l))}finally{clearTimeout(p)}}toTagadaError(e,t,i){var r,s,a;let o=(s=(r=t==null?void 0:t.message)!=null?r:t==null?void 0:t.error)!=null?s:i;return e===401||e===403?new he(o,e):e===429?new O(o,429,{code:_.RATE_LIMITED,retryable:!0}):e===404?new O(o,404,{code:_.NOT_FOUND,retryable:!1}):new O(o,e,{code:(a=t==null?void 0:t.code)!=null?a:_.API_ERROR,details:t,retryable:e>=500})}async safeParseJson(e){try{return await e.json()}catch(t){return}}checkRequestLimit(e){let t=Date.now(),i=this.requestHistory.get(e);if(!i){this.requestHistory.set(e,{count:1,firstRequestTime:t});return}if(t-i.firstRequestTime>this.WINDOW_MS){this.requestHistory.set(e,{count:1,firstRequestTime:t});return}if(i.count++,i.count>this.MAX_REQUESTS)throw new ye("Circuit Breaker: Too many requests to ".concat(e," (").concat(i.count," in ").concat(this.WINDOW_MS,"ms)"))}cleanupHistory(){let e=Date.now();for(let[t,i]of this.requestHistory.entries())e-i.firstRequestTime>this.WINDOW_MS&&this.requestHistory.delete(t)}};function Kt(n){let e=new AbortController;for(let t of n){if(t.aborted)return e.abort(t.reason),e.signal;t.addEventListener("abort",()=>e.abort(t.reason),{once:!0,signal:e.signal})}return e.signal}function Vt(){return{width:window.screen.width,height:window.screen.height}}function Gt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(n){return"UTC"}}function st(){try{return navigator.language||"en-US"}catch(n){return"en-US"}}var M=typeof navigator!="undefined"?navigator.userAgent:"";function k(n,...e){for(let t of e){let i=n.match(t);if(i)return i}return null}function Ht(n){let e=[[/EdgA?\/([\d.]+)/i,"Edge"],[/OPR\/([\d.]+)/i,"Opera"],[/Brave\/([\d.]+)/i,"Brave"],[/Vivaldi\/([\d.]+)/i,"Vivaldi"],[/SamsungBrowser\/([\d.]+)/i,"Samsung Internet"],[/UCBrowser\/([\d.]+)/i,"UC Browser"],[/Firefox\/([\d.]+)/i,"Firefox"],[/CriOS\/([\d.]+)/i,"Chrome"],[/FxiOS\/([\d.]+)/i,"Firefox"],[/Chrome\/([\d.]+)/i,"Chrome"],[/Version\/([\d.]+).*Safari/i,"Safari"],[/Safari\/([\d.]+)/i,"Safari"]];for(let[t,i]of e){let o=n.match(t);if(o){let r=o[1]||"";return{name:i,version:r,major:r.split(".")[0]||""}}}return{name:"",version:"",major:""}}function qt(n){let e=k(n,/Windows NT ([\d.]+)/i)||k(n,/Mac OS X ([\d_.]+)/i)||k(n,/Android ([\d.]+)/i)||k(n,/iPhone OS ([\d_]+)/i)||k(n,/iPad.*OS ([\d_]+)/i)||k(n,/CrOS[\w ]*\/([\d.]+)/i)||k(n,/Linux/i);if(!e)return{name:"",version:""};let t=e[0],i=(e[1]||"").replace(/_/g,".");return/Windows/i.test(t)?{name:"Windows",version:{"10.0":"10","6.3":"8.1","6.2":"8","6.1":"7","6.0":"Vista","5.1":"XP"}[i]||i}:/Mac OS X/i.test(t)?{name:"macOS",version:i}:/Android/i.test(t)?{name:"Android",version:i}:/iPhone|iPad/i.test(t)?{name:"iOS",version:i}:/CrOS/i.test(t)?{name:"Chrome OS",version:i}:/Linux/i.test(t)?{name:"Linux",version:""}:{name:"",version:""}}function Wt(n){var e;if(/iPad/i.test(n))return{type:"tablet",vendor:"Apple",model:"iPad"};if(/iPhone/i.test(n))return{type:"mobile",vendor:"Apple",model:"iPhone"};if(/iPod/i.test(n))return{type:"mobile",vendor:"Apple",model:"iPod"};if(/Android/i.test(n)){let t=n.match(/Android[\s\d.]+;\s*([^)]+?)(?:\s+Build)/i);return{type:/Mobile/i.test(n)?"mobile":"tablet",model:(e=t==null?void 0:t[1])==null?void 0:e.trim()}}}function Jt(n){let e=k(n,/AppleWebKit\/([\d.]+)/i)||k(n,/Gecko\/([\d.]+)/i)||k(n,/Trident\/([\d.]+)/i)||k(n,/Presto\/([\d.]+)/i);if(!e)return{name:"",version:""};let t=e[0],i=e[1]||"";return/AppleWebKit/i.test(t)?{name:"WebKit",version:i}:/Gecko/i.test(t)?{name:"Gecko",version:i}:/Trident/i.test(t)?{name:"Trident",version:i}:/Presto/i.test(t)?{name:"Presto",version:i}:{name:"",version:""}}function Yt(n){return/x86_64|x64|amd64|Win64/i.test(n)?{architecture:"amd64"}:/ia32|x86/i.test(n)?{architecture:"ia32"}:/aarch64|arm64/i.test(n)?{architecture:"arm64"}:/arm/i.test(n)?{architecture:"arm"}:{architecture:""}}function Xt(){return navigator.webdriver?!0:/bot|crawl|spider|slurp|Googlebot|bingbot|yandex|baidu|duckduck|facebookexternalhit|Twitterbot|linkedinbot|embedly|quora|pinterest|redditbot|Slackbot|Discordbot|WhatsApp|TelegramBot|Applebot/i.test(M)}function Zt(n){return/Chrome|Chromium|Edge|Brave|Opera|Vivaldi|Arc/i.test(n)}function Qt(){return window.matchMedia("(display-mode: standalone)").matches||navigator.standalone===!0}function en(n){return/mac/i.test(n)?navigator.maxTouchPoints>0:!1}function at(){if(typeof window=="undefined")return{userAgent:{name:"",browser:{major:"",name:"",version:""},os:{name:"",version:""},device:void 0,engine:{name:"",version:""},cpu:{architecture:""}},screenResolution:{width:0,height:0},timeZone:"UTC",flags:{isBot:!1,isChromeFamily:!1,isStandalonePWA:!1,isAppleSilicon:!1}};let n=Ht(M),e=qt(M),t=Wt(M),i=Jt(M),o=Yt(M),r;try{r={isBot:Xt(),isChromeFamily:Zt(n.name),isStandalonePWA:Qt(),isAppleSilicon:en(e.name)}}catch(s){r={isBot:!1,isChromeFamily:!1,isStandalonePWA:!1,isAppleSilicon:!1}}return{userAgent:{name:M,browser:n,os:e,device:t,engine:i,cpu:o},screenResolution:Vt(),timeZone:Gt(),flags:r}}function lt(){if(typeof window=="undefined")return{};let n=new URLSearchParams(window.location.search);return{locale:n.get("locale")||void 0,currency:n.get("currency")||void 0,utmSource:n.get("utm_source")||void 0,utmMedium:n.get("utm_medium")||void 0,utmCampaign:n.get("utm_campaign")||void 0,gclid:n.get("gclid")||void 0}}var Ie=class{constructor(){this.listeners=new Map}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>this.off(e,t)}off(e,t){this.listeners.has(e)&&this.listeners.get(e).delete(t)}async emit(e,t){if(this.listeners.has(e)){let i=Array.from(this.listeners.get(e));await Promise.all(i.map(o=>{try{return Promise.resolve(o(t))}catch(r){return console.error('[EventBus] Error in listener for event "'.concat(e,'":'),r),Promise.resolve()}}))}}clear(){this.listeners.clear()}};be();function ie(n){try{let e=n.split(".");if(e.length!==3)return console.error("Invalid JWT token format"),null;let t=e[1],i=t+"=".repeat((4-t.length%4)%4),o=atob(i),r=JSON.parse(o);return r.exp&&Date.now()>=r.exp*1e3?(console.warn("JWT token is expired"),null):{sessionId:r.sessionId,storeId:r.storeId,accountId:r.accountId,customerId:r.customerId,role:r.role,isValid:!0,isLoading:!1}}catch(e){return console.error("Failed to decode JWT token:",e),null}}function ct(n){try{let e=n.split(".");if(e.length!==3)return!0;let t=e[1],i=t+"=".repeat((4-t.length%4)%4),o=atob(i),r=JSON.parse(o);return r.exp?Date.now()>=r.exp*1e3:!1}catch(e){return console.error("Failed to check token expiration:",e),!0}}se();var H={},tn=["","VITE_","REACT_APP_","NEXT_PUBLIC_"];function F(n,e=tn){var t,i,o;for(let r of e){let s=r?"".concat(r).concat(n):n;if(typeof process!="undefined"&&((t=process==null?void 0:process.env)!=null&&t[s]))return console.log("process.env[".concat(s,"]"),process.env[s]),process.env[s];if(typeof H!="undefined"&&((i=H==null?void 0:H.env)!=null&&i[s]))return console.log("import.meta.env[".concat(s,"]"),H.env[s]),H.env[s];if(typeof window!="undefined"&&((o=window==null?void 0:window.__TAGADA_ENV__)!=null&&o[s]))return console.log("window.__TAGADA_ENV__[".concat(s,"]"),window.__TAGADA_ENV__[s]),window.__TAGADA_ENV__[s]}}var nn=async(n="default")=>{try{if((F("TAGADA_ENV")||F("TAGADA_ENVIRONMENT"))==="production"||!Y(!0))return null;let t=await fetch("/.local.json");if(!t.ok)return null;let i=await t.json(),o={},r=!1;try{let a=await fetch("/config/".concat(n,".tgd.json"));a.ok||(a=await fetch("/config/".concat(n,".json"))),a.ok&&(o=await a.json(),r=!0)}catch(a){}if(!r&&n!=="default"){console.warn("\u26A0\uFE0F Config variant '".concat(n,"' not found, falling back to 'default'"));try{let a=await fetch("/config/default.tgd.json");a.ok||(a=await fetch("/config/default.json")),a.ok&&(o=await a.json(),r=!0,console.log("\u2705 Fallback to 'default' config successful"))}catch(a){}}r||console.warn(n==="default"?"\u26A0\uFE0F No 'default' config found. Create /config/default.tgd.json":"\u26A0\uFE0F Neither '".concat(n,"' nor 'default' config found. Create /config/default.tgd.json"));let s={storeId:i.storeId,accountId:i.accountId,basePath:i.basePath,config:o};return console.log("\u{1F6E0}\uFE0F Using local development plugin config:",s),s}catch(e){return null}},on=async()=>{try{if((F("TAGADA_ENV")||F("TAGADA_ENVIRONMENT"))==="production"||!Y(!0))return null;try{console.log("\u{1F6E0}\uFE0F [V2] Attempting to load /config/funnel.local.json...");let i=await fetch("/config/funnel.local.json");if(i.ok){let o=await i.json();console.log("\u{1F6E0}\uFE0F [V2] \u2705 Loaded local funnel config (NEW format):",o);let{loadLocalFunnelConfig:r}=await Promise.resolve().then(()=>(pe(),rt));if(await r(),o.staticResources){let s={};for(let[a,c]of Object.entries(o.staticResources))s[a]={id:c};return s}return null}}catch(i){console.log("\u{1F6E0}\uFE0F [V2] funnel.local.json not found, trying legacy format...")}console.log("\u{1F6E0}\uFE0F [V2] Attempting to load /config/resources.static.json (legacy)...");let e=await fetch("/config/resources.static.json");if(!e.ok)return console.log("\u{1F6E0}\uFE0F [V2] No local static resources found"),null;let t=await e.json();return console.log("\u{1F6E0}\uFE0F [V2] \u2705 Loaded legacy static resources:",t),t}catch(n){return console.error("\u{1F6E0}\uFE0F [V2] \u274C Error loading static resources:",n),null}},we=n=>{if(typeof document=="undefined")return;let e=document.querySelector('meta[name="'.concat(n,'"]'));return(e==null?void 0:e.getAttribute("content"))||void 0},rn=()=>{if(typeof window!="undefined"&&window.__TAGADA_PLUGIN_CONFIG__)return window.__TAGADA_PLUGIN_CONFIG__;try{let n=we("x-plugin-config");if(n)return JSON.parse(decodeURIComponent(n))}catch(n){}return{}};var sn=async()=>{try{if(typeof document=="undefined")return null;let n=we("x-plugin-store-id"),e=we("x-plugin-account-id");if(!n)return null;let t=we("x-plugin-base-path")||"/",i=rn();e||console.warn("\u26A0\uFE0F Plugin config: Account ID not found in meta tags");let o={storeId:n,accountId:e,basePath:t,config:i};return console.log("\u{1F680} [HIGHEST PRIORITY] Plugin config loaded from meta tags (runtime injected config):",{storeId:n,accountId:e,basePath:t,configKeys:Object.keys(i),configSize:JSON.stringify(i).length}),o}catch(n){return console.warn("\u26A0\uFE0F Error loading production config from meta tags:",n),null}},dt=async(n="default",e)=>{var s,a;console.log("\u{1F527} [V2] loadPluginConfig called with variant:",n);let t=await on(),i=await sn();if(i){let c=b(h({},i),{staticResources:t!=null?t:void 0});return console.log("\u2705 [V2] Using INJECTED config from meta tags (HIGHEST PRIORITY)"),c}if(e){let c={storeId:e.storeId,accountId:e.accountId,basePath:(s=e.basePath)!=null?s:"/",config:(a=e.config)!=null?a:{},staticResources:t!=null?t:void 0};return console.log("\u2705 [V2] Using raw config parameter (PRIORITY 2)"),c}let o=await ln();if(o){let c=b(h({},o),{staticResources:t!=null?t:void 0});return console.log("\u2705 [V2] Using environment variables config (PRIORITY 3 - build time)"),c}let r=await nn(n);if(r){let c=b(h({},r),{staticResources:t!=null?t:void 0});return console.log("\u2705 [V2] Using local dev config files (PRIORITY 4)"),c}return console.warn("\u26A0\uFE0F [V2] No plugin config found - using defaults"),{basePath:"/",config:{},staticResources:t!=null?t:void 0}};async function an(n="default",e){try{if(!Y())return null;if(e)return e;let t=["/config/".concat(n,".config.json"),"/config/".concat(n,".tgd.json"),"/config/".concat(n,".json")];for(let i of t)try{let o=await fetch(i);if(o.ok)return await o.json()}catch(o){continue}return console.warn("\u26A0\uFE0F [loadLocalConfig] No config found for '".concat(n,"'")),null}catch(t){return console.error("[loadLocalConfig] Error loading config:",t),null}}async function ln(){try{if(!Y())return;let n=F("TAGADA_STORE_ID"),e=F("TAGADA_ACCOUNT_ID"),t=F("TAGADA_BASE_PATH"),i=F("TAGADA_CONFIG_NAME");if(!n||!e)return;let o=await an(i);if(!o)return;let r={storeId:n,accountId:e,basePath:t||"/",config:o};return console.log("\u{1F6E0}\uFE0F [createRawPluginConfig] Using environment variables (build-time config):",{hasStoreId:!!r.storeId,hasAccountId:!!r.accountId,basePath:r.basePath,hasConfig:!!r.config}),r}catch(n){console.error("[createRawPluginConfig] Error creating config:",n);return}}ue();j();j();var Ae=new Map,Pe=new Set;function cn(){return typeof window=="undefined"?null:new URLSearchParams(window.location.search).get("authCode")}async function ut(n,e,t,i=!1){if(Pe.has(n))throw i&&console.log("[AuthHandoff] Code already resolved, skipping duplicate request"),new Error("Auth code already resolved");let o=Ae.get(n);if(o)return i&&console.log("[AuthHandoff] Resolution already in progress, waiting for existing request"),o;i&&console.log("[AuthHandoff] Resolving authCode:",n.substring(0,15)+"...");let r=(async()=>{try{let s=await fetch("".concat(t,"/api/v1/cms/auth/resolve-handoff"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:n,storeId:e})});if(!s.ok){let c=await s.json().catch(()=>({message:"Unknown error"}));throw new Error(c.message||"Failed to resolve auth handoff: ".concat(s.status))}let a=await s.json();return i&&console.log("[AuthHandoff] \u2705 Resolved successfully:",{customerId:a.customer.id,role:a.customer.role,hasContext:Object.keys(a.context).length>0}),i&&console.log("[AuthHandoff] Storing new token (overriding existing)"),x(a.token),dn(i),Pe.add(n),a}catch(s){throw console.error("[AuthHandoff] \u274C Failed to resolve:",s),s}finally{Ae.delete(n)}})();return Ae.set(n,r),r}function dn(n=!1){if(typeof window=="undefined")return;let e=new URL(window.location.href);e.searchParams.has("authCode")&&(e.searchParams.delete("authCode"),window.history.replaceState({},"",e.pathname+e.search+e.hash),n&&console.log("[AuthHandoff] Cleaned authCode from URL"))}function ft(){let n=cn();return!(!n||!n.startsWith("ah_")||Pe.has(n))}var ve=class{constructor(e={}){this.bus=new Ie;this.eventDispatcher=new $;this.tokenPromise=null;this.tokenResolver=null;this.isInitializingSession=!1;this.lastSessionInitError=null;this.sessionInitRetryCount=0;this.MAX_SESSION_INIT_RETRIES=3;var a,c,p,m;this.config=e,this.instanceId=Math.random().toString(36).substr(2,9),this.boundHandleStorageChange=this.handleStorageChange.bind(this),this.boundHandlePageshow=l=>{if(l.persisted)if(this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Page restored from BFcache (back button), re-initializing funnel...")),this.funnel&&this.state.session&&this.state.store){this.funnel.resetInitialization();let f=this.getAccountId(),d=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("funnelId")||void 0;this.funnel.autoInitialize({customerId:this.state.session.customerId,sessionId:this.state.session.sessionId},{id:this.state.store.id,accountId:f},d).catch(w=>{console.error("[TagadaClient] Funnel re-initialization failed:",w)})}else this.sessionInitRetryCount=0,this.initialize()},console.log("[TagadaClient ".concat(this.instanceId,"] Initializing...")),console.log("[TagadaClient ".concat(this.instanceId,"] Config:"),{debugMode:e.debugMode,hasRawPluginConfig:!!e.rawPluginConfig,rawPluginConfig:e.rawPluginConfig,features:e.features}),Ke(this.config.debugMode)&&this.config.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Preview mode active - state cleared"));let i=this.resolveEnvironment(),o=Oe(i);e.customApiConfig&&(o=b(h(h({},o),e.customApiConfig),{apiConfig:h(h({},o.apiConfig),e.customApiConfig.apiConfig)}),this.config.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Applied custom API config:"),o.apiConfig.baseUrl)),this.state={auth:{isAuthenticated:!1,isLoading:!1,customer:null,session:null},session:null,customer:null,locale:{locale:"en-US",language:"en",region:"US",messages:{}},currency:{code:"USD",symbol:"$",name:"US Dollar"},store:null,environment:o,isLoading:!0,isInitialized:!1,isSessionInitialized:!1,pluginConfig:{basePath:"/",config:{}},pluginConfigLoading:!0,debugMode:(a=e.debugMode)!=null?a:i!=="production",token:null},console.log("[TagadaClient ".concat(this.instanceId,"] Initial state:"),{pluginConfigLoading:this.state.pluginConfigLoading,hasRawPluginConfig:!!e.rawPluginConfig}),this.apiClient=new Ce({baseURL:o.apiConfig.baseUrl});let r=(c=e.features)==null?void 0:c.funnel;if(r!==!1){let l=typeof r=="object"?r:{};this.funnel=new ne({apiClient:this.apiClient,debugMode:this.state.debugMode,pluginConfig:this.state.pluginConfig,environment:this.state.environment,autoRedirect:l.autoRedirect,funnelId:(p=e.rawPluginConfig)==null?void 0:p.funnelId,stepId:(m=e.rawPluginConfig)==null?void 0:m.stepId})}this.apiClient.setTokenProvider(this.waitForToken.bind(this)),typeof window!="undefined"&&(window.addEventListener("storage",this.boundHandleStorageChange),window.addEventListener("pageshow",this.boundHandlePageshow)),this.setupConfigHotReload(),this.initialize()}destroy(){typeof window!="undefined"&&(window.removeEventListener("storage",this.boundHandleStorageChange),window.removeEventListener("pageshow",this.boundHandlePageshow)),this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Destroyed")),this.eventDispatcher.clear(),this.bus.clear()}handleStorageChange(){if(X()===this.state.token){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Token unchanged (ignoring event)"));return}if(this.isInitializingSession){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Session initialization in progress, skipping storage change"));return}if(this.sessionInitRetryCount>=this.MAX_SESSION_INIT_RETRIES&&this.lastSessionInitError){this.state.debugMode&&console.error("[TagadaClient ".concat(this.instanceId,"] Max session init retries reached, giving up"),this.lastSessionInitError);return}this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Storage changed, re-initializing token...")),this.initializeToken()}subscribe(e){return this.eventDispatcher.subscribe(e)}getState(){return this.state}updateState(e){this.state=h(h({},this.state),e),this.eventDispatcher.notify(this.state)}resolveEnvironment(){return this.config.environment?this.config.environment:J()}async initialize(){try{await this.initializePluginConfig(),this.state.pluginConfig.storeId?await this.initializeToken():(console.warn("[TagadaClient] No store ID found in plugin config. Skipping token initialization."),this.updateState({isLoading:!1,isInitialized:!0}))}catch(e){console.error("[TagadaClient] Initialization failed:",e),this.updateState({isLoading:!1,isInitialized:!0})}}async initializePluginConfig(){if(console.log("[TagadaClient ".concat(this.instanceId,"] initializePluginConfig called"),{pluginConfigLoading:this.state.pluginConfigLoading,hasRawPluginConfig:!!this.config.rawPluginConfig}),!this.state.pluginConfigLoading){console.log("[TagadaClient ".concat(this.instanceId,"] Plugin config already loading or loaded, skipping..."));return}try{let e=this.config.localConfig||"default";console.log("[TagadaClient ".concat(this.instanceId,"] Loading plugin config with variant: ").concat(e));let t=await dt(e,this.config.rawPluginConfig);console.log("[TagadaClient ".concat(this.instanceId,"] Plugin config loaded:"),t),this.updateState({pluginConfig:t,pluginConfigLoading:!1}),this.funnel&&this.funnel.setConfig({pluginConfig:t,environment:this.state.environment})}catch(e){console.error("[TagadaClient] Failed to load plugin config:",e),this.updateState({pluginConfig:{basePath:"/",config:{}},pluginConfigLoading:!1})}}async initializeToken(){var e;if(ft()){let t=this.state.pluginConfig.storeId;if(!t)return console.error("[TagadaClient] Cannot resolve authCode: storeId not found in config"),this.fallbackToNormalFlow();console.log("[TagadaClient ".concat(this.instanceId,"] \u{1F510} Cross-domain auth detected, resolving..."));try{let i=new URLSearchParams(window.location.search).get("authCode");if(!i)return this.fallbackToNormalFlow();let o=await ut(i,t,this.state.environment.apiConfig.baseUrl,this.state.debugMode);console.log("[TagadaClient ".concat(this.instanceId,"] \u2705 Auth handoff resolved:"),{customerId:o.customer.id,role:o.customer.role,hasContext:Object.keys(o.context).length>0}),this.setToken(o.token);let r=ie(o.token);r?(this.updateState({session:r}),await this.initializeSession(r),(e=o.context)!=null&&e.funnelSessionId&&this.funnel&&this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Restoring funnel session from handoff context:"),o.context.funnelSessionId)):(console.error("[TagadaClient] Failed to decode token from handoff"),this.updateState({isInitialized:!0,isLoading:!1}));return}catch(i){console.error("[TagadaClient ".concat(this.instanceId,"] \u274C Auth handoff failed, falling back to normal flow:"),i)}}await this.fallbackToNormalFlow()}async fallbackToNormalFlow(){let t=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("token");t&&(this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] \u{1F512} URL token detected, setting immediately to prevent race condition")),this.apiClient.updateToken(t),x(t));let i=X();console.log("[TagadaClient ".concat(this.instanceId,"] Initializing token (normal flow)..."),{hasExistingToken:!!i,hasQueryToken:!!t,storeId:this.state.pluginConfig.storeId});let o=null,r=!1;if(t?(o=t,r=!0):i&&!ct(i)&&(o=i),o){this.setToken(o),r&&(this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Persisting query token to storage...")),x(o));let s=ie(o);s?(this.updateState({session:s}),await this.initializeSession(s)):(console.error("[TagadaClient] Failed to decode token"),this.updateState({isInitialized:!0,isLoading:!1}))}else{let s=this.state.pluginConfig.storeId;console.log("[TagadaClient ".concat(this.instanceId,"] No existing token, creating anonymous token..."),{hasStoreId:!!s,storeId:s}),s?await this.createAnonymousToken(s):(console.warn("[TagadaClient ".concat(this.instanceId,"] No storeId in plugin config, skipping anonymous token creation")),this.updateState({isInitialized:!0,isLoading:!1}))}}setToken(e){this.apiClient.updateToken(e),this.updateState({token:e}),this.tokenResolver&&(this.tokenResolver(e),this.tokenPromise=null,this.tokenResolver=null)}waitForToken(){return this.apiClient.getCurrentToken()?Promise.resolve(this.apiClient.getCurrentToken()):(this.tokenPromise||(this.tokenPromise=new Promise(e=>{this.tokenResolver=e})),this.tokenPromise)}async createAnonymousToken(e){if(typeof window!="undefined"){let i=new URLSearchParams(window.location.search).get("token");if(i){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] \u{1F512} URL has token, skipping anonymous token creation")),this.setToken(i),x(i);let o=ie(i);o&&(this.updateState({session:o}),await this.initializeSession(o));return}}if(this.isInitializingSession){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Session initialization in progress, skipping anonymous token creation"));return}try{let t=ee();this.state.debugMode&&console.log("[TagadaClient] Creating anonymous token for store:",e,{draft:t});let i=await this.apiClient.post("/api/v1/cms/session/anonymous",{storeId:e,role:"anonymous",draft:t},{skipAuth:!0});this.setToken(i.token),x(i.token);let o=ie(i.token);o&&(this.updateState({session:o}),await this.initializeSession(o)),this.updateState({isSessionInitialized:!0})}catch(t){console.error("[TagadaClient] Failed to create anonymous token:",t),this.updateState({isInitialized:!0,isLoading:!1})}}async initializeSession(e){var t,i,o,r,s,a,c,p,m,l,f;if(this.isInitializingSession){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Session initialization already in progress, skipping"));return}this.isInitializingSession=!0;try{this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Initializing session..."),{sessionId:e.sessionId});let u=await at(),d=lt(),w=st(),g=ee(),I=new URLSearchParams(window.location.search).get("draft");I!==null&&Ee(I==="true");let R={storeId:e.storeId,accountId:e.accountId,customerId:e.customerId,role:e.role,browserLocale:w,queryLocale:d.locale,queryCurrency:d.currency,utmSource:d.utmSource,utmMedium:d.utmMedium,utmCampaign:d.utmCampaign,gclid:d.gclid,browser:u.userAgent.browser.name,browserVersion:u.userAgent.browser.version,os:u.userAgent.os.name,osVersion:u.userAgent.os.version,deviceType:(t=u.userAgent.device)==null?void 0:t.type,deviceModel:(i=u.userAgent.device)==null?void 0:i.model,deviceVendor:(o=u.userAgent.device)==null?void 0:o.vendor,userAgent:u.userAgent.name,engineName:u.userAgent.engine.name,engineVersion:u.userAgent.engine.version,cpuArchitecture:u.userAgent.cpu.architecture,isBot:(s=(r=u.flags)==null?void 0:r.isBot)!=null?s:!1,isChromeFamily:(c=(a=u.flags)==null?void 0:a.isChromeFamily)!=null?c:!1,isStandalonePWA:(m=(p=u.flags)==null?void 0:p.isStandalonePWA)!=null?m:!1,isAppleSilicon:(f=(l=u.flags)==null?void 0:l.isAppleSilicon)!=null?f:!1,screenWidth:u.screenResolution.width,screenHeight:u.screenResolution.height,timeZone:u.timeZone,draft:g,fetchMessages:!1},y=await this.apiClient.post("/api/v1/cms/session/v2/init",R);this.lastSessionInitError=null,this.sessionInitRetryCount=0,this.updateSessionState(y,e),this.updateState({isInitialized:!0,isSessionInitialized:!0,isLoading:!1}),this.state.debugMode&&console.log("[TagadaClient] Session initialized successfully")}catch(u){this.lastSessionInitError=u,this.sessionInitRetryCount++,console.error("[TagadaClient] Error initializing session (attempt ".concat(this.sessionInitRetryCount,"/").concat(this.MAX_SESSION_INIT_RETRIES,"):"),u),this.updateState({isInitialized:!0,isLoading:!1})}finally{this.isInitializingSession=!1}}updateSessionState(e,t){var s,a,c,p,m,l,f,u,d,w;if(e.store){let g=e.store,I=b(h({},e.store),{accountId:g.accountId||((s=this.state.pluginConfig)==null?void 0:s.accountId)||t.accountId||"",presentmentCurrencies:g.presentmentCurrencies||[e.store.currency||"USD"],chargeCurrencies:g.chargeCurrencies||[e.store.currency||"USD"]});this.updateState({store:I})}if(e.locale){let g={locale:e.locale,language:e.locale.split("-")[0],region:(a=e.locale.split("-")[1])!=null?a:"US",messages:(c=e.messages)!=null?c:{}};this.updateState({locale:g})}if(e.store){let g={code:e.store.currency,symbol:this.getCurrencySymbol(e.store.currency),name:this.getCurrencyName(e.store.currency)};this.updateState({currency:g})}let i={isAuthenticated:(m=(p=e.customer)==null?void 0:p.isAuthenticated)!=null?m:!1,isLoading:!1,customer:(l=e.customer)!=null?l:null,session:t};this.updateState({customer:(f=e.customer)!=null?f:null,auth:i});let o=(u=this.config.features)==null?void 0:u.funnel,r=typeof o=="object"&&o.skipAutoInit;if(this.funnel&&!r&&t.customerId&&((d=e.store)!=null&&d.id)){let g=e.store.accountId||((w=this.state.pluginConfig)==null?void 0:w.accountId)||t.accountId||"";if(g){let R=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("funnelId")||void 0;this.state.debugMode&&console.log("[TagadaClient] Auto-initializing funnel...",{customerId:t.customerId,storeId:e.store.id,accountId:g,funnelId:R||"auto-detect"}),this.funnel.autoInitialize({customerId:t.customerId,sessionId:t.sessionId},{id:e.store.id,accountId:g},R).catch(y=>{console.error("[TagadaClient] Funnel auto-initialization failed:",y)})}else console.warn("[TagadaClient] Cannot auto-initialize funnel: accountId is missing")}}getCurrencySymbol(e){return{USD:"$",EUR:"\u20AC",GBP:"\xA3",JPY:"\xA5",CAD:"C$",AUD:"A$"}[e]||e}getCurrencyName(e){return{USD:"US Dollar",EUR:"Euro",GBP:"British Pound",JPY:"Japanese Yen",CAD:"Canadian Dollar",AUD:"Australian Dollar"}[e]||e}getAccountId(){var e,t,i;return((e=this.state.store)==null?void 0:e.accountId)||((t=this.state.pluginConfig)==null?void 0:t.accountId)||((i=this.state.session)==null?void 0:i.accountId)||""}updatePluginConfig(e){this.state.debugMode&&console.log("[TagadaClient] Hot-reloading config:",e);let t=h(h({},this.state.pluginConfig.config),e);this.updateState({pluginConfig:b(h({},this.state.pluginConfig),{config:t})}),this.bus.emit("CONFIG_UPDATED",t),this.state.debugMode&&console.log("[TagadaClient] Config updated successfully")}setupConfigHotReload(){if(typeof window=="undefined")return;let e=t=>{var i,o;if(((i=t.data)==null?void 0:i.type)==="TAGADAPAY_CONFIG_UPDATE"){let{config:r}=t.data;this.state.debugMode&&console.log("[TagadaClient] Received config update from parent:",r),this.updatePluginConfig(r)}else if(((o=t.data)==null?void 0:o.type)==="APPLY_STYLES_TO_ELEMENT"){let{elementId:r,styles:s}=t.data;this.state.debugMode&&console.log("[TagadaClient] Received style application request:",{elementId:r,styles:s}),this.applyStylesToElement(r,s)}};window.addEventListener("message",e),this.state.debugMode&&console.log("[TagadaClient] Config hot-reload and style manipulation listeners enabled")}applyStylesToElement(e,t){if(typeof document=="undefined")return;let i="tagada-editor-highlight",o=document.getElementById(i);o&&o.remove();let r=l=>{var y;let u=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]).has(l.tagName.toLowerCase()),d=l;if(u){let T=l.parentElement;if((T==null?void 0:T.getAttribute("data-tagada-highlight-wrapper"))==="true"&&T instanceof HTMLElement)d=T;else{let v=document.createElement("div");v.setAttribute("data-tagada-highlight-wrapper","true");let oe=window.getComputedStyle(l),z=oe.display;if(z==="inline"?v.style.display="inline-block":v.style.display=z,v.style.position="relative",z==="inline"||z.includes("inline")){let D=oe.verticalAlign;D&&D!=="baseline"&&(v.style.verticalAlign=D)}["width","height","minWidth","minHeight","maxWidth","maxHeight","flex","flexGrow","flexShrink","flexBasis","gridColumn","gridRow","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","gridArea","alignSelf","justifySelf","boxSizing","gap","rowGap","columnGap","order","aspectRatio"].forEach(D=>{let W=D.replace(/([A-Z])/g,"-$1").toLowerCase(),A=oe.getPropertyValue(W);A&&A.trim()!==""&&(D==="flex"&&A!=="none"&&A!=="0 1 auto"?v.style.flex=A:D==="boxSizing"?v.style.boxSizing=A:v.style.setProperty(W,A))}),l.style&&["width","height","min-width","min-height","max-width","max-height","flex","flex-grow","flex-shrink","flex-basis","grid-column","grid-row","grid-column-start","grid-column-end","grid-row-start","grid-row-end","grid-area","align-self","justify-self","box-sizing","gap","row-gap","column-gap","order","aspect-ratio"].forEach(W=>{let A=l.style.getPropertyValue(W);A&&v.style.setProperty(W,A)}),(y=l.parentNode)==null||y.insertBefore(v,l),v.appendChild(l),d=v}}let w=getComputedStyle(u?l:d);(d.style.position==="static"||!d.style.position)&&(d.style.position="relative");let g=document.createElement("div");g.id=i,g.style.position="absolute",g.style.inset="0",g.style.pointerEvents="none",g.style.zIndex="9999",g.style.boxSizing="border-box",g.style.background="none",g.style.border="none",g.style.outline="none",g.style.margin="0",g.style.padding="0";let I=w.borderRadius;I&&(g.style.borderRadius=I),d.appendChild(g);let R=t||{boxShadow:"0 0 0 2px rgb(239 68 68)"};if(Object.entries(R).forEach(([T,q])=>{let v=T.includes("-")?T.replace(/-([a-z])/g,(oe,z)=>z.toUpperCase()):T;T.includes("-")?g.style.setProperty(T,q):g.style[v]=q}),l.scrollIntoView({behavior:"smooth",block:"center"}),this.state.debugMode){let T=Object.entries(R).map(([q,v])=>"".concat(q,": ").concat(v)).join("; ");console.log("[TagadaClient] Applied styles to highlight div of element #".concat(e,":"),T)}},s=5,a=1e3,c=0,p=l=>{let f=window.getComputedStyle(l);return f.display==="none"||f.visibility==="hidden"||f.opacity==="0"||l.hidden||l.offsetWidth===0||l.offsetHeight===0},m=()=>{let l=document.querySelectorAll('[editor-id~="'.concat(e,'"]'));if(l.length===0){if(c+=1,c>=s){this.state.debugMode&&console.warn('[TagadaClient] Element with editor-id containing "'.concat(e,'" not found after ').concat(s," attempts"));return}this.state.debugMode&&console.warn('[TagadaClient] Element with editor-id containing "'.concat(e,'" not found (attempt ').concat(c,"/").concat(s,"), retrying in ").concat(a/1e3,"s")),setTimeout(m,a);return}let f=null;if(l.length===1)f=l[0];else{for(let u=0;u<l.length;u++)if(!p(l[u])){f=l[u];break}f||(f=l[0])}f&&r(f)};m()}};pe();function un(){if(typeof window=="undefined"||typeof document=="undefined")return[];let n=P();return n!=null&&n.scripts?n.scripts.filter(e=>e.enabled):[]}function fn(n,e){let t=n.position||"body-end",i="tagada-stepconfig-script-".concat(e);if(document.getElementById(i))return;let o=n.content.trim(),r=o.match(/^<script[^>]*>([\s\S]*)<\/script>$/i);if(r&&(o=r[1].trim()),!o)return;let s="(function() {\n try {\n // Script: "+n.name+"\n"+o+'\n } catch (error) {\n console.error("[TagadaPay] StepConfig script error:", error);\n }\n})();',a=document.createElement("script");switch(a.id=i,a.setAttribute("data-tagada-stepconfig-script","true"),a.setAttribute("data-script-name",n.name),a.textContent=s,t){case"head-start":document.head.firstChild?document.head.insertBefore(a,document.head.firstChild):document.head.appendChild(a);break;case"head-end":document.head.appendChild(a);break;case"body-start":document.body.firstChild?document.body.insertBefore(a,document.body.firstChild):document.body.appendChild(a);break;case"body-end":default:document.body.appendChild(a);break}}function gt(){let n=un();n.length!==0&&n.forEach((e,t)=>{fn(e,t)})}if(typeof window!="undefined"&&typeof document!="undefined"){let n=()=>{document.body?gt():document.addEventListener("DOMContentLoaded",gt,{once:!0})};"requestIdleCallback"in window?window.requestIdleCallback(n,{timeout:100}):setTimeout(n,0)}function pt(n={}){return new ve(n)}j();var _e="1.0.0";function mt(n){return typeof window=="undefined"?null:new URLSearchParams(window.location.search).get(n)}function S(n,...e){n&&console.log("[TagadaTracker]",...e)}function ht(...n){console.warn("[TagadaTracker]",...n)}function gn(n){if(!n.storeId||typeof n.storeId!="string")throw new Error("TagadaTracker: storeId is required and must be a non-empty string.");if(!n.accountId||typeof n.accountId!="string")throw new Error("TagadaTracker: accountId is required and must be a non-empty string.");if(!n.stepId||typeof n.stepId!="string")throw new Error("TagadaTracker: stepId is required and must be a non-empty string.");if(n.apiBaseUrl)try{new URL(n.apiBaseUrl)}catch(e){throw new Error('TagadaTracker: apiBaseUrl is not a valid URL: "'.concat(n.apiBaseUrl,'"'))}}async function pn(n,e,t){let i;for(let o=0;o<=e;o++)try{return await n()}catch(r){if(i=r instanceof Error?r:new Error(String(r)),o<e){let s=Math.min(1e3*2**o,8e3);S(t,"Retry ".concat(o+1,"/").concat(e," in ").concat(s,"ms...")),await new Promise(a=>setTimeout(a,s))}}throw i}var Se=class{constructor(){this.config=null;this.client=null;this.initialized=!1;this.initializing=!1;this.unsubscribe=null;this.version=_e}async init(e){var i,o;if(this.initialized)return S(e.debug||!1,"Already initialized \u2014 returning existing session."),this.getSession();if(this.initializing)return S(e.debug||!1,"Initialization in progress \u2014 skipping duplicate call."),null;this.initializing=!0,this.config=h({debug:!1},e);let t=this.config.debug;try{gn(this.config)}catch(r){this.initializing=!1;let s=r instanceof Error?r:new Error(String(r));if(this.config.onError)return this.config.onError(s),null;throw s}S(t,"\u{1F680} Initializing external tracker v".concat(_e),{storeId:e.storeId,accountId:e.accountId,stepId:e.stepId,funnelId:e.funnelId});try{let r=mt("token");r&&(x(r),S(t,"\u{1F511} Bootstrapped token from URL")),this.client=pt({debugMode:t,features:{funnel:{skipAutoInit:!0}},rawPluginConfig:{storeId:this.config.storeId,accountId:this.config.accountId},customApiConfig:this.config.apiBaseUrl?{apiConfig:{baseUrl:this.config.apiBaseUrl.trim()}}:void 0}),await this.waitForClientReady();let s=await pn(()=>this.initializeFunnel(),2,t);S(t,"\u2705 Session initialized:",s),this.initialized=!0;let a=this.getSession();return a&&((o=(i=this.config).onReady)==null||o.call(i,a)),a}catch(r){let s=r instanceof Error?r:new Error(String(r));if(S(t,"\u274C Initialization failed:",s),this.config.onError)return this.config.onError(s),null;throw s}finally{this.initializing=!1}}getSession(){var t,i;if(!((i=(t=this.client)==null?void 0:t.funnel)!=null&&i.state.context))return null;let e=this.client.funnel.state.context;return{sessionId:e.sessionId,customerId:e.customerId,storeId:e.storeId,funnelId:e.funnelId,currentStepId:e.currentStepId,cmsToken:this.client.state.token||void 0}}isReady(){var e,t;return this.initialized&&!!((t=(e=this.client)==null?void 0:e.funnel)!=null&&t.state.context)}async navigate(e){if(!this.isReady())throw new Error("TagadaTracker: not initialized. Call init() first.");S(this.config.debug,"\u{1F680} Navigating:",e);let t=e.autoRedirect!==!1;try{let i=await this.client.funnel.navigate({type:e.eventType,data:e.eventData||{}},{autoRedirect:!1});return i!=null&&i.url?(S(this.config.debug,"\u2705 Navigation result:",i.url),t&&typeof window!="undefined"&&(window.location.href=e.returnUrl||i.url),{url:i.url}):null}catch(i){throw S(this.config.debug,"\u274C Navigation failed:",i),i}}async trackEvent(e){if(!this.isReady()){ht("trackEvent called before init \u2014 event dropped:",e.name);return}S(this.config.debug,"\u{1F4CA} Tracking event:",e.name,e.data);try{await this.client.funnel.navigate({type:e.name,data:e.data||{}},{autoRedirect:!1})}catch(t){S(this.config.debug,"\u26A0\uFE0F Event tracking failed (non-critical):",e.name)}}getCustomerId(){var e,t,i,o,r;return((t=(e=this.client)==null?void 0:e.state.auth.customer)==null?void 0:t.id)||((r=(o=(i=this.client)==null?void 0:i.funnel)==null?void 0:o.state.context)==null?void 0:r.customerId)||null}getFunnelSessionId(){var e,t,i;return((i=(t=(e=this.client)==null?void 0:e.funnel)==null?void 0:t.state.context)==null?void 0:i.sessionId)||null}buildUrl(e,t){let i=this.getSession();if(!i)return e;let o=new URL(e,typeof window!="undefined"?window.location.origin:void 0);return o.searchParams.set("funnelSessionId",i.sessionId),i.cmsToken&&o.searchParams.set("token",i.cmsToken),i.funnelId&&o.searchParams.set("funnelId",i.funnelId),o.searchParams.set("storeId",i.storeId),t&&Object.entries(t).forEach(([r,s])=>{o.searchParams.set(r,s)}),o.toString()}getClient(){return this.client}async reset(e){var o,r;if(!this.client||!this.config)throw new Error("TagadaTracker: not initialized. Call init() first.");S(this.config.debug,"\u{1F504} Resetting to step:",e),this.config.stepId=e;let t=await this.initializeFunnel(),i=this.getSession();return i&&((r=(o=this.config).onReady)==null||r.call(o,i)),i}destroy(){var e,t;this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null),this.client&&((t=(e=this.client).destroy)==null||t.call(e)),this.client=null,this.config=null,this.initialized=!1,this.initializing=!1,S(!1,"\u{1F5D1}\uFE0F Tracker destroyed")}async waitForClientReady(){if(this.client)return new Promise(e=>{var o;if((o=this.client)!=null&&o.state.isInitialized){e();return}let t=!1,i=setTimeout(()=>{var r;t||(t=!0,S(((r=this.config)==null?void 0:r.debug)||!1,"\u23F1\uFE0F Client ready timeout \u2014 proceeding"),e())},1e4);this.unsubscribe=this.client.subscribe(()=>{var r;!t&&((r=this.client)!=null&&r.state.isInitialized)&&(t=!0,clearTimeout(i),e())})})}async initializeFunnel(){var s,a,c;if(!((s=this.client)!=null&&s.funnel))return null;let e=(a=this.client.state.auth.customer)==null?void 0:a.id,t=(c=this.client.state.auth.session)==null?void 0:c.sessionId;!e&&!t&&ht("No auth session available \u2014 funnel init may fail.");let i={customerId:e||"anon_placeholder",sessionId:t||"sess_placeholder"},o={id:this.config.storeId,accountId:this.config.accountId},r=this.config.stepId;return S(this.config.debug,"\u{1F50D} Initializing funnel at step:",r),this.client.funnel.initialize(i,o,this.config.funnelId||mt("funnelId")||void 0,r)}},yt=new Se;typeof window!="undefined"&&(window.TagadaTracker=yt);return bt(mn);})();
30
7
  // Expose TagadaTracker globally (if not already done in bundle)
31
8
  if (typeof window !== 'undefined' && TagadaTrackerBundle && TagadaTrackerBundle.TagadaTracker) {
32
9
  window.TagadaTracker = TagadaTrackerBundle.TagadaTracker;