@returningai/widget-sdk 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ---
9
9
 
10
+ ## [Unreleased]
11
+
12
+ ### Documentation
13
+
14
+ - Clarified bundle mode docs for updated split custom widget bundles. `bundle-url`
15
+ should point to each widget's `widget.js` loader, including
16
+ `/custom-widget/bundle/milestones/widget.js` and
17
+ `/custom-widget/bundle/earning-overview/widget.js`.
18
+
19
+ ---
20
+
10
21
  ## [1.6.0] — 2026-06-17
11
22
 
12
23
  ### Added
package/README.md CHANGED
@@ -332,7 +332,7 @@ All attributes can be provided with or without the `data-` prefix — both work.
332
332
  | `data-widget-type` | **Yes** | `store` | Widget type (see table above) |
333
333
  | `api-url` | No | ReturningAI widget auth server | Optional widget auth server override |
334
334
  | `widget-url` | **Yes**\* | — | Widget URL (from dashboard). \*Not required when using `data-bundle-url` |
335
- | `data-bundle-url` | No | — | URL to the widget IIFE bundle — triggers [bundle mode](#bundle-mode) (non-iframe) |
335
+ | `data-bundle-url` | No | — | URL to the widget bundle loader (`widget.js`) — triggers [bundle mode](#bundle-mode) (non-iframe) |
336
336
  | `data-theme` | No | `light` | `light` or `dark` |
337
337
  | `data-email` | Public Embed only | — | User's email for identification. **Access Key Embed:** omit — identity is signed into `data-embed-token` |
338
338
  | `data-embed-token` | Access Key Embed only | — | Short-lived JWT from your server. Carries signed user identifiers — no `data-*` identifier attributes needed |
@@ -352,7 +352,7 @@ All attributes can be provided with or without the `data-` prefix — both work.
352
352
  | `channel-id` | **Channel only** | — | Channel ID (raw ObjectId) — required for `<rai-channel-widget>` |
353
353
  | `api-url` | No | ReturningAI widget auth server | Optional widget auth server override |
354
354
  | `widget-url` | **Yes**\* | — | Widget URL (from dashboard). \*Not required when using `bundle-url` |
355
- | `bundle-url` | No | — | URL to the widget IIFE bundle — triggers [bundle mode](#bundle-mode) (non-iframe) |
355
+ | `bundle-url` | No | — | URL to the widget bundle loader (`widget.js`) — triggers [bundle mode](#bundle-mode) (non-iframe) |
356
356
  | `theme` | No | `light` | `light` or `dark` |
357
357
  | `data-email` | Public Embed only | — | User's email for identification. **Access Key Embed:** omit — identity is signed into `embed-token` |
358
358
  | `embed-token` | Access Key Embed only | — | Short-lived JWT from your server. Carries signed user identifiers — no `data-*` identifier attributes needed |
@@ -422,8 +422,10 @@ These endpoint overrides do not replace `widget-url` or `bundle-url`; use the wi
422
422
  When you set the `bundle-url` attribute, the widget renders directly in the page DOM instead of inside an iframe. This gives full CSS cascade — `html[data-theme]` and Tailwind classes apply to the widget content naturally.
423
423
 
424
424
  - `widget-url` is **not** needed in bundle mode (the widget is loaded directly from `bundle-url`).
425
+ - `bundle-url` must point to the widget bundle loader file named `widget.js`.
425
426
  - ReturningAI endpoints are used by default.
426
427
  - `api-url` and `v2-api-url` are optional endpoint URL overrides.
428
+ - The npm package only provides the SDK runtime (`@returningai/widget-sdk`). Widget bundle URLs are generated by the ReturningAI dashboard / widget backend and are passed to the SDK through `bundle-url`.
427
429
 
428
430
  Both examples below use Access Key Embed and the default endpoints.
429
431
 
@@ -455,18 +457,21 @@ Both examples below use Access Key Embed and the default endpoints.
455
457
  ></rai-store-widget>
456
458
  ```
457
459
 
458
- Each widget type has its own IIFE bundle and global name:
460
+ Each widget type has its own bundle loader and global name:
459
461
 
460
- | Widget type | Bundle global | Custom element tag |
461
- | --------------------- | -------------------- | ------------------------ |
462
- | `store` | `RaiStoreWidget` | `<rai-store-widget>` |
463
- | `channel` | `RaiChannelWidget` | `<rai-channel-widget>` |
464
- | `milestone` | `RaiMilestoneWidget` | `<rai-milestone-widget>` |
465
- | `currency-view` | `RaiCurrencyWidget` | `<rai-currency-widget>` |
466
- | `referral-conditions` | `RaiReferralWidget` | `<rai-referral-widget>` |
467
- | `custom` | `RaiCustomWidget` | `<rai-custom-widget>` |
462
+ | Widget type | Bundle URL shape | Bundle global | Custom element tag |
463
+ | ------------------------- | -------------------------------------------------- | -------------------- | ------------------------ |
464
+ | `store` | `/store-widget/bundle/widget.js` | `RaiStoreWidget` | `<rai-store-widget>` |
465
+ | `channel` | `/channel-widget/bundle/widget.js` | `RaiChannelWidget` | `<rai-channel-widget>` |
466
+ | `social` | `/social-widget/bundle/widget.js` | `RaiSocialWidget` | `<rai-social-widget>` |
467
+ | `milestone` | `/milestone-widget/bundle/widget.js` | `RaiMilestoneWidget` | `<rai-milestone-widget>` |
468
+ | `currency-view` | `/currency-overview-widget/bundle/widget.js` | `RaiCurrencyWidget` | `<rai-currency-widget>` |
469
+ | `referral-conditions` | `/referral-conditions-widget/bundle/widget.js` | `RaiReferralWidget` | `<rai-referral-widget>` |
470
+ | `custom` | `/custom-widget/bundle/widget.js` | `RaiCustomWidget` | `<rai-custom-widget>` |
471
+ | `custom` milestones | `/custom-widget/bundle/milestones/widget.js` | `RaiCustomWidget` | `<rai-custom-widget>` |
472
+ | `custom` earning overview | `/custom-widget/bundle/earning-overview/widget.js` | `RaiCustomWidget` | `<rai-custom-widget>` |
468
473
 
469
- The bundle must export a `mount(container, config)` function on its global (e.g. `window.RaiStoreWidget.mount`).
474
+ The bundle must expose a `mount(container, config)` function on its global (for example, `window.RaiStoreWidget.mount`). For split custom bundles, `widget.js` is a small loader that imports sibling files such as `app.js`, `style.css`, and `chunks/*`; always use the `widget.js` URL and host the sibling files from the same directory.
470
475
 
471
476
  ---
472
477
 
@@ -872,14 +877,14 @@ Or script-tag bootstrap (auto-creates the element):
872
877
 
873
878
  ### Attributes
874
879
 
875
- | Attribute | Required | Description |
876
- | ------------------------------------------ | -------- | ------------------------------------------------------------------- |
877
- | `community-id` | yes | Community ObjectId |
878
- | `api-url` | no | Explicit API base (overrides `domain-key`) |
879
- | `domain-key` | no | `LOCAL` \| `SGTR` \| `STG` \| `GEN` (default `LOCAL`) |
880
- | `surface` | no | Defaults to `sdk` |
881
- | `page-path` / `page-hostname` / `page-url` | no | Override page context (default: `window.location`) for page rules |
882
- | `storage-prefix` | no | localStorage key prefix for the anonymous visitor id |
880
+ | Attribute | Required | Description |
881
+ | ------------------------------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
882
+ | `community-id` | yes | Community ObjectId |
883
+ | `api-url` | no | Explicit API base (overrides `domain-key`) |
884
+ | `domain-key` | no | `LOCAL` \| `SGTR` \| `STG` \| `GEN` (default `LOCAL`) |
885
+ | `surface` | no | Defaults to `sdk` |
886
+ | `page-path` / `page-hostname` / `page-url` | no | Override page context (default: `window.location`) for page rules |
887
+ | `storage-prefix` | no | localStorage key prefix for the anonymous visitor id |
883
888
  | `embed-token` | no\* | SDK embed token (minted from your access id/key, like the widgets). **Required for banners whose Access is `domain` or `authenticated`** — see below |
884
889
 
885
890
  ### How it works
@@ -895,11 +900,11 @@ Or script-tag bootstrap (auto-creates the element):
895
900
 
896
901
  **Access types** — each banner has an Access setting (chosen in the dashboard) that decides what the embed must provide:
897
902
 
898
- | Banner Access | What the embed needs |
899
- | -------------------- | ------------------------------------------------------------------------------------------------------------------- |
900
- | **Open to everyone** | nothing — `community-id` only |
903
+ | Banner Access | What the embed needs |
904
+ | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
905
+ | **Open to everyone** | nothing — `community-id` only |
901
906
  | **Domain gate** | the page is served from one of the banner's allowed domains (enforced on the request `Origin`), **or** an `embed-token` whose access key authorizes the origin |
902
- | **SDK auth** | a valid `embed-token` whose access key authorizes the origin (mint it from your access id/key, exactly like widgets) |
907
+ | **SDK auth** | a valid `embed-token` whose access key authorizes the origin (mint it from your access id/key, exactly like widgets) |
903
908
 
904
909
  A live banner whose `surfaces` include `sdk` is required. Widget‑mounted banners pass the widget's `embed-token`
905
910
  automatically, so `domain` / `authenticated` banners work on widgets with no extra setup.
@@ -917,7 +922,9 @@ The element emits bubbling `CustomEvent`s:
917
922
  | `rai-banner-error` | `{ error }` |
918
923
 
919
924
  ```js
920
- document.addEventListener('rai-banner-impression', (e) => console.log('shown', e.detail.bannerId))
925
+ document.addEventListener("rai-banner-impression", (e) =>
926
+ console.log("shown", e.detail.bannerId),
927
+ );
921
928
  ```
922
929
 
923
930
  ### Build
@@ -1,3 +1,3 @@
1
1
  var RaiBanner=function(e){"use strict";var t=Object.defineProperty,n=(e,n,o)=>((e,n,o)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o)(e,"symbol"!=typeof n?n+"":n,o);
2
2
  /*! @license DOMPurify 3.4.9 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.9/LICENSE */
3
- function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(s=(o=i.call(n)).done)&&(l.push(o.value),l.length!==t);s=!0);}catch(u){c=!0,r=u}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const i=Object.entries,a=Object.setPrototypeOf,l=Object.isFrozen,s=Object.getPrototypeOf,c=Object.getOwnPropertyDescriptor;let u=Object.freeze,d=Object.seal,p=Object.create,f="undefined"!=typeof Reflect&&Reflect,m=f.apply,h=f.construct;u||(u=function(e){return e}),d||(d=function(e){return e}),m||(m=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];return e.apply(t,o)}),h||(h=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return new e(...n)});const g=U(Array.prototype.forEach),y=U(Array.prototype.lastIndexOf),b=U(Array.prototype.pop),A=U(Array.prototype.push),T=U(Array.prototype.splice),S=Array.isArray,x=U(String.prototype.toLowerCase),v=U(String.prototype.toString),w=U(String.prototype.match),E=U(String.prototype.replace),_=U(String.prototype.indexOf),N=U(String.prototype.trim),C=U(Number.prototype.toString),O=U(Boolean.prototype.toString),k="undefined"==typeof BigInt?null:U(BigInt.prototype.toString),D="undefined"==typeof Symbol?null:U(Symbol.prototype.toString),R=U(Object.prototype.hasOwnProperty),I=U(Object.prototype.toString),L=U(RegExp.prototype.test),M=(z=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h(z,t)});var z;function U(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return m(e,t,o)}}function P(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:x;if(a&&a(e,null),!S(t))return e;let o=t.length;for(;o--;){let r=t[o];if("string"==typeof r){const e=n(r);e!==r&&(l(t)||(t[o]=e),r=e)}e[r]=!0}return e}function F(e){for(let t=0;t<e.length;t++){R(e,t)||(e[t]=null)}return e}function H(e){const t=p(null);for(const o of i(e)){var n=r(o,2);const i=n[0],a=n[1];R(e,i)&&(S(a)?t[i]=F(a):a&&"object"==typeof a&&a.constructor===Object?t[i]=H(a):t[i]=a)}return t}function j(e,t){for(;null!==e;){const n=c(e,t);if(n){if(n.get)return U(n.get);if("function"==typeof n.value)return U(n.value)}e=s(e)}return function(){return null}}const W=u(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),B=u(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),G=u(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Y=u(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),q=u(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),$=u(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),X=u(["#text"]),V=u(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),K=u(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Z=u(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),J=u(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Q=d(/{{[\w\W]*|^[\w\W]*}}/g),ee=d(/<%[\w\W]*|^[\w\W]*%>/g),te=d(/\${[\w\W]*/g),ne=d(/^data-[\-\w.\u00B7-\uFFFF]+$/),oe=d(/^aria-[\-\w]+$/),re=d(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ie=d(/^(?:\w+script|data):/i),ae=d(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),le=d(/^html$/i),se=d(/^[a-z][.\w]*(-[.\w]+)+$/i),ce=1,ue=3,de=7,pe=8,fe=9,me=11;var he=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window;const n=t=>e(t);if(n.version="3.4.9",n.removed=[],!t||!t.document||t.document.nodeType!==fe||!t.Element)return n.isSupported=!1,n;let o=t.document;const r=o,a=r.currentScript;t.DocumentFragment;const l=t.HTMLTemplateElement,s=t.Node,c=t.Element,d=t.NodeFilter,f=t.NamedNodeMap;void 0===f&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const m=t.DOMParser,h=t.trustedTypes,z=c.prototype,U=j(z,"cloneNode"),F=j(z,"remove"),he=j(z,"nextSibling"),ge=j(z,"childNodes"),ye=j(z,"parentNode"),be=j(z,"shadowRoot"),Ae=j(z,"attributes"),Te=s&&s.prototype?j(s.prototype,"nodeType"):null,Se=s&&s.prototype?j(s.prototype,"nodeName"):null;if("function"==typeof l){const e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let xe,ve,we="",Ee=!1,_e=0;const Ne=function(){if(_e>0)throw M('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Ce=function(e){Ne(),_e++;try{return xe.createHTML(e)}finally{_e--}},Oe=function(e){Ne(),_e++;try{return xe.createScriptURL(e)}finally{_e--}},ke=function(){return Ee||(ve=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(i){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(h,a),Ee=!0),ve},De=o,Re=De.implementation,Ie=De.createNodeIterator,Le=De.createDocumentFragment,Me=De.getElementsByTagName,ze=r.importNode;let Ue={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof i&&"function"==typeof ye&&Re&&void 0!==Re.createHTMLDocument;const Pe=Q,Fe=ee,He=te,je=ne,We=oe,Be=ie,Ge=ae,Ye=se;let qe=re,$e=null;const Xe=P({},[...W,...B,...G,...q,...X]);let Ve=null;const Ke=P({},[...V,...K,...Z,...J]);let Ze=Object.seal(p(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Je=null,Qe=null;const et=Object.seal(p(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let tt=!0,nt=!0,ot=!1,rt=!0,it=!1,at=!0,lt=!1,st=!1,ct=!1,ut=!1,dt=!1,pt=!1,ft=!0,mt=!1;const ht="user-content-";let gt=!0,yt=!1,bt={},At=null;const Tt=P({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let St=null;const xt=P({},["audio","video","img","source","image","track"]);let vt=null;const wt=P({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Et="http://www.w3.org/1998/Math/MathML",_t="http://www.w3.org/2000/svg",Nt="http://www.w3.org/1999/xhtml";let Ct=Nt,Ot=!1,kt=null;const Dt=P({},[Et,_t,Nt],v);let Rt=P({},["mi","mo","mn","ms","mtext"]),It=P({},["annotation-xml"]);const Lt=P({},["title","style","font","a","script"]);let Mt=null;const zt=["application/xhtml+xml","text/html"];let Ut=null,Pt=null;const Ft=o.createElement("form"),Ht=function(e){return e instanceof RegExp||e instanceof Function},jt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Pt&&Pt===e)return;e&&"object"==typeof e||(e={}),e=H(e),Mt=-1===zt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ut="application/xhtml+xml"===Mt?v:x,$e=R(e,"ALLOWED_TAGS")&&S(e.ALLOWED_TAGS)?P({},e.ALLOWED_TAGS,Ut):Xe,Ve=R(e,"ALLOWED_ATTR")&&S(e.ALLOWED_ATTR)?P({},e.ALLOWED_ATTR,Ut):Ke,kt=R(e,"ALLOWED_NAMESPACES")&&S(e.ALLOWED_NAMESPACES)?P({},e.ALLOWED_NAMESPACES,v):Dt,vt=R(e,"ADD_URI_SAFE_ATTR")&&S(e.ADD_URI_SAFE_ATTR)?P(H(wt),e.ADD_URI_SAFE_ATTR,Ut):wt,St=R(e,"ADD_DATA_URI_TAGS")&&S(e.ADD_DATA_URI_TAGS)?P(H(xt),e.ADD_DATA_URI_TAGS,Ut):xt,At=R(e,"FORBID_CONTENTS")&&S(e.FORBID_CONTENTS)?P({},e.FORBID_CONTENTS,Ut):Tt,Je=R(e,"FORBID_TAGS")&&S(e.FORBID_TAGS)?P({},e.FORBID_TAGS,Ut):H({}),Qe=R(e,"FORBID_ATTR")&&S(e.FORBID_ATTR)?P({},e.FORBID_ATTR,Ut):H({}),bt=!!R(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?H(e.USE_PROFILES):e.USE_PROFILES),tt=!1!==e.ALLOW_ARIA_ATTR,nt=!1!==e.ALLOW_DATA_ATTR,ot=e.ALLOW_UNKNOWN_PROTOCOLS||!1,rt=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,it=e.SAFE_FOR_TEMPLATES||!1,at=!1!==e.SAFE_FOR_XML,lt=e.WHOLE_DOCUMENT||!1,ut=e.RETURN_DOM||!1,dt=e.RETURN_DOM_FRAGMENT||!1,pt=e.RETURN_TRUSTED_TYPE||!1,ct=e.FORCE_BODY||!1,ft=!1!==e.SANITIZE_DOM,mt=e.SANITIZE_NAMED_PROPS||!1,gt=!1!==e.KEEP_CONTENT,yt=e.IN_PLACE||!1,qe=function(e){try{return L(e,""),!0}catch(t){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:re,Ct="string"==typeof e.NAMESPACE?e.NAMESPACE:Nt,Rt=R(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?H(e.MATHML_TEXT_INTEGRATION_POINTS):P({},["mi","mo","mn","ms","mtext"]),It=R(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?H(e.HTML_INTEGRATION_POINTS):P({},["annotation-xml"]);const t=R(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?H(e.CUSTOM_ELEMENT_HANDLING):p(null);if(Ze=p(null),R(t,"tagNameCheck")&&Ht(t.tagNameCheck)&&(Ze.tagNameCheck=t.tagNameCheck),R(t,"attributeNameCheck")&&Ht(t.attributeNameCheck)&&(Ze.attributeNameCheck=t.attributeNameCheck),R(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(Ze.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),it&&(nt=!1),dt&&(ut=!0),bt&&($e=P({},X),Ve=p(null),!0===bt.html&&(P($e,W),P(Ve,V)),!0===bt.svg&&(P($e,B),P(Ve,K),P(Ve,J)),!0===bt.svgFilters&&(P($e,G),P(Ve,K),P(Ve,J)),!0===bt.mathMl&&(P($e,q),P(Ve,Z),P(Ve,J))),et.tagCheck=null,et.attributeCheck=null,R(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?et.tagCheck=e.ADD_TAGS:S(e.ADD_TAGS)&&($e===Xe&&($e=H($e)),P($e,e.ADD_TAGS,Ut))),R(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?et.attributeCheck=e.ADD_ATTR:S(e.ADD_ATTR)&&(Ve===Ke&&(Ve=H(Ve)),P(Ve,e.ADD_ATTR,Ut))),R(e,"ADD_URI_SAFE_ATTR")&&S(e.ADD_URI_SAFE_ATTR)&&P(vt,e.ADD_URI_SAFE_ATTR,Ut),R(e,"FORBID_CONTENTS")&&S(e.FORBID_CONTENTS)&&(At===Tt&&(At=H(At)),P(At,e.FORBID_CONTENTS,Ut)),R(e,"ADD_FORBID_CONTENTS")&&S(e.ADD_FORBID_CONTENTS)&&(At===Tt&&(At=H(At)),P(At,e.ADD_FORBID_CONTENTS,Ut)),gt&&($e["#text"]=!0),lt&&P($e,["html","head","body"]),$e.table&&(P($e,["tbody"]),delete Je.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw M('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw M('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=xe;xe=e.TRUSTED_TYPES_POLICY;try{we=Ce("")}catch(n){throw xe=t,n}}else null===e.TRUSTED_TYPES_POLICY?(xe=void 0,we=""):(void 0===xe&&(xe=ke()),xe&&"string"==typeof we&&(we=Ce("")));(Ue.uponSanitizeElement.length>0||Ue.uponSanitizeAttribute.length>0)&&$e===Xe&&($e=H($e)),Ue.uponSanitizeAttribute.length>0&&Ve===Ke&&(Ve=H(Ve)),u&&u(e),Pt=e},Wt=P({},[...B,...G,...Y]),Bt=P({},[...q,...$]),Gt=function(e){A(n.removed,{element:e});try{ye(e).removeChild(e)}catch(t){if(F(e),!ye(e))throw M("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Yt=function(e){const t=ge?ge(e):e.childNodes;if(t){const e=[];g(t,t=>{A(e,t)}),g(e,e=>{try{F(e)}catch(t){}})}const n=Ae?Ae(e):null;if(n)for(let r=n.length-1;r>=0;--r){const t=n[r],i=t&&t.name;if("string"==typeof i)try{e.removeAttribute(i)}catch(o){}}},qt=function(e,t){try{A(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(o){A(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ut||dt)try{Gt(t)}catch(o){}else try{t.setAttribute(e,"")}catch(o){}},$t=function(e){const t=Ae?Ae(e):e.attributes;if(t)for(let o=t.length-1;o>=0;--o){const r=t[o],i=r&&r.name;if("string"==typeof i&&!Ve[Ut(i)])try{e.removeAttribute(i)}catch(n){}}},Xt=function(e){let t=null,n=null;if(ct)e="<remove></remove>"+e;else{const t=w(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Mt&&Ct===Nt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=xe?Ce(e):e;if(Ct===Nt)try{t=(new m).parseFromString(r,Mt)}catch(a){}if(!t||!t.documentElement){t=Re.createDocument(Ct,"template",null);try{t.documentElement.innerHTML=Ot?we:r}catch(a){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(o.createTextNode(n),i.childNodes[0]||null),Ct===Nt?Me.call(t,lt?"html":"body")[0]:lt?t.documentElement:i},Vt=function(e){return Ie.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Kt=function(e){var t,n;e.normalize();const o=Ie.call(e.ownerDocument||e,e,d.SHOW_TEXT|d.SHOW_COMMENT|d.SHOW_CDATA_SECTION|d.SHOW_PROCESSING_INSTRUCTION,null);let r=o.nextNode();for(;r;){let e=r.data;g([Pe,Fe,He],t=>{e=E(e,t," ")}),r.data=e,r=o.nextNode()}const i=null!==(t=null===(n=e.querySelectorAll)||void 0===n?void 0:n.call(e,"template"))&&void 0!==t?t:[];g(Array.from(i),e=>{Jt(e.content)&&Kt(e.content)})},Zt=function(e){const t=Se?Se(e):null;return"string"==typeof t&&("form"===Ut(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==Ae(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==Te(e)||e.childNodes!==ge(e)))},Jt=function(e){if(!Te||"object"!=typeof e||null===e)return!1;try{return Te(e)===me}catch(t){return!1}},Qt=function(e){if(!Te||"object"!=typeof e||null===e)return!1;try{return"number"==typeof Te(e)}catch(t){return!1}};function en(e,t,o){g(e,e=>{e.call(n,t,o,Pt)})}const tn=function(e){let t=null;if(en(Ue.beforeSanitizeElements,e,null),Zt(e))return Gt(e),!0;const o=Ut(Se?Se(e):e.nodeName);if(en(Ue.uponSanitizeElement,e,{tagName:o,allowedTags:$e}),at&&e.hasChildNodes()&&!Qt(e.firstElementChild)&&L(/<[/\w!]/g,e.innerHTML)&&L(/<[/\w!]/g,e.textContent))return Gt(e),!0;if(at&&e.namespaceURI===Nt&&"style"===o&&Qt(e.firstElementChild))return Gt(e),!0;if(e.nodeType===de)return Gt(e),!0;if(at&&e.nodeType===pe&&L(/<[/\w]/g,e.data))return Gt(e),!0;if(Je[o]||!(et.tagCheck instanceof Function&&et.tagCheck(o))&&!$e[o]){if(!Je[o]&&rn(o)){if(Ze.tagNameCheck instanceof RegExp&&L(Ze.tagNameCheck,o))return!1;if(Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(o))return!1}if(gt&&!At[o]){const t=ye(e),n=ge(e);if(n&&t){for(let o=n.length-1;o>=0;--o){const r=yt?n[o]:U(n[o],!0);t.insertBefore(r,he(e))}}}return Gt(e),!0}return((Te?Te(e):e.nodeType)!==ce||function(e){let t=ye(e);t&&t.tagName||(t={namespaceURI:Ct,tagName:"template"});const n=x(e.tagName),o=x(t.tagName);return!!kt[e.namespaceURI]&&(e.namespaceURI===_t?t.namespaceURI===Nt?"svg"===n:t.namespaceURI===Et?"svg"===n&&("annotation-xml"===o||Rt[o]):Boolean(Wt[n]):e.namespaceURI===Et?t.namespaceURI===Nt?"math"===n:t.namespaceURI===_t?"math"===n&&It[o]:Boolean(Bt[n]):e.namespaceURI===Nt?!(t.namespaceURI===_t&&!It[o])&&!(t.namespaceURI===Et&&!Rt[o])&&!Bt[n]&&(Lt[n]||!Wt[n]):!("application/xhtml+xml"!==Mt||!kt[e.namespaceURI]))}(e))&&("noscript"!==o&&"noembed"!==o&&"noframes"!==o||!L(/<\/no(script|embed|frames)/i,e.innerHTML))?(it&&e.nodeType===ue&&(t=e.textContent,g([Pe,Fe,He],e=>{t=E(t,e," ")}),e.textContent!==t&&(A(n.removed,{element:e.cloneNode()}),e.textContent=t)),en(Ue.afterSanitizeElements,e,null),!1):(Gt(e),!0)},nn=function(e,t,n){if(Qe[t])return!1;if(ft&&("id"===t||"name"===t)&&(n in o||n in Ft))return!1;const r=Ve[t]||et.attributeCheck instanceof Function&&et.attributeCheck(t,e);if(nt&&!Qe[t]&&L(je,t));else if(tt&&L(We,t));else if(!r||Qe[t]){if(!(rn(e)&&(Ze.tagNameCheck instanceof RegExp&&L(Ze.tagNameCheck,e)||Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(e))&&(Ze.attributeNameCheck instanceof RegExp&&L(Ze.attributeNameCheck,t)||Ze.attributeNameCheck instanceof Function&&Ze.attributeNameCheck(t,e))||"is"===t&&Ze.allowCustomizedBuiltInElements&&(Ze.tagNameCheck instanceof RegExp&&L(Ze.tagNameCheck,n)||Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(n))))return!1}else if(vt[t]);else if(L(qe,E(n,Ge,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==_(n,"data:")||!St[e]){if(ot&&!L(Be,E(n,Ge,"")));else if(n)return!1}else;return!0},on=P({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),rn=function(e){return!on[x(e)]&&L(Ye,e)},an=function(e){en(Ue.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||Zt(e))return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ve,forceKeepAttr:void 0};let r=t.length;for(;r--;){const a=t[r],l=a.name,s=a.namespaceURI,c=a.value,u=Ut(l),d=c;let p="value"===l?d:N(d);if(o.attrName=u,o.attrValue=p,o.keepAttr=!0,o.forceKeepAttr=void 0,en(Ue.uponSanitizeAttribute,e,o),p=o.attrValue,!mt||"id"!==u&&"name"!==u||0===_(p,ht)||(qt(l,e),p=ht+p),at&&L(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,p)){qt(l,e);continue}if("attributename"===u&&w(p,"href")){qt(l,e);continue}if(o.forceKeepAttr)continue;if(!o.keepAttr){qt(l,e);continue}if(!rt&&L(/\/>/i,p)){qt(l,e);continue}it&&g([Pe,Fe,He],e=>{p=E(p,e," ")});const f=Ut(e.nodeName);if(nn(f,u,p)){if(xe&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(s);else switch(h.getAttributeType(f,u)){case"TrustedHTML":p=Ce(p);break;case"TrustedScriptURL":p=Oe(p)}if(p!==d)try{s?e.setAttributeNS(s,l,p):e.setAttribute(l,p),Zt(e)?Gt(e):b(n.removed)}catch(i){qt(l,e)}}else qt(l,e)}en(Ue.afterSanitizeAttributes,e,null)},ln=function(e){let t=null;const n=Vt(e);for(en(Ue.beforeSanitizeShadowDOM,e,null);t=n.nextNode();){en(Ue.uponSanitizeShadowNode,t,null),tn(t),an(t),Jt(t.content)&&ln(t.content);if((Te?Te(t):t.nodeType)===ce){const e=be?be(t):t.shadowRoot;Jt(e)&&(sn(e),ln(e))}}en(Ue.afterSanitizeShadowDOM,e,null)},sn=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){ln(e.shadow);continue}const n=e.node,o=(Te?Te(n):n.nodeType)===ce,r=ge?ge(n):n.childNodes;if(r)for(let i=r.length-1;i>=0;--i)t.push({node:r[i],shadow:null});if(o){const e=Se?Se(n):null;if("string"==typeof e&&"template"===Ut(e)){const e=n.content;Jt(e)&&t.push({node:e,shadow:null})}}if(o){const e=be?be(n):n.shadowRoot;Jt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,i=null,a=null,l=null;if(Ot=!e,Ot&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Qt(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return C(e);case"boolean":return O(e);case"bigint":return k?k(e):"0";case"symbol":return D?D(e):"Symbol()";case"undefined":default:return I(e);case"function":case"object":{if(null===e)return I(e);const t=e,n=j(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:I(e)}return I(e)}}}(e)))throw M("dirty is not a string, aborting");if(!n.isSupported)return e;st||jt(t),n.removed=[];const s=yt&&"string"!=typeof e&&Qt(e);if(s){const t=Se?Se(e):e.nodeName;if("string"==typeof t){const e=Ut(t);if(!$e[e]||Je[e])throw M("root node is forbidden and cannot be sanitized in-place")}if(Zt(e))throw M("root node is clobbered and cannot be sanitized in-place");try{sn(e)}catch(d){throw Yt(e),d}}else if(Qt(e))o=Xt("\x3c!----\x3e"),i=o.ownerDocument.importNode(e,!0),i.nodeType===ce&&"BODY"===i.nodeName||"HTML"===i.nodeName?o=i:o.appendChild(i),sn(i);else{if(!ut&&!it&&!lt&&-1===e.indexOf("<"))return xe&&pt?Ce(e):e;if(o=Xt(e),!o)return ut?null:pt?we:""}o&&ct&&Gt(o.firstChild);const c=Vt(s?e:o);try{for(;a=c.nextNode();)tn(a),an(a),Jt(a.content)&&ln(a.content)}catch(d){throw s&&Yt(e),d}if(s)return g(n.removed,e=>{e.element&&function(e){const t=[e];for(;t.length>0;){const e=t.pop();(Te?Te(e):e.nodeType)===ce&&$t(e);const n=ge?ge(e):e.childNodes;if(n)for(let o=n.length-1;o>=0;--o)t.push(n[o])}}(e.element)}),it&&Kt(e),e;if(ut){if(it&&Kt(o),dt)for(l=Le.call(o.ownerDocument);o.firstChild;)l.appendChild(o.firstChild);else l=o;return(Ve.shadowroot||Ve.shadowrootmode)&&(l=ze.call(r,l,!0)),l}let u=lt?o.outerHTML:o.innerHTML;return lt&&$e["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&L(le,o.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+u),it&&g([Pe,Fe,He],e=>{u=E(u,e," ")}),xe&&pt?Ce(u):u},n.setConfig=function(){jt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),st=!0},n.clearConfig=function(){Pt=null,st=!1,xe=ve,we=""},n.isValidAttribute=function(e,t,n){Pt||jt({});const o=Ut(e),r=Ut(t);return nn(o,r,n)},n.addHook=function(e,t){"function"==typeof t&&A(Ue[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=y(Ue[e],t);return-1===n?void 0:T(Ue[e],n,1)[0]}return b(Ue[e])},n.removeHooks=function(e){Ue[e]=[]},n.removeAllHooks=function(){Ue={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function ge(e){const t=e.startsWith("--")?e:`--${e}`,n=[document.documentElement,document.body,...Array.from(document.querySelectorAll(["rai-widget","rai-custom-widget","rai-channel-widget","rai-store-widget","rai-milestone-widget","rai-social-widget","rai-currency-widget","rai-referral-widget",".rai-widget-root",'[data-rai-widget-root="true"]'].join(",")))].filter(Boolean);for(const o of n){const e=getComputedStyle(o).getPropertyValue(t).trim();if(e)return e}for(const o of Array.from(document.querySelectorAll("*"))){const e=getComputedStyle(o).getPropertyValue(t).trim();if(e)return e}}he.addHook("afterSanitizeAttributes",e=>{"A"===e.tagName&&"_blank"===e.getAttribute("target")&&e.setAttribute("rel","noopener noreferrer")});const ye=e=>{if(!e)return;const t=e.trim();if(/^(#|rgb|hsl)/i.test(t))return t;if(/^(--)?[a-z0-9-]+$/i.test(t)){return ge(t)}const n=t.match(/^var\((--[a-z0-9-]+)\)$/i);if(n){return ge(n[1])}};function be(e,t,n){const o=document.createElement(e);if(Object.assign(o.style,t),n)for(const r of Object.keys(n))o.setAttribute(r,n[r]);return o}function Ae(e){return"left"===e||"top"===e?"flex-start":"right"===e||"bottom"===e?"flex-end":"center"}function Te(e,t){var n;const o=[null==(n=e.cta)?void 0:n.style,e.cta,e.ctaStyle];for(const r of o)for(const e of t){const t=null==r?void 0:r[e];if(t)return t}}function Se(e,t){var n,o,r,i,a,l,s,c,u,d,p,f,m,h;const g=e.placement||{},y=g.mode||"overlay",b=g.position||"top",A=String(g.zIndex||2147483e3),T=function(e){var t,n;return"image"===e.type&&Boolean((null==(t=e.image)?void 0:t.desktopUrl)||(null==(n=e.image)?void 0:n.mobileUrl))}(e),S=T?"transparent":ye(null==(n=e.style)?void 0:n.backgroundColor)||"#1f2024",x=ye(null==(o=e.style)?void 0:o.color)||"#ffffff",v="overlay"===y||"popup"===y,w=Te(e,["position"])||"center",E=Ae(null==(r=e.image)?void 0:r.horizontalAlignment),_=Ae(null==(i=e.image)?void 0:i.verticalAlignment),N=(null==(a=e.image)?void 0:a.horizontalAlignment)||"center",C=(null==(l=e.image)?void 0:l.verticalAlignment)||"center",O=T?"#ffffff":x,k=be("div",{boxSizing:"border-box",fontFamily:"Roboto, sans-serif",fontSize:"14px",lineHeight:"1.35",background:S,color:x,borderRadius:v&&!T?"6px":"0",boxShadow:v&&!T?"0 8px 24px rgba(0,0,0,0.22)":"none",padding:T?"0":v?"12px 42px 12px 24px":"8px 42px 8px 16px",display:"flex",alignItems:T?_:"flex-start",justifyContent:"center",gap:T?"0":"16px"});if(k.setAttribute("role",v?"dialog":"region"),k.setAttribute("aria-label","community banner"),k.setAttribute("data-renderer-version","sdk-banner-preview-layout"),v)if(Object.assign(k.style,{position:"fixed",left:"50%",width:"fit-content",maxWidth:T?"70vw":"min(700px, 80vw)",height:"auto",minHeight:T?"0":"80px",maxHeight:T?"70vh":"calc(100vh - 300px)",overflowY:T?"visible":"auto",zIndex:A}),T){const e=[];"left"===N?k.style.left="24px":"right"===N?(k.style.left="",k.style.right="24px"):(k.style.left="50%",e.push("-50%")),"top"===C?k.style.top="10px":"bottom"===C?k.style.bottom="24px":(k.style.top="50%",e.push("-50%")),2===e.length?k.style.transform=`translate(${e[0]}, ${e[1]})`:1===e.length&&"center"===N?k.style.transform=`translateX(${e[0]})`:1===e.length?k.style.transform=`translateY(${e[0]})`:k.style.transform=""}else"bottom"===b?(k.style.bottom="24px",k.style.transform="translateX(-50%)"):"center"===b?(k.style.top="50%",k.style.transform="translate(-50%, -50%)"):(k.style.top="10px",k.style.transform="translateX(-50%)");else Object.assign(k.style,{position:"relative",width:"100%",zIndex:A});const D=be("div",{display:"flex",width:T||v?"auto":"100%",maxWidth:"100%",flexDirection:"column",gap:T?"0":"12px",overflow:"hidden"}),R=be("div",{display:"flex",width:T||v?"auto":"100%",justifyContent:T?E:"space-between",alignItems:T?_:"flex-start",gap:"12px"}),I=be("div",{width:T||v?"auto":"100%",maxWidth:T?"70vw":v?"calc(min(700px, 80vw) - 66px)":"100%",overflow:"hidden",wordBreak:"normal",overflowWrap:"anywhere",whiteSpace:"normal",color:x}),L=(null==(s=e.image)?void 0:s.desktopUrl)||(null==(c=e.image)?void 0:c.mobileUrl);if(T&&L){const t=null==(u=e.image)?void 0:u.linkUrl,n=null==(d=e.image)?void 0:d.openInNewTab,o=be("img",{display:"block",maxWidth:"70vw",maxHeight:"70vh",width:"auto",height:"auto",objectFit:"contain",objectPosition:(P=null==(p=e.image)?void 0:p.horizontalAlignment,F=null==(f=e.image)?void 0:f.verticalAlignment,`${"left"===P?"left":"right"===P?"right":"center"} ${"top"===F?"top":"bottom"===F?"bottom":"center"}`),cursor:t?"pointer":"",borderRadius:"rounded"===(null==(m=e.image)?void 0:m.cornerRadius)?"8px":"0"},{src:L,alt:e.title||"banner"});t&&o.addEventListener("click",()=>{n?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}),I.appendChild(o)}else{I.innerHTML=(U=e.text)?he.sanitize(U,{ALLOWED_TAGS:["p","strong","em","u","img","span","div","a","br"],ALLOWED_ATTR:["style","src","class","href","target","alt","width","height"],ADD_ATTR:["target"],ALLOW_DATA_ATTR:!1}):"",(z=I).querySelectorAll("p").forEach(e=>{e.style.margin="0",e.style.whiteSpace="normal",e.style.overflowWrap="anywhere"}),z.querySelectorAll("strong").forEach(e=>{e.style.fontWeight="700",e.style.whiteSpace="normal"}),z.querySelectorAll("em").forEach(e=>{e.style.fontStyle="italic",e.style.whiteSpace="normal"}),z.querySelectorAll("u").forEach(e=>{e.style.textDecoration="underline",e.style.whiteSpace="normal"}),z.querySelectorAll("a").forEach(e=>{e.style.color="#3b82f6",e.style.textDecoration="underline",e.style.whiteSpace="normal",e.style.overflowWrap="anywhere","_blank"===e.getAttribute("target")&&e.setAttribute("rel","noopener noreferrer")}),z.querySelectorAll("img").forEach(e=>{e.style.maxWidth="100%",e.style.height="auto"});const t=function(e){const t=e.querySelector('[style*="text-align"]'),n=((null==t?void 0:t.style.textAlign)||e.style.textAlign||"").toLowerCase().trim();return"center"===n||"right"===n||"justify"===n?n:"left"}(I);I.style.textAlign=t,v&&(R.style.justifyContent="center"===(M=t)?"center":"right"===M?"flex-end":"flex-start")}var M,z,U,P,F,H;if(!T&&(null==(h=e.cta)?void 0:h.enabled)){const n=be("button",{cursor:"pointer",border:"none",borderRadius:"6px",height:"36px",minHeight:"36px",padding:"0 16px",fontFamily:"Roboto, sans-serif",fontSize:"12px",fontWeight:"600",lineHeight:"20px",backgroundColor:ye(Te(e,["backgroundColor","buttonColor","aColor"]))||"#2f6df6",color:ye(Te(e,["textColor","color"]))||"#ffffff",boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center"});if(n.type="button",n.textContent=e.cta.label||"CTA Button",n.addEventListener("click",t.onCtaClick),"inline"===w){R.appendChild(I);const e=be("div",{display:"flex",flexDirection:"column",alignItems:"flex-end",justifyContent:"center",flexShrink:"0"});e.appendChild(n),R.appendChild(e),D.appendChild(R)}else{R.appendChild(I),D.appendChild(R);const e=be("div",{display:"flex",width:"100%",justifyContent:(H=w,"left"===H?"flex-start":"right"===H?"flex-end":"center")});e.appendChild(n),D.appendChild(e)}}else R.appendChild(I),D.appendChild(R);k.appendChild(D);const j=be("button",{position:v?"absolute":"",top:v?T?"16px":"12px":"",right:v?T?"16px":"12px":"",marginTop:v?"0":"8px",width:"20px",minWidth:"20px",height:"20px",cursor:"pointer",border:"none",borderRadius:"50%",background:"rgba(0,0,0,0.25)",color:O,fontSize:"16px",lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flexShrink:"0"});return j.type="button",j.setAttribute("aria-label","dismiss banner"),j.innerHTML="&times;",j.addEventListener("click",t.onDismiss),k.appendChild(j),k}function xe(){try{if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function ve(e){if(e)try{(new Image).src=e}catch{}}const we={LOCAL:"http://localhost:1335",SGTR:"https://api-v2.genesiv.org",STG:"https://staging-api-v2.genesiv.org",GEN:"https://api-v2.returning.ai"};class Ee extends HTMLElement{constructor(){super(...arguments),n(this,"rendered",null),n(this,"impressionFired",!1)}connectedCallback(){this.init()}disconnectedCallback(){this.cleanup()}resolveApiUrl(){const e=this.getAttribute("api-url")||this.getAttribute("data-api-url");if(e)return e.replace(/\/+$/,"");const t=this.getAttribute("domain-key")||this.getAttribute("data-domain-key");return t&&we[t]?we[t]:we.LOCAL}device(){const e=window.innerWidth;return e<640?"mobile":e<1024?"tablet":"desktop"}async init(){var e;try{const t=this.getAttribute("community-id")||this.getAttribute("data-community-id");if(!t)return void console.error('[rai-banner] missing required "community-id" attribute');const n=this.resolveApiUrl(),o=this.getAttribute("storage-prefix")||this.getAttribute("data-storage-prefix")||"returning-ai-widget",r=this.getAttribute("surface")||"sdk",i=function(e,t){const n=`${t}-rai-banner-visitor-${e}`;try{let e=localStorage.getItem(n);return e||(e=xe(),localStorage.setItem(n,e)),e}catch{return xe()}}(t,o),a=this.getAttribute("page-path")||window.location.pathname,l=this.getAttribute("page-hostname")||window.location.hostname,s=this.getAttribute("page-url")||window.location.href,c=this.getAttribute("embed-token")||this.getAttribute("data-embed-token")||void 0,u=await async function(e,t){try{const n=await fetch(`${e}/v2/api/banner-sdk/eligible`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),o=await n.json();return o&&o.meta&&"success"===o.meta.status?o.data||{banner:null}:{banner:null,reason:o&&o.detail||"request_failed"}}catch{return{banner:null,reason:"network_error"}}}(n,{communityId:t,surface:r,embedToken:c,page:{url:s,hostname:l,path:a},viewport:{width:window.innerWidth,height:window.innerHeight,device:this.device()},identifier:{type:"anonymous_session",value:i}}),d=u.banner;if(!d)return void this.dispatch("rai-banner-empty",{reason:u.reason});if("hide"===(null==(e=d.placement)?void 0:e.mobileBehavior)&&"mobile"===this.device())return void this.dispatch("rai-banner-empty",{reason:"hidden_on_mobile"});this.mount(d)}catch(t){this.dispatch("rai-banner-error",{error:null==t?void 0:t.message})}}mount(e){var t,n,o,r,i,a,l;if(!this.isConnected)return;const s=Se(e,{onCtaClick:()=>{var t,n,o;ve(null==(t=e.tracking)?void 0:t.clickUrl),this.dispatch("rai-banner-click",{bannerId:e.id});const r=null==(n=e.cta)?void 0:n.url;r&&((null==(o=e.cta)?void 0:o.openInNewTab)?window.open(r,"_blank","noopener,noreferrer"):window.location.href=r)},onDismiss:()=>{var t;ve(null==(t=e.tracking)?void 0:t.dismissUrl),this.dispatch("rai-banner-dismiss",{bannerId:e.id}),this.cleanup()}});this.rendered=s;if("overlay"===(null==(t=e.placement)?void 0:t.mode)||"popup"===(null==(n=e.placement)?void 0:n.mode))document.body.appendChild(s);else{const t=null==(o=e.placement)?void 0:o.targetSelector,n=t?document.querySelector(t):null;if(n){const t=(null==(r=e.placement)?void 0:r.insertion)||"append";"prepend"===t?n.insertBefore(s,n.firstChild):"before"===t?null==(i=n.parentNode)||i.insertBefore(s,n):"after"===t?null==(a=n.parentNode)||a.insertBefore(s,n.nextSibling):n.appendChild(s)}else this.style.display="block",this.style.width="100%",this.appendChild(s)}this.impressionFired||(this.impressionFired=!0,ve(null==(l=e.tracking)?void 0:l.impressionUrl),this.dispatch("rai-banner-impression",{bannerId:e.id}))}cleanup(){this.rendered&&this.rendered.parentNode&&this.rendered.parentNode.removeChild(this.rendered),this.rendered=null}dispatch(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}}function _e(){var e;const t=((null==(e=document.currentScript)?void 0:e.hasAttribute("data-rai-banner"))?document.currentScript:null)||document.querySelector("script[data-rai-banner]");if(!t)return;if(!t.getAttribute("data-community-id"))return;if(document.querySelector("rai-banner"))return;const n=document.createElement("rai-banner"),o={"data-community-id":"community-id","data-api-url":"api-url","data-domain-key":"domain-key","data-surface":"surface","data-storage-prefix":"storage-prefix","data-page-path":"page-path","data-embed-token":"embed-token"};for(const[r,i]of Object.entries(o)){const e=t.getAttribute(r);e&&n.setAttribute(i,e)}document.body.appendChild(n)}return console.log("[rai-banner] v1.6.1"),"undefined"==typeof customElements||customElements.get("rai-banner")||customElements.define("rai-banner",Ee),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",_e):_e(),e.BannerRuntime=Ee,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
3
+ function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(s=(o=i.call(n)).done)&&(l.push(o.value),l.length!==t);s=!0);}catch(u){c=!0,r=u}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const i=Object.entries,a=Object.setPrototypeOf,l=Object.isFrozen,s=Object.getPrototypeOf,c=Object.getOwnPropertyDescriptor;let u=Object.freeze,d=Object.seal,p=Object.create,f="undefined"!=typeof Reflect&&Reflect,m=f.apply,h=f.construct;u||(u=function(e){return e}),d||(d=function(e){return e}),m||(m=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];return e.apply(t,o)}),h||(h=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return new e(...n)});const g=U(Array.prototype.forEach),y=U(Array.prototype.lastIndexOf),b=U(Array.prototype.pop),A=U(Array.prototype.push),T=U(Array.prototype.splice),S=Array.isArray,x=U(String.prototype.toLowerCase),v=U(String.prototype.toString),w=U(String.prototype.match),E=U(String.prototype.replace),_=U(String.prototype.indexOf),N=U(String.prototype.trim),C=U(Number.prototype.toString),O=U(Boolean.prototype.toString),k="undefined"==typeof BigInt?null:U(BigInt.prototype.toString),D="undefined"==typeof Symbol?null:U(Symbol.prototype.toString),R=U(Object.prototype.hasOwnProperty),I=U(Object.prototype.toString),L=U(RegExp.prototype.test),M=(z=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h(z,t)});var z;function U(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return m(e,t,o)}}function P(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:x;if(a&&a(e,null),!S(t))return e;let o=t.length;for(;o--;){let r=t[o];if("string"==typeof r){const e=n(r);e!==r&&(l(t)||(t[o]=e),r=e)}e[r]=!0}return e}function F(e){for(let t=0;t<e.length;t++){R(e,t)||(e[t]=null)}return e}function H(e){const t=p(null);for(const o of i(e)){var n=r(o,2);const i=n[0],a=n[1];R(e,i)&&(S(a)?t[i]=F(a):a&&"object"==typeof a&&a.constructor===Object?t[i]=H(a):t[i]=a)}return t}function j(e,t){for(;null!==e;){const n=c(e,t);if(n){if(n.get)return U(n.get);if("function"==typeof n.value)return U(n.value)}e=s(e)}return function(){return null}}const W=u(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),B=u(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),G=u(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Y=u(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),q=u(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),$=u(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),X=u(["#text"]),V=u(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),K=u(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Z=u(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),J=u(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Q=d(/{{[\w\W]*|^[\w\W]*}}/g),ee=d(/<%[\w\W]*|^[\w\W]*%>/g),te=d(/\${[\w\W]*/g),ne=d(/^data-[\-\w.\u00B7-\uFFFF]+$/),oe=d(/^aria-[\-\w]+$/),re=d(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ie=d(/^(?:\w+script|data):/i),ae=d(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),le=d(/^html$/i),se=d(/^[a-z][.\w]*(-[.\w]+)+$/i),ce=1,ue=3,de=7,pe=8,fe=9,me=11;var he=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window;const n=t=>e(t);if(n.version="3.4.9",n.removed=[],!t||!t.document||t.document.nodeType!==fe||!t.Element)return n.isSupported=!1,n;let o=t.document;const r=o,a=r.currentScript;t.DocumentFragment;const l=t.HTMLTemplateElement,s=t.Node,c=t.Element,d=t.NodeFilter,f=t.NamedNodeMap;void 0===f&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const m=t.DOMParser,h=t.trustedTypes,z=c.prototype,U=j(z,"cloneNode"),F=j(z,"remove"),he=j(z,"nextSibling"),ge=j(z,"childNodes"),ye=j(z,"parentNode"),be=j(z,"shadowRoot"),Ae=j(z,"attributes"),Te=s&&s.prototype?j(s.prototype,"nodeType"):null,Se=s&&s.prototype?j(s.prototype,"nodeName"):null;if("function"==typeof l){const e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let xe,ve,we="",Ee=!1,_e=0;const Ne=function(){if(_e>0)throw M('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Ce=function(e){Ne(),_e++;try{return xe.createHTML(e)}finally{_e--}},Oe=function(e){Ne(),_e++;try{return xe.createScriptURL(e)}finally{_e--}},ke=function(){return Ee||(ve=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(i){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(h,a),Ee=!0),ve},De=o,Re=De.implementation,Ie=De.createNodeIterator,Le=De.createDocumentFragment,Me=De.getElementsByTagName,ze=r.importNode;let Ue={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof i&&"function"==typeof ye&&Re&&void 0!==Re.createHTMLDocument;const Pe=Q,Fe=ee,He=te,je=ne,We=oe,Be=ie,Ge=ae,Ye=se;let qe=re,$e=null;const Xe=P({},[...W,...B,...G,...q,...X]);let Ve=null;const Ke=P({},[...V,...K,...Z,...J]);let Ze=Object.seal(p(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Je=null,Qe=null;const et=Object.seal(p(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let tt=!0,nt=!0,ot=!1,rt=!0,it=!1,at=!0,lt=!1,st=!1,ct=!1,ut=!1,dt=!1,pt=!1,ft=!0,mt=!1;const ht="user-content-";let gt=!0,yt=!1,bt={},At=null;const Tt=P({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let St=null;const xt=P({},["audio","video","img","source","image","track"]);let vt=null;const wt=P({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Et="http://www.w3.org/1998/Math/MathML",_t="http://www.w3.org/2000/svg",Nt="http://www.w3.org/1999/xhtml";let Ct=Nt,Ot=!1,kt=null;const Dt=P({},[Et,_t,Nt],v);let Rt=P({},["mi","mo","mn","ms","mtext"]),It=P({},["annotation-xml"]);const Lt=P({},["title","style","font","a","script"]);let Mt=null;const zt=["application/xhtml+xml","text/html"];let Ut=null,Pt=null;const Ft=o.createElement("form"),Ht=function(e){return e instanceof RegExp||e instanceof Function},jt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Pt&&Pt===e)return;e&&"object"==typeof e||(e={}),e=H(e),Mt=-1===zt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Ut="application/xhtml+xml"===Mt?v:x,$e=R(e,"ALLOWED_TAGS")&&S(e.ALLOWED_TAGS)?P({},e.ALLOWED_TAGS,Ut):Xe,Ve=R(e,"ALLOWED_ATTR")&&S(e.ALLOWED_ATTR)?P({},e.ALLOWED_ATTR,Ut):Ke,kt=R(e,"ALLOWED_NAMESPACES")&&S(e.ALLOWED_NAMESPACES)?P({},e.ALLOWED_NAMESPACES,v):Dt,vt=R(e,"ADD_URI_SAFE_ATTR")&&S(e.ADD_URI_SAFE_ATTR)?P(H(wt),e.ADD_URI_SAFE_ATTR,Ut):wt,St=R(e,"ADD_DATA_URI_TAGS")&&S(e.ADD_DATA_URI_TAGS)?P(H(xt),e.ADD_DATA_URI_TAGS,Ut):xt,At=R(e,"FORBID_CONTENTS")&&S(e.FORBID_CONTENTS)?P({},e.FORBID_CONTENTS,Ut):Tt,Je=R(e,"FORBID_TAGS")&&S(e.FORBID_TAGS)?P({},e.FORBID_TAGS,Ut):H({}),Qe=R(e,"FORBID_ATTR")&&S(e.FORBID_ATTR)?P({},e.FORBID_ATTR,Ut):H({}),bt=!!R(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?H(e.USE_PROFILES):e.USE_PROFILES),tt=!1!==e.ALLOW_ARIA_ATTR,nt=!1!==e.ALLOW_DATA_ATTR,ot=e.ALLOW_UNKNOWN_PROTOCOLS||!1,rt=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,it=e.SAFE_FOR_TEMPLATES||!1,at=!1!==e.SAFE_FOR_XML,lt=e.WHOLE_DOCUMENT||!1,ut=e.RETURN_DOM||!1,dt=e.RETURN_DOM_FRAGMENT||!1,pt=e.RETURN_TRUSTED_TYPE||!1,ct=e.FORCE_BODY||!1,ft=!1!==e.SANITIZE_DOM,mt=e.SANITIZE_NAMED_PROPS||!1,gt=!1!==e.KEEP_CONTENT,yt=e.IN_PLACE||!1,qe=function(e){try{return L(e,""),!0}catch(t){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:re,Ct="string"==typeof e.NAMESPACE?e.NAMESPACE:Nt,Rt=R(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?H(e.MATHML_TEXT_INTEGRATION_POINTS):P({},["mi","mo","mn","ms","mtext"]),It=R(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?H(e.HTML_INTEGRATION_POINTS):P({},["annotation-xml"]);const t=R(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?H(e.CUSTOM_ELEMENT_HANDLING):p(null);if(Ze=p(null),R(t,"tagNameCheck")&&Ht(t.tagNameCheck)&&(Ze.tagNameCheck=t.tagNameCheck),R(t,"attributeNameCheck")&&Ht(t.attributeNameCheck)&&(Ze.attributeNameCheck=t.attributeNameCheck),R(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(Ze.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),it&&(nt=!1),dt&&(ut=!0),bt&&($e=P({},X),Ve=p(null),!0===bt.html&&(P($e,W),P(Ve,V)),!0===bt.svg&&(P($e,B),P(Ve,K),P(Ve,J)),!0===bt.svgFilters&&(P($e,G),P(Ve,K),P(Ve,J)),!0===bt.mathMl&&(P($e,q),P(Ve,Z),P(Ve,J))),et.tagCheck=null,et.attributeCheck=null,R(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?et.tagCheck=e.ADD_TAGS:S(e.ADD_TAGS)&&($e===Xe&&($e=H($e)),P($e,e.ADD_TAGS,Ut))),R(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?et.attributeCheck=e.ADD_ATTR:S(e.ADD_ATTR)&&(Ve===Ke&&(Ve=H(Ve)),P(Ve,e.ADD_ATTR,Ut))),R(e,"ADD_URI_SAFE_ATTR")&&S(e.ADD_URI_SAFE_ATTR)&&P(vt,e.ADD_URI_SAFE_ATTR,Ut),R(e,"FORBID_CONTENTS")&&S(e.FORBID_CONTENTS)&&(At===Tt&&(At=H(At)),P(At,e.FORBID_CONTENTS,Ut)),R(e,"ADD_FORBID_CONTENTS")&&S(e.ADD_FORBID_CONTENTS)&&(At===Tt&&(At=H(At)),P(At,e.ADD_FORBID_CONTENTS,Ut)),gt&&($e["#text"]=!0),lt&&P($e,["html","head","body"]),$e.table&&(P($e,["tbody"]),delete Je.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw M('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw M('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=xe;xe=e.TRUSTED_TYPES_POLICY;try{we=Ce("")}catch(n){throw xe=t,n}}else null===e.TRUSTED_TYPES_POLICY?(xe=void 0,we=""):(void 0===xe&&(xe=ke()),xe&&"string"==typeof we&&(we=Ce("")));(Ue.uponSanitizeElement.length>0||Ue.uponSanitizeAttribute.length>0)&&$e===Xe&&($e=H($e)),Ue.uponSanitizeAttribute.length>0&&Ve===Ke&&(Ve=H(Ve)),u&&u(e),Pt=e},Wt=P({},[...B,...G,...Y]),Bt=P({},[...q,...$]),Gt=function(e){A(n.removed,{element:e});try{ye(e).removeChild(e)}catch(t){if(F(e),!ye(e))throw M("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Yt=function(e){const t=ge?ge(e):e.childNodes;if(t){const e=[];g(t,t=>{A(e,t)}),g(e,e=>{try{F(e)}catch(t){}})}const n=Ae?Ae(e):null;if(n)for(let r=n.length-1;r>=0;--r){const t=n[r],i=t&&t.name;if("string"==typeof i)try{e.removeAttribute(i)}catch(o){}}},qt=function(e,t){try{A(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(o){A(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ut||dt)try{Gt(t)}catch(o){}else try{t.setAttribute(e,"")}catch(o){}},$t=function(e){const t=Ae?Ae(e):e.attributes;if(t)for(let o=t.length-1;o>=0;--o){const r=t[o],i=r&&r.name;if("string"==typeof i&&!Ve[Ut(i)])try{e.removeAttribute(i)}catch(n){}}},Xt=function(e){let t=null,n=null;if(ct)e="<remove></remove>"+e;else{const t=w(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Mt&&Ct===Nt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=xe?Ce(e):e;if(Ct===Nt)try{t=(new m).parseFromString(r,Mt)}catch(a){}if(!t||!t.documentElement){t=Re.createDocument(Ct,"template",null);try{t.documentElement.innerHTML=Ot?we:r}catch(a){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(o.createTextNode(n),i.childNodes[0]||null),Ct===Nt?Me.call(t,lt?"html":"body")[0]:lt?t.documentElement:i},Vt=function(e){return Ie.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Kt=function(e){var t,n;e.normalize();const o=Ie.call(e.ownerDocument||e,e,d.SHOW_TEXT|d.SHOW_COMMENT|d.SHOW_CDATA_SECTION|d.SHOW_PROCESSING_INSTRUCTION,null);let r=o.nextNode();for(;r;){let e=r.data;g([Pe,Fe,He],t=>{e=E(e,t," ")}),r.data=e,r=o.nextNode()}const i=null!==(t=null===(n=e.querySelectorAll)||void 0===n?void 0:n.call(e,"template"))&&void 0!==t?t:[];g(Array.from(i),e=>{Jt(e.content)&&Kt(e.content)})},Zt=function(e){const t=Se?Se(e):null;return"string"==typeof t&&("form"===Ut(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==Ae(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==Te(e)||e.childNodes!==ge(e)))},Jt=function(e){if(!Te||"object"!=typeof e||null===e)return!1;try{return Te(e)===me}catch(t){return!1}},Qt=function(e){if(!Te||"object"!=typeof e||null===e)return!1;try{return"number"==typeof Te(e)}catch(t){return!1}};function en(e,t,o){g(e,e=>{e.call(n,t,o,Pt)})}const tn=function(e){let t=null;if(en(Ue.beforeSanitizeElements,e,null),Zt(e))return Gt(e),!0;const o=Ut(Se?Se(e):e.nodeName);if(en(Ue.uponSanitizeElement,e,{tagName:o,allowedTags:$e}),at&&e.hasChildNodes()&&!Qt(e.firstElementChild)&&L(/<[/\w!]/g,e.innerHTML)&&L(/<[/\w!]/g,e.textContent))return Gt(e),!0;if(at&&e.namespaceURI===Nt&&"style"===o&&Qt(e.firstElementChild))return Gt(e),!0;if(e.nodeType===de)return Gt(e),!0;if(at&&e.nodeType===pe&&L(/<[/\w]/g,e.data))return Gt(e),!0;if(Je[o]||!(et.tagCheck instanceof Function&&et.tagCheck(o))&&!$e[o]){if(!Je[o]&&rn(o)){if(Ze.tagNameCheck instanceof RegExp&&L(Ze.tagNameCheck,o))return!1;if(Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(o))return!1}if(gt&&!At[o]){const t=ye(e),n=ge(e);if(n&&t){for(let o=n.length-1;o>=0;--o){const r=yt?n[o]:U(n[o],!0);t.insertBefore(r,he(e))}}}return Gt(e),!0}return((Te?Te(e):e.nodeType)!==ce||function(e){let t=ye(e);t&&t.tagName||(t={namespaceURI:Ct,tagName:"template"});const n=x(e.tagName),o=x(t.tagName);return!!kt[e.namespaceURI]&&(e.namespaceURI===_t?t.namespaceURI===Nt?"svg"===n:t.namespaceURI===Et?"svg"===n&&("annotation-xml"===o||Rt[o]):Boolean(Wt[n]):e.namespaceURI===Et?t.namespaceURI===Nt?"math"===n:t.namespaceURI===_t?"math"===n&&It[o]:Boolean(Bt[n]):e.namespaceURI===Nt?!(t.namespaceURI===_t&&!It[o])&&!(t.namespaceURI===Et&&!Rt[o])&&!Bt[n]&&(Lt[n]||!Wt[n]):!("application/xhtml+xml"!==Mt||!kt[e.namespaceURI]))}(e))&&("noscript"!==o&&"noembed"!==o&&"noframes"!==o||!L(/<\/no(script|embed|frames)/i,e.innerHTML))?(it&&e.nodeType===ue&&(t=e.textContent,g([Pe,Fe,He],e=>{t=E(t,e," ")}),e.textContent!==t&&(A(n.removed,{element:e.cloneNode()}),e.textContent=t)),en(Ue.afterSanitizeElements,e,null),!1):(Gt(e),!0)},nn=function(e,t,n){if(Qe[t])return!1;if(ft&&("id"===t||"name"===t)&&(n in o||n in Ft))return!1;const r=Ve[t]||et.attributeCheck instanceof Function&&et.attributeCheck(t,e);if(nt&&!Qe[t]&&L(je,t));else if(tt&&L(We,t));else if(!r||Qe[t]){if(!(rn(e)&&(Ze.tagNameCheck instanceof RegExp&&L(Ze.tagNameCheck,e)||Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(e))&&(Ze.attributeNameCheck instanceof RegExp&&L(Ze.attributeNameCheck,t)||Ze.attributeNameCheck instanceof Function&&Ze.attributeNameCheck(t,e))||"is"===t&&Ze.allowCustomizedBuiltInElements&&(Ze.tagNameCheck instanceof RegExp&&L(Ze.tagNameCheck,n)||Ze.tagNameCheck instanceof Function&&Ze.tagNameCheck(n))))return!1}else if(vt[t]);else if(L(qe,E(n,Ge,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==_(n,"data:")||!St[e]){if(ot&&!L(Be,E(n,Ge,"")));else if(n)return!1}else;return!0},on=P({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),rn=function(e){return!on[x(e)]&&L(Ye,e)},an=function(e){en(Ue.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||Zt(e))return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ve,forceKeepAttr:void 0};let r=t.length;for(;r--;){const a=t[r],l=a.name,s=a.namespaceURI,c=a.value,u=Ut(l),d=c;let p="value"===l?d:N(d);if(o.attrName=u,o.attrValue=p,o.keepAttr=!0,o.forceKeepAttr=void 0,en(Ue.uponSanitizeAttribute,e,o),p=o.attrValue,!mt||"id"!==u&&"name"!==u||0===_(p,ht)||(qt(l,e),p=ht+p),at&&L(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,p)){qt(l,e);continue}if("attributename"===u&&w(p,"href")){qt(l,e);continue}if(o.forceKeepAttr)continue;if(!o.keepAttr){qt(l,e);continue}if(!rt&&L(/\/>/i,p)){qt(l,e);continue}it&&g([Pe,Fe,He],e=>{p=E(p,e," ")});const f=Ut(e.nodeName);if(nn(f,u,p)){if(xe&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(s);else switch(h.getAttributeType(f,u)){case"TrustedHTML":p=Ce(p);break;case"TrustedScriptURL":p=Oe(p)}if(p!==d)try{s?e.setAttributeNS(s,l,p):e.setAttribute(l,p),Zt(e)?Gt(e):b(n.removed)}catch(i){qt(l,e)}}else qt(l,e)}en(Ue.afterSanitizeAttributes,e,null)},ln=function(e){let t=null;const n=Vt(e);for(en(Ue.beforeSanitizeShadowDOM,e,null);t=n.nextNode();){en(Ue.uponSanitizeShadowNode,t,null),tn(t),an(t),Jt(t.content)&&ln(t.content);if((Te?Te(t):t.nodeType)===ce){const e=be?be(t):t.shadowRoot;Jt(e)&&(sn(e),ln(e))}}en(Ue.afterSanitizeShadowDOM,e,null)},sn=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){ln(e.shadow);continue}const n=e.node,o=(Te?Te(n):n.nodeType)===ce,r=ge?ge(n):n.childNodes;if(r)for(let i=r.length-1;i>=0;--i)t.push({node:r[i],shadow:null});if(o){const e=Se?Se(n):null;if("string"==typeof e&&"template"===Ut(e)){const e=n.content;Jt(e)&&t.push({node:e,shadow:null})}}if(o){const e=be?be(n):n.shadowRoot;Jt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,i=null,a=null,l=null;if(Ot=!e,Ot&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Qt(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return C(e);case"boolean":return O(e);case"bigint":return k?k(e):"0";case"symbol":return D?D(e):"Symbol()";case"undefined":default:return I(e);case"function":case"object":{if(null===e)return I(e);const t=e,n=j(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:I(e)}return I(e)}}}(e)))throw M("dirty is not a string, aborting");if(!n.isSupported)return e;st||jt(t),n.removed=[];const s=yt&&"string"!=typeof e&&Qt(e);if(s){const t=Se?Se(e):e.nodeName;if("string"==typeof t){const e=Ut(t);if(!$e[e]||Je[e])throw M("root node is forbidden and cannot be sanitized in-place")}if(Zt(e))throw M("root node is clobbered and cannot be sanitized in-place");try{sn(e)}catch(d){throw Yt(e),d}}else if(Qt(e))o=Xt("\x3c!----\x3e"),i=o.ownerDocument.importNode(e,!0),i.nodeType===ce&&"BODY"===i.nodeName||"HTML"===i.nodeName?o=i:o.appendChild(i),sn(i);else{if(!ut&&!it&&!lt&&-1===e.indexOf("<"))return xe&&pt?Ce(e):e;if(o=Xt(e),!o)return ut?null:pt?we:""}o&&ct&&Gt(o.firstChild);const c=Vt(s?e:o);try{for(;a=c.nextNode();)tn(a),an(a),Jt(a.content)&&ln(a.content)}catch(d){throw s&&Yt(e),d}if(s)return g(n.removed,e=>{e.element&&function(e){const t=[e];for(;t.length>0;){const e=t.pop();(Te?Te(e):e.nodeType)===ce&&$t(e);const n=ge?ge(e):e.childNodes;if(n)for(let o=n.length-1;o>=0;--o)t.push(n[o])}}(e.element)}),it&&Kt(e),e;if(ut){if(it&&Kt(o),dt)for(l=Le.call(o.ownerDocument);o.firstChild;)l.appendChild(o.firstChild);else l=o;return(Ve.shadowroot||Ve.shadowrootmode)&&(l=ze.call(r,l,!0)),l}let u=lt?o.outerHTML:o.innerHTML;return lt&&$e["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&L(le,o.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+u),it&&g([Pe,Fe,He],e=>{u=E(u,e," ")}),xe&&pt?Ce(u):u},n.setConfig=function(){jt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),st=!0},n.clearConfig=function(){Pt=null,st=!1,xe=ve,we=""},n.isValidAttribute=function(e,t,n){Pt||jt({});const o=Ut(e),r=Ut(t);return nn(o,r,n)},n.addHook=function(e,t){"function"==typeof t&&A(Ue[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=y(Ue[e],t);return-1===n?void 0:T(Ue[e],n,1)[0]}return b(Ue[e])},n.removeHooks=function(e){Ue[e]=[]},n.removeAllHooks=function(){Ue={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function ge(e){const t=e.startsWith("--")?e:`--${e}`,n=[document.documentElement,document.body,...Array.from(document.querySelectorAll(["rai-widget","rai-custom-widget","rai-channel-widget","rai-store-widget","rai-milestone-widget","rai-social-widget","rai-currency-widget","rai-referral-widget",".rai-widget-root",'[data-rai-widget-root="true"]'].join(",")))].filter(Boolean);for(const o of n){const e=getComputedStyle(o).getPropertyValue(t).trim();if(e)return e}for(const o of Array.from(document.querySelectorAll("*"))){const e=getComputedStyle(o).getPropertyValue(t).trim();if(e)return e}}he.addHook("afterSanitizeAttributes",e=>{"A"===e.tagName&&"_blank"===e.getAttribute("target")&&e.setAttribute("rel","noopener noreferrer")});const ye=e=>{if(!e)return;const t=e.trim();if(/^(#|rgb|hsl)/i.test(t))return t;if(/^(--)?[a-z0-9-]+$/i.test(t)){return ge(t)}const n=t.match(/^var\((--[a-z0-9-]+)\)$/i);if(n){return ge(n[1])}};function be(e,t,n){const o=document.createElement(e);if(Object.assign(o.style,t),n)for(const r of Object.keys(n))o.setAttribute(r,n[r]);return o}function Ae(e){return"left"===e||"top"===e?"flex-start":"right"===e||"bottom"===e?"flex-end":"center"}function Te(e,t){var n;const o=[null==(n=e.cta)?void 0:n.style,e.cta,e.ctaStyle];for(const r of o)for(const e of t){const t=null==r?void 0:r[e];if(t)return t}}function Se(e,t){var n,o,r,i,a,l,s,c,u,d,p,f,m,h;const g=e.placement||{},y=g.mode||"overlay",b=g.position||"top",A=String(g.zIndex||2147483e3),T=function(e){var t,n;return"image"===e.type&&Boolean((null==(t=e.image)?void 0:t.desktopUrl)||(null==(n=e.image)?void 0:n.mobileUrl))}(e),S=T?"transparent":ye(null==(n=e.style)?void 0:n.backgroundColor)||"#1f2024",x=ye(null==(o=e.style)?void 0:o.color)||"#ffffff",v="overlay"===y||"popup"===y,w=Te(e,["position"])||"center",E=Ae(null==(r=e.image)?void 0:r.horizontalAlignment),_=Ae(null==(i=e.image)?void 0:i.verticalAlignment),N=(null==(a=e.image)?void 0:a.horizontalAlignment)||"center",C=(null==(l=e.image)?void 0:l.verticalAlignment)||"center",O=T?"#ffffff":x,k=be("div",{boxSizing:"border-box",fontFamily:"Roboto, sans-serif",fontSize:"14px",lineHeight:"1.35",background:S,color:x,borderRadius:v&&!T?"6px":"0",boxShadow:v&&!T?"0 8px 24px rgba(0,0,0,0.22)":"none",padding:T?"0":v?"12px 42px 12px 24px":"8px 42px 8px 16px",display:"flex",alignItems:T?_:"flex-start",justifyContent:"center",gap:T?"0":"16px"});if(k.setAttribute("role",v?"dialog":"region"),k.setAttribute("aria-label","community banner"),k.setAttribute("data-renderer-version","sdk-banner-preview-layout"),v)if(Object.assign(k.style,{position:"fixed",left:"50%",width:"fit-content",maxWidth:T?"70vw":"min(700px, 80vw)",height:"auto",minHeight:T?"0":"80px",maxHeight:T?"70vh":"calc(100vh - 300px)",overflowY:T?"visible":"auto",zIndex:A}),T){const e=[];"left"===N?k.style.left="24px":"right"===N?(k.style.left="",k.style.right="24px"):(k.style.left="50%",e.push("-50%")),"top"===C?k.style.top="10px":"bottom"===C?k.style.bottom="24px":(k.style.top="50%",e.push("-50%")),2===e.length?k.style.transform=`translate(${e[0]}, ${e[1]})`:1===e.length&&"center"===N?k.style.transform=`translateX(${e[0]})`:1===e.length?k.style.transform=`translateY(${e[0]})`:k.style.transform=""}else"bottom"===b?(k.style.bottom="24px",k.style.transform="translateX(-50%)"):"center"===b?(k.style.top="50%",k.style.transform="translate(-50%, -50%)"):(k.style.top="10px",k.style.transform="translateX(-50%)");else Object.assign(k.style,{position:"relative",width:"100%",zIndex:A});const D=be("div",{display:"flex",width:T||v?"auto":"100%",maxWidth:"100%",flexDirection:"column",gap:T?"0":"12px",overflow:"hidden"}),R=be("div",{display:"flex",width:T||v?"auto":"100%",justifyContent:T?E:"space-between",alignItems:T?_:"flex-start",gap:"12px"}),I=be("div",{width:T||v?"auto":"100%",maxWidth:T?"70vw":v?"calc(min(700px, 80vw) - 66px)":"100%",overflow:"hidden",wordBreak:"normal",overflowWrap:"anywhere",whiteSpace:"normal",color:x}),L=(null==(s=e.image)?void 0:s.desktopUrl)||(null==(c=e.image)?void 0:c.mobileUrl);if(T&&L){const t=null==(u=e.image)?void 0:u.linkUrl,n=null==(d=e.image)?void 0:d.openInNewTab,o=be("img",{display:"block",maxWidth:"70vw",maxHeight:"70vh",width:"auto",height:"auto",objectFit:"contain",objectPosition:(P=null==(p=e.image)?void 0:p.horizontalAlignment,F=null==(f=e.image)?void 0:f.verticalAlignment,`${"left"===P?"left":"right"===P?"right":"center"} ${"top"===F?"top":"bottom"===F?"bottom":"center"}`),cursor:t?"pointer":"",borderRadius:"rounded"===(null==(m=e.image)?void 0:m.cornerRadius)?"8px":"0"},{src:L,alt:e.title||"banner"});t&&o.addEventListener("click",()=>{n?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}),I.appendChild(o)}else{I.innerHTML=(U=e.text)?he.sanitize(U,{ALLOWED_TAGS:["p","strong","em","u","img","span","div","a","br"],ALLOWED_ATTR:["style","src","class","href","target","alt","width","height"],ADD_ATTR:["target"],ALLOW_DATA_ATTR:!1}):"",(z=I).querySelectorAll("p").forEach(e=>{e.style.margin="0",e.style.whiteSpace="normal",e.style.overflowWrap="anywhere"}),z.querySelectorAll("strong").forEach(e=>{e.style.fontWeight="700",e.style.whiteSpace="normal"}),z.querySelectorAll("em").forEach(e=>{e.style.fontStyle="italic",e.style.whiteSpace="normal"}),z.querySelectorAll("u").forEach(e=>{e.style.textDecoration="underline",e.style.whiteSpace="normal"}),z.querySelectorAll("a").forEach(e=>{e.style.color="#3b82f6",e.style.textDecoration="underline",e.style.whiteSpace="normal",e.style.overflowWrap="anywhere","_blank"===e.getAttribute("target")&&e.setAttribute("rel","noopener noreferrer")}),z.querySelectorAll("img").forEach(e=>{e.style.maxWidth="100%",e.style.height="auto"});const t=function(e){const t=e.querySelector('[style*="text-align"]'),n=((null==t?void 0:t.style.textAlign)||e.style.textAlign||"").toLowerCase().trim();return"center"===n||"right"===n||"justify"===n?n:"left"}(I);I.style.textAlign=t,v&&(R.style.justifyContent="center"===(M=t)?"center":"right"===M?"flex-end":"flex-start")}var M,z,U,P,F,H;if(!T&&(null==(h=e.cta)?void 0:h.enabled)){const n=be("button",{cursor:"pointer",border:"none",borderRadius:"6px",height:"36px",minHeight:"36px",padding:"0 16px",fontFamily:"Roboto, sans-serif",fontSize:"12px",fontWeight:"600",lineHeight:"20px",backgroundColor:ye(Te(e,["backgroundColor","buttonColor","aColor"]))||"#2f6df6",color:ye(Te(e,["textColor","color"]))||"#ffffff",boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center"});if(n.type="button",n.textContent=e.cta.label||"CTA Button",n.addEventListener("click",t.onCtaClick),"inline"===w){R.appendChild(I);const e=be("div",{display:"flex",flexDirection:"column",alignItems:"flex-end",justifyContent:"center",flexShrink:"0"});e.appendChild(n),R.appendChild(e),D.appendChild(R)}else{R.appendChild(I),D.appendChild(R);const e=be("div",{display:"flex",width:"100%",justifyContent:(H=w,"left"===H?"flex-start":"right"===H?"flex-end":"center")});e.appendChild(n),D.appendChild(e)}}else R.appendChild(I),D.appendChild(R);k.appendChild(D);const j=be("button",{position:v?"absolute":"",top:v?T?"16px":"12px":"",right:v?T?"16px":"12px":"",marginTop:v?"0":"8px",width:"20px",minWidth:"20px",height:"20px",cursor:"pointer",border:"none",borderRadius:"50%",background:"rgba(0,0,0,0.25)",color:O,fontSize:"16px",lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",padding:"0",flexShrink:"0"});return j.type="button",j.setAttribute("aria-label","dismiss banner"),j.innerHTML="&times;",j.addEventListener("click",t.onDismiss),k.appendChild(j),k}function xe(){try{if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function ve(e){if(e)try{(new Image).src=e}catch{}}const we={LOCAL:"http://localhost:1335",SGTR:"https://api-v2.genesiv.org",STG:"https://staging-api-v2.genesiv.org",GEN:"https://api-v2.returning.ai"};class Ee extends HTMLElement{constructor(){super(...arguments),n(this,"rendered",null),n(this,"impressionFired",!1)}connectedCallback(){this.init()}disconnectedCallback(){this.cleanup()}resolveApiUrl(){const e=this.getAttribute("api-url")||this.getAttribute("data-api-url");if(e)return e.replace(/\/+$/,"");const t=this.getAttribute("domain-key")||this.getAttribute("data-domain-key");return t&&we[t]?we[t]:we.LOCAL}device(){const e=window.innerWidth;return e<640?"mobile":e<1024?"tablet":"desktop"}async init(){var e;try{const t=this.getAttribute("community-id")||this.getAttribute("data-community-id");if(!t)return void console.error('[rai-banner] missing required "community-id" attribute');const n=this.resolveApiUrl(),o=this.getAttribute("storage-prefix")||this.getAttribute("data-storage-prefix")||"returning-ai-widget",r=this.getAttribute("surface")||"sdk",i=function(e,t){const n=`${t}-rai-banner-visitor-${e}`;try{let e=localStorage.getItem(n);return e||(e=xe(),localStorage.setItem(n,e)),e}catch{return xe()}}(t,o),a=this.getAttribute("page-path")||window.location.pathname,l=this.getAttribute("page-hostname")||window.location.hostname,s=this.getAttribute("page-url")||window.location.href,c=this.getAttribute("embed-token")||this.getAttribute("data-embed-token")||void 0,u=await async function(e,t){try{const n=await fetch(`${e}/v2/api/banner-sdk/eligible`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),o=await n.json();return o&&o.meta&&"success"===o.meta.status?o.data||{banner:null}:{banner:null,reason:o&&o.detail||"request_failed"}}catch{return{banner:null,reason:"network_error"}}}(n,{communityId:t,surface:r,embedToken:c,page:{url:s,hostname:l,path:a},viewport:{width:window.innerWidth,height:window.innerHeight,device:this.device()},identifier:{type:"anonymous_session",value:i}}),d=u.banner;if(!d)return void this.dispatch("rai-banner-empty",{reason:u.reason});if("hide"===(null==(e=d.placement)?void 0:e.mobileBehavior)&&"mobile"===this.device())return void this.dispatch("rai-banner-empty",{reason:"hidden_on_mobile"});this.mount(d)}catch(t){this.dispatch("rai-banner-error",{error:null==t?void 0:t.message})}}mount(e){var t,n,o,r,i,a,l;if(!this.isConnected)return;const s=Se(e,{onCtaClick:()=>{var t,n,o;ve(null==(t=e.tracking)?void 0:t.clickUrl),this.dispatch("rai-banner-click",{bannerId:e.id});const r=null==(n=e.cta)?void 0:n.url;r&&((null==(o=e.cta)?void 0:o.openInNewTab)?window.open(r,"_blank","noopener,noreferrer"):window.location.href=r)},onDismiss:()=>{var t;ve(null==(t=e.tracking)?void 0:t.dismissUrl),this.dispatch("rai-banner-dismiss",{bannerId:e.id}),this.cleanup()}});this.rendered=s;if("overlay"===(null==(t=e.placement)?void 0:t.mode)||"popup"===(null==(n=e.placement)?void 0:n.mode))document.body.appendChild(s);else{const t=null==(o=e.placement)?void 0:o.targetSelector,n=t?document.querySelector(t):null;if(n){const t=(null==(r=e.placement)?void 0:r.insertion)||"append";"prepend"===t?n.insertBefore(s,n.firstChild):"before"===t?null==(i=n.parentNode)||i.insertBefore(s,n):"after"===t?null==(a=n.parentNode)||a.insertBefore(s,n.nextSibling):n.appendChild(s)}else this.style.display="block",this.style.width="100%",this.appendChild(s)}this.impressionFired||(this.impressionFired=!0,ve(null==(l=e.tracking)?void 0:l.impressionUrl),this.dispatch("rai-banner-impression",{bannerId:e.id}))}cleanup(){this.rendered&&this.rendered.parentNode&&this.rendered.parentNode.removeChild(this.rendered),this.rendered=null}dispatch(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}}function _e(){var e;const t=((null==(e=document.currentScript)?void 0:e.hasAttribute("data-rai-banner"))?document.currentScript:null)||document.querySelector("script[data-rai-banner]");if(!t)return;if(!t.getAttribute("data-community-id"))return;if(document.querySelector("rai-banner"))return;const n=document.createElement("rai-banner"),o={"data-community-id":"community-id","data-api-url":"api-url","data-domain-key":"domain-key","data-surface":"surface","data-storage-prefix":"storage-prefix","data-page-path":"page-path","data-embed-token":"embed-token"};for(const[r,i]of Object.entries(o)){const e=t.getAttribute(r);e&&n.setAttribute(i,e)}document.body.appendChild(n)}return console.log("[rai-banner] v1.6.2"),"undefined"==typeof customElements||customElements.get("rai-banner")||customElements.define("rai-banner",Ee),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",_e):_e(),e.BannerRuntime=Ee,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
@@ -1927,7 +1927,7 @@ class BannerRuntime extends HTMLElement {
1927
1927
  this.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true }));
1928
1928
  }
1929
1929
  }
1930
- console.log(`[rai-banner] v${"1.6.1"}`);
1930
+ console.log(`[rai-banner] v${"1.6.2"}`);
1931
1931
  if (typeof customElements !== "undefined" && !customElements.get("rai-banner")) {
1932
1932
  customElements.define("rai-banner", BannerRuntime);
1933
1933
  }