Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@formbricks/js

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formbricks/js - npm Package Compare versions

Comparing version 0.1.13 to 0.1.14

2

./dist/index.js

@@ -1,2 +0,2 @@

function e(n,r,o){if(!n.s){if(o instanceof t){if(!o.s)return void(o.o=e.bind(null,n,r));1&r&&(r=o.s),o=o.v}if(o&&o.then)return void o.then(e.bind(null,n,r),e.bind(null,n,2));n.s=r,n.v=o;var i=n.o;i&&i(n)}}var t=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(n,r){var o=new t,i=this.s;if(i){var s=1&i?n:r;if(s){try{e(o,1,s(this.v))}catch(t){e(o,2,t)}return o}return this}return this.o=function(t){try{var i=t.v;1&t.s?e(o,1,n?n(i):i):r?e(o,1,r(i)):e(o,2,i)}catch(t){e(o,2,t)}},o},t}();function n(e){return e instanceof t&&1&e.s}var r=/*#__PURE__*/function(){function r(){this.queue=[],this.running=!1}var o=r.prototype;return o.add=function(e){this.queue.push(e),this.running||this.run()},o.run=function(){try{var r=function(){o.running=!1},o=this;o.running=!0;var i=function(r,o,i){for(var s;;){var a=r();if(n(a)&&(a=a.v),!a)return f;if(a.then){s=0;break}var f=i();if(f&&f.then){if(!n(f)){s=1;break}f=f.s}}var l=new t,u=e.bind(null,l,2);return(0===s?a.then(c):1===s?f.then(b):(void 0).then(function(){(a=r())?a.then?a.then(c).then(void 0,u):c(a):e(l,1,f)})).then(void 0,u),l;function b(t){f=t;do{if(!(a=r())||n(a)&&!a.v)return void e(l,1,f);if(a.then)return void a.then(c).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(b).then(void 0,u)}function c(t){t?(f=i())&&f.then?f.then(b).then(void 0,u):b(f):e(l,1,f)}}(function(){return o.queue.length>0},0,function(){var e=o.queue.shift(),t=function(t,n){try{var r=Promise.resolve(e()).then(function(){})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){console.error(e)});if(t&&t.then)return t.then(function(){})});return Promise.resolve(i&&i.then?i.then(r):r())}catch(e){return Promise.reject(e)}},r}();function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.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)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,f,l,u,b,c,d,p={},h=[],m=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function g(e,t){for(var n in t)e[n]=t[n];return e}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return w(e,s,r,o,null)}function w(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++l:o};return null==o&&null!=f.vnode&&f.vnode(i),i}function y(e){return e.children}function j(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?x(e):null}function k(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return k(e)}}function C(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!P.__r++||b!==f.debounceRendering)&&((b=f.debounceRendering)||c)(P)}function P(){var e,t,n,r,o,i,s,a;for(u.sort(d);e=u.shift();)e.__d&&(t=u.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=g({},i)).__v=i.__v+1,z(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?x(i):s,i.__h),F(r,i),i.__e!=s&&k(i)),u.length>t&&u.sort(d));P.__r=0}function S(e,t,n,r,o,i,s,a,f,l){var u,b,c,d,m,g,_,v=r&&r.__k||h,j=v.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(d=n.__k[u]=null==(d=t[u])||"boolean"==typeof d||"function"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?w(null,d,null,null,d):Array.isArray(d)?w(y,{children:d},null,null,null):d.__b>0?w(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(c=v[u])||c&&d.key==c.key&&d.type===c.type)v[u]=void 0;else for(b=0;b<j;b++){if((c=v[b])&&d.key==c.key&&d.type===c.type){v[b]=void 0;break}c=null}z(e,d,c=c||p,o,i,s,a,f,l),m=d.__e,(b=d.ref)&&c.ref!=b&&(_||(_=[]),c.ref&&_.push(c.ref,null,d),_.push(b,d.__c||m,d)),null!=m?(null==g&&(g=m),"function"==typeof d.type&&d.__k===c.__k?d.__d=f=N(d,f,e):f=I(e,d,c,v,m,f),"function"==typeof n.type&&(n.__d=f)):f&&c.__e==f&&f.parentNode!=e&&(f=x(c))}for(n.__e=g,u=j;u--;)null!=v[u]&&("function"==typeof n.type&&null!=v[u].__e&&v[u].__e==n.__d&&(n.__d=E(r).nextSibling),A(v[u],v[u]));if(_)for(u=0;u<_.length;u++)U(_[u],_[++u],_[++u])}function N(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?N(r,t,n):I(n,r,r,o,r.__e,t));return t}function I(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function E(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=E(n)))return r;return null}function q(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||m.test(t)?n:n+"px"}function H(e,t,n,r,o){var i;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||q(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||q(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?L:T,i):e.removeEventListener(t,i?L:T,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function T(e){return this.l[e.type+!1](f.event?f.event(e):e)}function L(e){return this.l[e.type+!0](f.event?f.event(e):e)}function z(e,t,n,r,o,i,s,a,l){var u,b,c,d,p,h,m,_,v,w,x,k,C,P,N,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(u=f.__b)&&u(t);try{e:if("function"==typeof I){if(_=t.props,v=(u=I.contextType)&&r[u.__c],w=u?v?v.props.value:u.__:r,n.__c?m=(b=t.__c=n.__c).__=b.__E:("prototype"in I&&I.prototype.render?t.__c=b=new I(_,w):(t.__c=b=new j(_,w),b.constructor=I,b.render=M),v&&v.sub(b),b.props=_,b.state||(b.state={}),b.context=w,b.__n=r,c=b.__d=!0,b.__h=[],b._sb=[]),null==b.__s&&(b.__s=b.state),null!=I.getDerivedStateFromProps&&(b.__s==b.state&&(b.__s=g({},b.__s)),g(b.__s,I.getDerivedStateFromProps(_,b.__s))),d=b.props,p=b.state,b.__v=t,c)null==I.getDerivedStateFromProps&&null!=b.componentWillMount&&b.componentWillMount(),null!=b.componentDidMount&&b.__h.push(b.componentDidMount);else{if(null==I.getDerivedStateFromProps&&_!==d&&null!=b.componentWillReceiveProps&&b.componentWillReceiveProps(_,w),!b.__e&&null!=b.shouldComponentUpdate&&!1===b.shouldComponentUpdate(_,b.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(b.props=_,b.state=b.__s,b.__d=!1),b.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),x=0;x<b._sb.length;x++)b.__h.push(b._sb[x]);b._sb=[],b.__h.length&&s.push(b);break e}null!=b.componentWillUpdate&&b.componentWillUpdate(_,b.__s,w),null!=b.componentDidUpdate&&b.__h.push(function(){b.componentDidUpdate(d,p,h)})}if(b.context=w,b.props=_,b.__P=e,k=f.__r,C=0,"prototype"in I&&I.prototype.render){for(b.state=b.__s,b.__d=!1,k&&k(t),u=b.render(b.props,b.state,b.context),P=0;P<b._sb.length;P++)b.__h.push(b._sb[P]);b._sb=[]}else do{b.__d=!1,k&&k(t),u=b.render(b.props,b.state,b.context),b.state=b.__s}while(b.__d&&++C<25);b.state=b.__s,null!=b.getChildContext&&(r=g(g({},r),b.getChildContext())),c||null==b.getSnapshotBeforeUpdate||(h=b.getSnapshotBeforeUpdate(d,p)),N=null!=u&&u.type===y&&null==u.key?u.props.children:u,S(e,Array.isArray(N)?N:[N],t,n,r,o,i,s,a,l),b.base=t.__e,t.__h=null,b.__h.length&&s.push(b),m&&(b.__E=b.__=null),b.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=O(n.__e,t,n,r,o,i,s,l);(u=f.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=a,t.__h=!!l,i[i.indexOf(a)]=null),f.__e(e,t,n)}}function F(e,t){f.__c&&f.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){f.__e(e,t.__v)}})}function O(e,t,n,r,o,i,s,f){var l,u,b,c=n.props,d=t.props,h=t.type,m=0;if("svg"===h&&(o=!0),null!=i)for(;m<i.length;m++)if((l=i[m])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,i[m]=null;break}if(null==e){if(null===h)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,d.is&&d),i=null,f=!1}if(null===h)c===d||f&&e.data===d||(e.data=d);else{if(i=i&&a.call(e.childNodes),u=(c=n.props||p).dangerouslySetInnerHTML,b=d.dangerouslySetInnerHTML,!f){if(null!=i)for(c={},m=0;m<e.attributes.length;m++)c[e.attributes[m].name]=e.attributes[m].value;(b||u)&&(b&&(u&&b.__html==u.__html||b.__html===e.innerHTML)||(e.innerHTML=b&&b.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||H(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||H(e,i,t[i],n[i],r)}(e,d,c,o,f),b)t.__k=[];else if(m=t.props.children,S(e,Array.isArray(m)?m:[m],t,n,r,o&&"foreignObject"!==h,i,s,i?i[0]:n.__k&&x(n,0),f),null!=i)for(m=i.length;m--;)null!=i[m]&&_(i[m]);f||("value"in d&&void 0!==(m=d.value)&&(m!==e.value||"progress"===h&&!m||"option"===h&&m!==c.value)&&H(e,"value",m,c.value,!1),"checked"in d&&void 0!==(m=d.checked)&&m!==e.checked&&H(e,"checked",m,c.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){f.__e(e,n)}}function A(e,t,n){var r,o;if(f.unmount&&f.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){f.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&A(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||_(e.__e),e.__=e.__e=e.__d=void 0}function M(e,t,n){return this.constructor(e,n)}a=h.slice,f={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},l=0,j.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),C(this))},j.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),C(this))},j.prototype.render=y,u=[],c="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,d=function(e,t){return e.__v.__b-t.__v.__b},P.__r=0;var D,W,B,Q,J=0,Y=[],R=[],V=f.__b,X=f.__r,$=f.diffed,G=f.__c,K=f.unmount;function Z(e,t){f.__h&&f.__h(W,e,J||t),J=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:R}),n.__[e]}function ee(e){return J=1,function(e,t,n){var r=Z(D++,2);if(r.t=e,!r.__c&&(r.__=[ae(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},W.shouldComponentUpdate=o}return r.__N||r.__}(ae,e)}function te(e,t){var n=Z(D++,3);!f.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.i=t,W.__H.__h.push(n))}function ne(){for(var e;e=Y.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ie),e.__H.__h.forEach(se),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){W=null,V&&V(e)},f.__r=function(e){X&&X(e),D=0;var t=(W=e.__c).__H;t&&(B===W?(t.__h=[],W.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=R,e.__N=e.i=void 0})):(t.__h.forEach(ie),t.__h.forEach(se),t.__h=[])),B=W},f.diffed=function(e){$&&$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Y.push(t)&&Q===f.requestAnimationFrame||((Q=f.requestAnimationFrame)||oe)(ne)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==R&&(e.__=e.__V),e.i=void 0,e.__V=R})),B=W=null},f.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ie),e.__h=e.__h.filter(function(e){return!e.__||se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],f.__e(n,e.__v)}}),G&&G(e,t)},f.unmount=function(e){K&&K(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ie(e)}catch(e){t=e}}),n.__H=void 0,t&&f.__e(t,n.__v))};var re="function"==typeof requestAnimationFrame;function oe(e){var t,n=function(){clearTimeout(r),re&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);re&&(t=requestAnimationFrame(n))}function ie(e){var t=W,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),W=t}function se(e){var t=W;e.__c=e.__(),W=t}function ae(e,t){return"function"==typeof t?t(e):t}var fe=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function le(e){var t=e.children,n=e.isOpen,r=e.close,o=ee(!1),i=o[0],s=o[1];return te(function(){s(n)},[n]),v("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},v("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},v("div",{className:fe(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out fb-m-4")},v("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},v("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},v("span",{class:"fb-sr-only"},"Close"),v("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),v("div",{className:""},t))))}var ue=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){if(!e.ok)throw new Error("Could not update display")})}catch(e){return Promise.reject(e)}},be=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/responses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}};function ce(e){return v("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},v("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function de(e){return v("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function pe(e){return v("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function he(e){var t=e.headline,n=e.subheader;return v("div",{className:"fb-text-center"},v("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},v("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),v("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),v("div",null,v(de,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),v(pe,{subheader:n,questionId:"thankYouCard"})))}function me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ge(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return v("label",{key:e.id,className:fe(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},checked:s===e.label,style:{borderColor:o,color:o},required:t.required&&0===n}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function _e(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee([]),s=i[0],a=i[1],f=function(){return s.length>0};return v("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return v("label",{key:e.id,className:fe(s.includes(e.label)?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 hover:fb-bg-slate-50 focus:fb-outline-none")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"checkbox",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.checked?[].concat(s,[e.currentTarget.value]):s.filter(function(t){return t!==e.currentTarget.value}))},checked:s.includes(e.label),style:{borderColor:o,color:o}}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:t.required,value:f()?"checked":""}),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-my-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return v("label",{key:e,className:fe(s===e?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},v("input",{type:"radio",name:"nps",value:e,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:function(){return a(e)},required:t.required}),e)})),v("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},v("p",null,t.lowerLabel),v("p",null,t.upperLabel)))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function we(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=s(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=s(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=s(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function ye(e){return v("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:we(e.htmlString)}})}function je(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return v("div",null,v(de,{headline:t.headline,questionId:t.id}),v(ye,{htmlString:t.html,questionId:t.id}),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},v("div",null),!t.required&&v("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),v("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?v(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?v(ge,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?v(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?v(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?v(je,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function ke(e){var t,n=e.config,r=e.survey,o=e.close,i=e.brandColor,s=ee(r.questions[0].id),a=s[0],f=s[1],l=ee(0),u=l[0],b=l[1],c=ee(null),d=c[0],p=c[1],h=ee(null),m=h[0],g=h[1],_=ee(!1),w=_[0],y=_[1];te(function(){!function(){try{Promise.resolve(function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create display");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}({surveyId:r.id,personId:n.person.id},n)).then(function(e){g(e.id)})}catch(e){return Promise.reject(e)}}()},[n,r]),te(function(){var e;b((e=r.questions.findIndex(function(e){return e.id===a}),e/r.questions.length))},[a,r]);var j=function(e){try{var t=function(){y(!1),s?(b(100),r.thankYouCard.enabled?setTimeout(function(){o()},2e3):o()):f(r.questions[i+1].id)};y(!0);var i=r.questions.findIndex(function(e){return e.id===a}),s=i===r.questions.length-1,l={surveyId:r.id,personId:n.person.id,response:{finished:s,data:e}},u=d?Promise.resolve(function(e,t,n){try{return Promise.resolve(fetch(n.apiHost+"/api/v1/client/environments/"+n.environmentId+"/responses/"+t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw new Error("Could not update response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}(l,d,n)).then(function(){}):Promise.resolve(Promise.all([be(l,n),ue(m,n)])).then(function(e){p(e[0].id)});return Promise.resolve(u&&u.then?u.then(t):t())}catch(e){return Promise.reject(e)}};return v("div",null,v("div",{className:fe(w?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===u&&r.thankYouCard.enabled?v(he,{headline:r.thankYouCard.headline,subheader:r.thankYouCard.subheader,brandColor:null==(t=n.settings)?void 0:t.brandColor}):r.questions.map(function(e,t){return a===e.id&&v(xe,{key:e.id,brandColor:i,lastQuestion:t===r.questions.length-1,onSubmit:j,question:e})})),v(ce,{progress:u,brandColor:i}))}function Ce(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=ee(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return v("div",{id:"fbjs"},v(le,{isOpen:i[0],close:a},v(ke,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var Pe=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=o({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){localStorage.setItem("formbricksConfig",JSON.stringify(this.config))},e}();Pe.instance=void 0;var Se=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();Se.instance=void 0;var Ne=Se.getInstance(),Ie=Pe.getInstance(),Ee=function(){try{return Promise.resolve(fetch(Ie.get().apiHost+"/api/v1/client/environments/"+Ie.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Ie.get().person.id})})).then(function(e){if(!e.ok)throw Ne.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},qe="formbricks-web-container",He=Pe.getInstance(),Te=Se.getInstance(),Le=!1,ze=function(e){Le?Te.debug("A survey is already running. Skipping."):(Le=!0,function(e,t,n){var r,o;f.__&&f.__(e,t),r=t.__k,o=[],z(t,e=t.__k=v(y,null,[e]),r||p,p,void 0!==t.ownerSVGElement,r?null:t.firstChild?a.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),F(o,e)}(v(Ce,{config:He.get(),survey:e,closeSurvey:Fe}),document.getElementById(qe)))},Fe=function(){try{return document.getElementById(qe).remove(),Oe(),Promise.resolve(Ee()).then(function(e){He.update({settings:e}),Le=!1})}catch(e){return Promise.reject(e)}},Oe=function(){var e=document.createElement("div");e.id=qe,document.body.appendChild(e)},Ue=Se.getInstance(),Ae=Pe.getInstance(),Me=function(e,t){try{return Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Ae.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;Ue.debug('Formbricks: Event "'+e+'" tracked'),De(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){Ue.error("Formbricks: Error tracking event: "+JSON.stringify(e)),n=1})}();return o&&o.then?o.then(r):r(o)})}catch(e){return Promise.reject(e)}},De=function(e){for(var t,n=s(null==(r=Ae.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,a=s(i.triggers);!(o=a()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return Ue.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void ze(i)}},We=Pe.getInstance(),Be=Se.getInstance(),Qe=function(){try{return Be.debug("Creating new person"),Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/people",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){return e.ok?Promise.resolve(e.json()):(console.error("Formbricks: Error fetching person"),null)})}catch(e){return Promise.reject(e)}},Je=function(e,t){var n=We.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Ye=Se.getInstance(),Re=Pe.getInstance(),Ve=function(){try{return Re.get().person?Promise.resolve(fetch(Re.get().apiHost+"/api/v1/client/environments/"+Re.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Re.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Ye.error("Error creating session")}):(Ye.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},Xe=function(e){var t=o({},e);return t.expiresAt=Date.now()+36e5,t},$e=function(e){return!e||e.expiresAt<=Date.now()},Ge=Pe.getInstance(),Ke=Se.getInstance(),Ze=function(){var e=Ge.get().settings,t=null==e?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Ke.debug("checking page url"),0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&et(window.location.href,i.value,i.rule)&&Me(o.name)}};function et(e,t,n){switch(n){case"exactMatch":return e===t;case"contains":return e.includes(t);case"startsWith":return e.startsWith(t);case"endsWith":return e.endsWith(t);case"notMatch":return e!==t;case"notContains":return!e.includes(t);default:throw new Error("Invalid match type")}}var tt=function(e){var t=Ge.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&o.innerHTML===n.value&&Me(e.name)}),r.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&o.matches(n.value)&&Me(e.name)})},nt=Pe.getInstance(),rt=Se.getInstance(),ot=function(){if(!(nt.get().apiHost&&nt.get().environmentId&&nt.get().person&&nt.get().session&&nt.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},it=new r,st=function(e,t){it.add(function(){try{return ot(),Promise.resolve(function(e,t){try{return Be.debug("setting attribute: "+e+" to value: "+t),Je(e,t)?(Be.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return We.get().person&&We.get().person.id?Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/people/"+We.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})})).then(function(e){return Promise.resolve(e.json()).then(function(t){if(!e.ok)throw Be.error("Error updating person"),Error("Error updating person");return t})}):(console.error("Formbricks: Unable to update attribute. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e,t)).then(function(e){var t=e.person,n=e.settings;if(!t||!n)throw Be.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");We.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},at={init:function(e){it.add(function(){try{return function(e){try{var t=function(){(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Ye.debug("Session not expired, extending session"),Re.update({session:Xe(Re.get().session)})};Ye.debug("Checking session");var t=function(){if($e(Re.get().session))return Ye.debug("Session expired, creating new session"),Promise.resolve(Ve()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Ye.error("Error creating new session"),Error("Error creating new session");Re.update({session:t,settings:n}),Me("New Session")})}();return Promise.resolve(t&&t.then?t.then(e):e())}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ze),window.addEventListener("popstate",Ze),window.addEventListener("pushstate",Ze),window.addEventListener("replacestate",Ze),window.addEventListener("load",Ze)),"undefined"!=typeof window&&document.addEventListener("click",tt),rt.debug("Initialized")};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&rt.configure({logLevel:e.logLevel}),Oe(),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs :is(.fb-sr-only){clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-4){margin-right:1rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs :is(.fb-translate-x-28){--tw-translate-x:7rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-end){justify-content:flex-end}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.fb-space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.fb-shadow-lg){--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-shadow-sm){--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-ring-1){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.focus\\:fb-ring-0:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-2:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var n=function(){if(!nt.get().session||nt.get().environmentId!==e.environmentId||nt.get().apiHost!==e.apiHost)return rt.debug("No valid session found. Creating new config."),nt.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Qe()).then(function(e){var t=e.settings;nt.update({person:e.person,session:Xe(e.session),settings:t}),Me("New Session")});rt.debug("Found existing configuration. Checking session.");var t=nt.get().session,n=function(){if($e(t))return rt.debug("Session expired. Creating new session."),Promise.resolve(Ve()).then(function(e){var t=e.settings;nt.update({session:Xe(e.session),settings:t}),Me("New Session")});rt.debug("Session valid. Extending session."),nt.update({session:Xe(t)})}();return n&&n.then?n.then(function(){}):void 0}();Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){it.add(function(){try{return ot(),Promise.resolve(function(e){try{return Be.debug("setting userId: "+e),Je("userId",e)?(Be.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=We.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Be.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return We.get().person&&We.get().person.id?Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/people/"+We.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:We.get().session.id})})).then(function(e){if(!e.ok)throw Be.error("Formbricks: Error updating person"),Error("Error updating person");return Promise.resolve(e.json())}):(console.error("Formbricks: Unable to update userId. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e)).then(function(e){We.update({person:e.person,settings:e.settings})}))}catch(e){return Promise.reject(e)}var t}(e)).then(function(){})}catch(e){return Promise.reject(e)}})},setEmail:function(e){st("email",e)},setAttribute:st,track:function(e,t){void 0===t&&(t={}),it.add(function(){try{return ot(),Promise.resolve(Me(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){it.add(function(){try{return ot(),Promise.resolve(function(){try{return Be.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Qe()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Be.error("Error resetting user"),new Error("Formbricks: Error resetting user");We.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){it.add(function(){try{return ot(),Promise.resolve(function(){try{return Ne.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){Ie.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){it.add(function(){try{return ot(),Ze(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};module.exports=at;
var e=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();e.instance=void 0;var t=function(e){return{ok:!0,value:e}},n=function(e){return{ok:!1,error:e}};function r(e,t,n){return!0===e.ok?t(e.value):n(e.error)}e.getInstance();var o=/*#__PURE__*/function(){function t(t){this.handleError=void 0,this.handleError=t||function(t){return e.getInstance().error(JSON.stringify(t))}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.init=function(e){this.initialized=!0,console.log("🧱 Formbricks - initializing error handler"),console.log("🧱 Formbricks - Custom error handler: ","function"==typeof e?"yes":"no"),t.instance=new t(e)},t.prototype.handle=function(e){this.handleError(e)},t}();function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.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)?s(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}o.instance=void 0,o.initialized=!1;var f=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=i({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){var e,t=this;return(e=function(){return localStorage.setItem("formbricksConfig",JSON.stringify(t.config))},function(){try{return{ok:!0,value:e.apply(void 0,[].slice.call(arguments))}}catch(e){return{ok:!1,error:e}}})()},e}();f.instance=void 0;var l,u,c,b,d,p,h,g={},m=[],v=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function _(e,t){for(var n in t)e[n]=t[n];return e}function w(e){var t=e.parentNode;t&&t.removeChild(e)}function y(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?l.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return j(e,s,r,o,null)}function j(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++c:o};return null==o&&null!=u.vnode&&u.vnode(i),i}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?C(e):null}function S(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return S(e)}}function P(e){(!e.__d&&(e.__d=!0)&&b.push(e)&&!I.__r++||d!==u.debounceRendering)&&((d=u.debounceRendering)||p)(I)}function I(){var e,t,n,r,o,i,s,a;for(b.sort(h);e=b.shift();)e.__d&&(t=b.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=_({},i)).__v=i.__v+1,A(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?C(i):s,i.__h),O(r,i),i.__e!=s&&S(i)),b.length>t&&b.sort(h));I.__r=0}function N(e,t,n,r,o,i,s,a,f,l){var u,c,b,d,p,h,v,_=r&&r.__k||m,w=_.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(d=n.__k[u]=null==(d=t[u])||"boolean"==typeof d||"function"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?j(null,d,null,null,d):Array.isArray(d)?j(x,{children:d},null,null,null):d.__b>0?j(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(b=_[u])||b&&d.key==b.key&&d.type===b.type)_[u]=void 0;else for(c=0;c<w;c++){if((b=_[c])&&d.key==b.key&&d.type===b.type){_[c]=void 0;break}b=null}A(e,d,b=b||g,o,i,s,a,f,l),p=d.__e,(c=d.ref)&&b.ref!=c&&(v||(v=[]),b.ref&&v.push(b.ref,null,d),v.push(c,d.__c||p,d)),null!=p?(null==h&&(h=p),"function"==typeof d.type&&d.__k===b.__k?d.__d=f=E(d,f,e):f=q(e,d,b,_,p,f),"function"==typeof n.type&&(n.__d=f)):f&&b.__e==f&&f.parentNode!=e&&(f=C(b))}for(n.__e=h,u=w;u--;)null!=_[u]&&("function"==typeof n.type&&null!=_[u].__e&&_[u].__e==n.__d&&(n.__d=H(r).nextSibling),D(_[u],_[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function E(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?E(r,t,n):q(n,r,r,o,r.__e,t));return t}function q(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function H(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=H(n)))return r;return null}function T(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||v.test(t)?n:n+"px"}function z(e,t,n,r,o){var i;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||T(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||T(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?M:L,i):e.removeEventListener(t,i?M:L,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function L(e){return this.l[e.type+!1](u.event?u.event(e):e)}function M(e){return this.l[e.type+!0](u.event?u.event(e):e)}function A(e,t,n,r,o,i,s,a,f){var l,c,b,d,p,h,g,m,v,w,y,j,C,S,P,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(f=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(l=u.__b)&&l(t);try{e:if("function"==typeof I){if(m=t.props,v=(l=I.contextType)&&r[l.__c],w=l?v?v.props.value:l.__:r,n.__c?g=(c=t.__c=n.__c).__=c.__E:("prototype"in I&&I.prototype.render?t.__c=c=new I(m,w):(t.__c=c=new k(m,w),c.constructor=I,c.render=W),v&&v.sub(c),c.props=m,c.state||(c.state={}),c.context=w,c.__n=r,b=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=I.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=_({},c.__s)),_(c.__s,I.getDerivedStateFromProps(m,c.__s))),d=c.props,p=c.state,c.__v=t,b)null==I.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==I.getDerivedStateFromProps&&m!==d&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(m,w),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(m,c.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=m,c.state=c.__s,c.__d=!1),c.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),y=0;y<c._sb.length;y++)c.__h.push(c._sb[y]);c._sb=[],c.__h.length&&s.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(m,c.__s,w),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(d,p,h)})}if(c.context=w,c.props=m,c.__P=e,j=u.__r,C=0,"prototype"in I&&I.prototype.render){for(c.state=c.__s,c.__d=!1,j&&j(t),l=c.render(c.props,c.state,c.context),S=0;S<c._sb.length;S++)c.__h.push(c._sb[S]);c._sb=[]}else do{c.__d=!1,j&&j(t),l=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++C<25);c.state=c.__s,null!=c.getChildContext&&(r=_(_({},r),c.getChildContext())),b||null==c.getSnapshotBeforeUpdate||(h=c.getSnapshotBeforeUpdate(d,p)),P=null!=l&&l.type===x&&null==l.key?l.props.children:l,N(e,Array.isArray(P)?P:[P],t,n,r,o,i,s,a,f),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),g&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=F(n.__e,t,n,r,o,i,s,f);(l=u.diffed)&&l(t)}catch(e){t.__v=null,(f||null!=i)&&(t.__e=a,t.__h=!!f,i[i.indexOf(a)]=null),u.__e(e,t,n)}}function O(e,t){u.__c&&u.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u.__e(e,t.__v)}})}function F(e,t,n,r,o,i,s,a){var f,u,c,b=n.props,d=t.props,p=t.type,h=0;if("svg"===p&&(o=!0),null!=i)for(;h<i.length;h++)if((f=i[h])&&"setAttribute"in f==!!p&&(p?f.localName===p:3===f.nodeType)){e=f,i[h]=null;break}if(null==e){if(null===p)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,d.is&&d),i=null,a=!1}if(null===p)b===d||a&&e.data===d||(e.data=d);else{if(i=i&&l.call(e.childNodes),u=(b=n.props||g).dangerouslySetInnerHTML,c=d.dangerouslySetInnerHTML,!a){if(null!=i)for(b={},h=0;h<e.attributes.length;h++)b[e.attributes[h].name]=e.attributes[h].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||z(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||z(e,i,t[i],n[i],r)}(e,d,b,o,a),c)t.__k=[];else if(h=t.props.children,N(e,Array.isArray(h)?h:[h],t,n,r,o&&"foreignObject"!==p,i,s,i?i[0]:n.__k&&C(n,0),a),null!=i)for(h=i.length;h--;)null!=i[h]&&w(i[h]);a||("value"in d&&void 0!==(h=d.value)&&(h!==e.value||"progress"===p&&!h||"option"===p&&h!==b.value)&&z(e,"value",h,b.value,!1),"checked"in d&&void 0!==(h=d.checked)&&h!==e.checked&&z(e,"checked",h,b.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){u.__e(e,n)}}function D(e,t,n){var r,o;if(u.unmount&&u.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){u.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&D(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||w(e.__e),e.__=e.__e=e.__d=void 0}function W(e,t,n){return this.constructor(e,n)}l=m.slice,u={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},c=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=_({},this.state),"function"==typeof e&&(e=e(_({},n),this.props)),e&&_(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),P(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),P(this))},k.prototype.render=x,b=[],p="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0;var J,B,Q,Y,R=0,V=[],G=[],X=u.__b,$=u.__r,K=u.diffed,Z=u.__c,ee=u.unmount;function te(e,t){u.__h&&u.__h(B,e,R||t),R=0;var n=B.__H||(B.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:G}),n.__[e]}function ne(e){return R=1,function(e,t,n){var r=te(J++,2);if(r.t=e,!r.__c&&(r.__=[le(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=B,!B.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};B.u=!0;var i=B.shouldComponentUpdate,s=B.componentWillUpdate;B.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},B.shouldComponentUpdate=o}return r.__N||r.__}(le,e)}function re(e,t){var n=te(J++,3);!u.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.i=t,B.__H.__h.push(n))}function oe(){for(var e;e=V.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ae),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){B=null,X&&X(e)},u.__r=function(e){$&&$(e),J=0;var t=(B=e.__c).__H;t&&(Q===B?(t.__h=[],B.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=G,e.__N=e.i=void 0})):(t.__h.forEach(ae),t.__h.forEach(fe),t.__h=[])),Q=B},u.diffed=function(e){K&&K(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==V.push(t)&&Y===u.requestAnimationFrame||((Y=u.requestAnimationFrame)||se)(oe)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==G&&(e.__=e.__V),e.i=void 0,e.__V=G})),Q=B=null},u.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ae),e.__h=e.__h.filter(function(e){return!e.__||fe(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],u.__e(n,e.__v)}}),Z&&Z(e,t)},u.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ae(e)}catch(e){t=e}}),n.__H=void 0,t&&u.__e(t,n.__v))};var ie="function"==typeof requestAnimationFrame;function se(e){var t,n=function(){clearTimeout(r),ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ie&&(t=requestAnimationFrame(n))}function ae(e){var t=B,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),B=t}function fe(e){var t=B;e.__c=e.__(),B=t}function le(e,t){return"function"==typeof t?t(e):t}var ue=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function ce(e){var t=e.children,n=e.isOpen,r=e.close,o=ne(!1),i=o[0],s=o[1];return re(function(){s(n)},[n]),y("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},y("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},y("div",{className:ue(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out fb-m-4")},y("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},y("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},y("span",{class:"fb-sr-only"},"Close"),y("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),y("div",{className:""},t))))}var be=function(e,t){try{var r=t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){var t;function o(e){return t?e:{ok:!0,value:void 0}}var i=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(o){var i=n({code:"network_error",message:"Could not mark display as responded",status:e.status,url:r,responseMessage:o.message});return t=1,i})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},de=function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/responses";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not create response",status:e.status,url:o,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}};function pe(e){return y("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},y("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function he(e){return y("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function ge(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return y("label",{key:e.id,className:ue(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},checked:s===e.label,style:{borderColor:o,color:o},required:t.required&&0===n}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function _e(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne([]),s=i[0],a=i[1],f=function(){return s.length>0};return y("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return y("label",{key:e.id,className:ue(s.includes(e.label)?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 hover:fb-bg-slate-50 focus:fb-outline-none")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("input",{type:"checkbox",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.checked?[].concat(s,[e.currentTarget.value]):s.filter(function(t){return t!==e.currentTarget.value}))},checked:s.includes(e.label),style:{borderColor:o,color:o}}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:t.required,value:f()?"checked":""}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return y("label",{key:e,className:ue(s===e?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},y("input",{type:"radio",name:"nps",value:e,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:function(){return a(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ye(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=a(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=a(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=a(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function je(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:ye(e.htmlString)}})}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("div",null,y(he,{headline:t.headline,questionId:t.id}),y(je,{htmlString:t.html,questionId:t.id}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},y("div",null),!t.required&&y("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),y("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ke(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?y(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?y(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?y(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?y(we,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?y(xe,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function Ce(e){var t=e.headline,n=e.subheader;return y("div",{className:"fb-text-center"},y("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),y("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),y("div",null,y(he,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),y(ge,{subheader:n,questionId:"thankYouCard"})))}function Se(r){var o,i=r.config,s=r.survey,a=r.close,f=r.brandColor,l=r.errorHandler,u=ne(s.questions[0].id),c=u[0],b=u[1],d=ne(0),p=d[0],h=d[1],g=ne(null),m=g[0],v=g[1],_=ne(null),w=_[0],j=_[1],x=ne(!1),k=x[0],C=x[1];re(function(){!function(){try{Promise.resolve(function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/displays";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){var r;function i(n){return r?n:Promise.resolve(e.json()).then(t)}var s=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(t){var i=n({code:"network_error",message:"Could not create display",status:e.status,url:o,responseMessage:t.message});return r=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}}({surveyId:s.id,personId:i.person.id},i)).then(function(e){!0===e.ok?j(e.value.id):l(e.error)})}catch(e){return Promise.reject(e)}}()},[i,s,l]),re(function(){var e;h((e=s.questions.findIndex(function(e){return e.id===c}),e/s.questions.length))},[c,s]);var S=function(r){try{var o=function(){C(!1),u?(h(100),s.thankYouCard.enabled?setTimeout(function(){a()},2e3):a()):b(s.questions[f+1].id)};C(!0);var f=s.questions.findIndex(function(e){return e.id===c}),u=f===s.questions.length-1,d={surveyId:s.id,personId:i.person.id,response:{finished:u,data:r}},p=m?Promise.resolve(function(e,r,o){try{var i=o.apiHost+"/api/v1/client/environments/"+o.environmentId+"/responses/"+r;return Promise.resolve(fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not update response",status:e.status,url:i,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}}(d,m,i)).then(function(t){!0!==t.ok?l(t.error):d.response.finished&&e.getInstance().debug("Submitted response")}):Promise.resolve(Promise.all([de(d,i),be(w,i)])).then(function(e){var t=e[0];!0===t.ok?v(t.value.id):l(t.error)});return Promise.resolve(p&&p.then?p.then(o):o())}catch(e){return Promise.reject(e)}};return y("div",null,y("div",{className:ue(k?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===p&&s.thankYouCard.enabled?y(Ce,{headline:s.thankYouCard.headline,subheader:s.thankYouCard.subheader,brandColor:null==(o=i.settings)?void 0:o.brandColor}):s.questions.map(function(e,t){return c===e.id&&y(ke,{key:e.id,brandColor:f,lastQuestion:t===s.questions.length-1,onSubmit:S,question:e})})),y(pe,{progress:p,brandColor:f}))}function Pe(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=e.errorHandler,s=ne(!0),a=s[1],f=function(){a(!1),setTimeout(function(){o()},1e3)};return y("div",{id:"fbjs"},y(ce,{isOpen:s[0],close:f},y(Se,{config:n,survey:r,close:f,brandColor:null==(t=n.settings)?void 0:t.brandColor,errorHandler:i})))}var Ie=e.getInstance(),Ne=f.getInstance(),Ee=function(){try{var e=Ne.get().apiHost+"/api/v1/client/environments/"+Ne.get().environmentId+"/settings";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Ne.get().person.id})})).then(function(r){var o;function i(e){return o?e:Promise.resolve(r.json()).then(t)}var s=function(){if(!r.ok)return Promise.resolve(r.json()).then(function(t){var i=n({code:"network_error",status:r.status,message:"Error getting settings",url:e,responseMessage:t.message});return o=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}},qe=function(){try{return Ie.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){return!0!==e.ok?n(e.error):(Ie.debug("Settings refreshed"),Ne.update({settings:e.value}),{ok:!0,value:void 0})})}catch(e){return Promise.reject(e)}},He="formbricks-web-container",Te=f.getInstance(),ze=e.getInstance(),Le=o.getInstance(),Me=!1,Ae=function(e){Me?ze.debug("A survey is already running. Skipping."):(Me=!0,function(e,t,n){var r,o;u.__&&u.__(e,t),r=t.__k,o=[],A(t,e=t.__k=y(x,null,[e]),r||g,g,void 0!==t.ownerSVGElement,r?null:t.firstChild?l.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),O(o,e)}(y(Pe,{config:Te.get(),survey:e,closeSurvey:Oe,errorHandler:Le.handle}),document.getElementById(He)))},Oe=function(){try{return document.getElementById(He).remove(),Fe(),Promise.resolve(Ee()).then(function(e){r(e,function(e){Te.update({settings:e}),Me=!1},function(e){Le.handle(e)})})}catch(e){return Promise.reject(e)}},Fe=function(){var e=document.createElement("div");e.id=He,document.body.appendChild(e)},Ue=e.getInstance(),De=f.getInstance(),We=function(e,t){try{return Promise.resolve(fetch(De.get().apiHost+"/api/v1/client/environments/"+De.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:De.get().session.id,eventName:e,properties:t})})).then(function(t){var r;function o(t){return r?t:(Ue.debug('Formbricks: Event "'+e+'" tracked'),Je(e),{ok:!0,value:void 0})}var i=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){var o=n({code:"network_error",message:"Error tracking event: "+JSON.stringify(e),status:t.status,url:t.url,responseMessage:e.message});return r=1,o})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},Je=function(e){for(var t,n=a(null==(r=De.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,s=a(i.triggers);!(o=s()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return Ue.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ae(i)}},Be="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Qe(e,t,n){if(!e.s){if(n instanceof Ye){if(!n.s)return void(n.o=Qe.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Qe.bind(null,e,t),Qe.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Ye=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Qe(r,1,i(this.v))}catch(e){Qe(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Qe(r,1,t?t(o):o):n?Qe(r,1,n(o)):Qe(r,2,o)}catch(e){Qe(r,2,e)}},r},e}();function Re(e){return e instanceof Ye&&1&e.s}var Ve=f.getInstance(),Ge=e.getInstance(),Xe=o.getInstance(),$e=function(){try{var e,r=function(t){return e?t:{ok:!0,value:void 0}};Ge.debug("checking page url");var o=Ve.get().settings,i=null==o?void 0:o.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0===i.length)return Promise.resolve({ok:!0,value:void 0});var s=function(e,t,n){if("function"==typeof e[Be]){var r,o,i,s=e[Be]();if(function e(a){try{for(;!((r=s.next()).done||n&&n());)if((a=t(r.value))&&a.then){if(!Re(a))return void a.then(e,i||(i=Qe.bind(null,o=new Ye,2)));a=a.v}o?Qe(o,1,a):o=a}catch(e){Qe(o||(o=new Ye),2,e)}}(),s.return){var a=function(e){try{r.done||s.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<e.length;l++)f.push(e[l]);return function(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!Re(a))return void a.then(s,o||(o=Qe.bind(null,r=new Ye,2)));a=a.v}r?Qe(r,1,a):r=a}catch(e){Qe(r||(r=new Ye),2,e)}}(),r}(f,function(e){return t(f[e])},n)}(i,function(r){var o=r.noCodeConfig.pageUrl;if(o){var i=function(e,r,o){var i,s;switch(o){case"exactMatch":i=e===r;break;case"contains":i=e.includes(r);break;case"startsWith":i=e.startsWith(r);break;case"endsWith":i=e.endsWith(r);break;case"notMatch":i=e!==r;break;case"notContains":i=!e.includes(r);break;default:s=n({code:"invalid_match_type",message:"Invalid match type"})}return s||t(i)}(window.location.href,o.value,o.rule);if(!0!==i.ok){var s=n(i.error);return e=1,s}if(!1!==i.value)return Promise.resolve(We(r.name)).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}})}},function(){return e});return Promise.resolve(s&&s.then?s.then(r):r(s))}catch(e){return Promise.reject(e)}},Ke=function(e){var t=Ve.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),i=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&i.innerHTML===n.value&&We(e.name).then(function(e){r(e,function(e){},function(e){Xe.handle(e)})})}),o.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&i.matches(n.value)&&We(e.name).then(function(e){r(e,function(e){},function(e){Xe.handle(e)})})})},Ze=f.getInstance(),et=e.getInstance(),tt=function(){try{et.debug("Creating new person");var e=Ze.get().apiHost+"/api/v1/client/environments/"+Ze.get().environmentId+"/people";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating person",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},nt=function(e,t){var n=Ze.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},rt=function(e){try{return et.debug("setting userId: "+e),nt("userId",e)?(et.debug("userId already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):(r=Ze.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),r?Promise.resolve(n({code:"attribute_already_exists",message:"userId cannot be changed after it has been set. You need to reset first"})):Promise.resolve(function(e){try{if(!Ze.get().person||!Ze.get().person.id)return Promise.resolve(n({code:"missing_person",message:"Unable to update userId. No person set."}));var r=Ze.get().apiHost+"/api/v1/client/environments/"+Ze.get().environmentId+"/people/"+Ze.get().person.id+"/user-id";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Ze.get().session.id})})).then(function(e){return Promise.resolve(e.json()).then(function(o){return e.ok?t(o):n({code:"network_error",message:"Error updating person",status:e.status,url:r,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){if(!0!==e.ok)return n(e.error);var t=e.value;return Ze.update({person:t.person,settings:t.settings}),{ok:!0,value:void 0}}))}catch(e){return Promise.reject(e)}var r},ot=function(e,o){try{return et.debug("setting attribute: "+e+" to value: "+o),nt(e,o)?(et.debug("attribute already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):Promise.resolve(function(e,r){try{return Ze.get().person&&Ze.get().person.id?Promise.resolve(fetch(Ze.get().apiHost+"/api/v1/client/environments/"+Ze.get().environmentId+"/people/"+Ze.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:r})})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",status:e.status,message:"Error updating person",url:e.url,responseMessage:r.message})})}):Promise.resolve(n({code:"missing_person",message:"Unable to update attribute. No person set."}))}catch(e){return Promise.reject(e)}}(e,o)).then(function(e){var t;return r(e,function(e){Ze.update({person:e.person,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},it=function(){try{return et.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(tt()).then(function(e){var t;return r(e,function(e){Ze.update({person:e.person,session:e.session,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},st=e.getInstance(),at=f.getInstance(),ft=function(){try{if(!at.get().person)return Promise.resolve(n({code:"missing_person",message:"Unable to create session. No person found"}));var e=at.get().apiHost+"/api/v1/client/environments/"+at.get().environmentId+"/sessions";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:at.get().person.id})})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating session",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},lt=function(e){var t=i({},e);return t.expiresAt=Date.now()+36e5,t},ut=function(e){return!e||e.expiresAt<=Date.now()},ct=f.getInstance(),bt=e.getInstance(),dt=function(e){try{var t,r=function(e){return t?e:(bt.debug("Add session event listeners"),function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e,t=function(t){return e?t:(st.debug("Session not expired, extending session"),at.update({session:lt(at.get().session)}),{ok:!0,value:void 0})};st.debug("Checking session");var r=function(){if(ut(at.get().session))return st.debug("Session expired, creating new session"),Promise.resolve(ft()).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}var o=t.value;return at.update({session:o.session,settings:o.settings}),Promise.resolve(We("New Session")).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}return e=1,{ok:!0,value:void 0}})})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}}(),bt.debug("Add page url event listeners"),"undefined"!=typeof window&&(window.addEventListener("hashchange",$e),window.addEventListener("popstate",$e),window.addEventListener("pushstate",$e),window.addEventListener("replacestate",$e),window.addEventListener("load",$e)),bt.debug("Add click event listeners"),"undefined"!=typeof window&&document.addEventListener("click",Ke),bt.debug("Initialized"),{ok:!0,value:void 0})};if(bt.debug("Start initialize"),!e.environmentId)return bt.debug("No environmentId provided"),Promise.resolve(n({code:"missing_field",field:"environmentId"}));if(!e.apiHost)return bt.debug("No apiHost provided"),Promise.resolve(n({code:"missing_field",field:"apiHost"}));e.logLevel&&(bt.debug("Setting log level to "+e.logLevel),bt.configure({logLevel:e.logLevel})),bt.debug("Adding widget container to DOM"),Fe(),bt.debug("Adding styles to DOM"),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs :is(.fb-sr-only){clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-4){margin-right:1rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs :is(.fb-translate-x-28){--tw-translate-x:7rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-end){justify-content:flex-end}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.fb-space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.fb-shadow-lg){--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-shadow-sm){--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-ring-1){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.focus\\:fb-ring-0:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-2:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var o=function(){if(ct.get().session&&ct.get().environmentId===e.environmentId&&ct.get().apiHost===e.apiHost){bt.debug("Found existing configuration. Checking session.");var r=ct.get().session;return function(){if(ut(r))return bt.debug("Session expired. Creating new session."),Promise.resolve(ft()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({session:lt(o.session),settings:i}),Promise.resolve(We("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})});bt.debug("Session valid. Extending session."),ct.update({session:lt(r)})}()}return bt.debug("No valid session found. Creating new config."),ct.update({environmentId:e.environmentId,apiHost:e.apiHost}),bt.debug("Get person, session and settings from server"),Promise.resolve(tt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({person:o.person,session:lt(o.session),settings:i}),Promise.resolve(We("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})})}();return Promise.resolve(o&&o.then?o.then(r):r(o))}catch(e){return Promise.reject(e)}};function pt(e,t,n){if(!e.s){if(n instanceof gt){if(!n.s)return void(n.o=pt.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(pt.bind(null,e,t),pt.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var ht=e.getInstance();const gt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{pt(r,1,e(this.v))}catch(e){pt(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?pt(r,1,t?t(o):o):n?pt(r,1,n(o)):pt(r,2,o)}catch(e){pt(r,2,e)}},r},e}();function mt(e){return e instanceof gt&&1&e.s}var vt=/*#__PURE__*/function(){function e(){this.queue=[],this.running=!1}var t=e.prototype;return t.add=function(e,t){void 0===e&&(e=!0);var n=[].slice.call(arguments,2);ht.debug("Add command to queue: "+t.name+"("+JSON.stringify(n)+")"),this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||this.run()},t.run=function(){try{var e=function(){t.running=!1},t=this;t.running=!0;var r=function(e,t,n){for(var r;;){var o=e();if(mt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!mt(i)){r=1;break}i=i.s}}var s=new gt,a=pt.bind(null,s,2);return(0===r?o.then(l):1===r?i.then(f):(void 0).then(function(){(o=e())?o.then?o.then(l).then(void 0,a):l(o):pt(s,1,i)})).then(void 0,a),s;function f(t){i=t;do{if(!(o=e())||mt(o)&&!o.v)return void pt(s,1,i);if(o.then)return void o.then(l).then(void 0,a);mt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(f).then(void 0,a)}function l(e){e?(i=n())&&i.then?i.then(f).then(void 0,a):f(i):pt(s,1,i)}}(function(){return t.queue.length>0},0,function(){var e=o.getInstance(),r=t.queue.shift();if(r.checkInitialized){var i=(bt.debug("Check if initialized"),ct.get().apiHost&&ct.get().environmentId&&ct.get().person&&ct.get().session&&ct.get().settings&&o.initialized?{ok:!0,value:void 0}:n({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));i&&!0!==i.ok&&e.handle(i.error)}return Promise.resolve(r.command.apply(null,r.commandArgs)).then(function(t){t&&(ht.debug("Command result: "+(!0===t.ok?"OK":"Something went really wrong")+", "+r.command.name),!0!==t.ok&&e.handle(t.error))})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},e}();e.getInstance().debug("Create command queue");var _t=new vt,wt=function(e,t){_t.add(!0,ot,e,t)};module.exports={init:function(e){o.init(e.errorHandler),_t.add(!1,dt,e)},setUserId:function(e){_t.add(!0,rt,e)},setEmail:function(e){wt("email",e)},setAttribute:wt,track:function(e,t){void 0===t&&(t={}),_t.add(!0,We,e,t)},logout:function(){_t.add(!0,it)},refresh:function(){_t.add(!0,qe)},registerRouteChange:function(){_t.add(!0,$e)}};
//# sourceMappingURL=index.js.map

@@ -0,3 +1,4 @@

import type { JsConfig, Survey } from "@formbricks/types/js";
import { VNode } from "preact";
import type { JsConfig, Survey } from "@formbricks/types/js";
import { IErrorHandler } from "./lib/errors";
interface AppProps {

@@ -7,4 +8,5 @@ config: JsConfig;

closeSurvey: () => Promise<void>;
errorHandler: IErrorHandler;
}
export default function App({ config, survey, closeSurvey }: AppProps): VNode;
export default function App({ config, survey, closeSurvey, errorHandler }: AppProps): VNode;
export {};

@@ -0,3 +1,4 @@

import { JsConfig, Survey } from "@formbricks/types/js";
import { h } from "preact";
import { JsConfig, Survey } from "@formbricks/types/js";
import { IErrorHandler } from "../lib/errors";
interface SurveyViewProps {

@@ -8,4 +9,5 @@ config: JsConfig;

brandColor: string;
errorHandler: IErrorHandler;
}
export default function SurveyView({ config, survey, close, brandColor }: SurveyViewProps): h.JSX.Element;
export default function SurveyView({ config, survey, close, brandColor, errorHandler }: SurveyViewProps): h.JSX.Element;
export {};

@@ -1,2 +0,2 @@

function e(n,r,o){if(!n.s){if(o instanceof t){if(!o.s)return void(o.o=e.bind(null,n,r));1&r&&(r=o.s),o=o.v}if(o&&o.then)return void o.then(e.bind(null,n,r),e.bind(null,n,2));n.s=r,n.v=o;var i=n.o;i&&i(n)}}var t=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(n,r){var o=new t,i=this.s;if(i){var s=1&i?n:r;if(s){try{e(o,1,s(this.v))}catch(t){e(o,2,t)}return o}return this}return this.o=function(t){try{var i=t.v;1&t.s?e(o,1,n?n(i):i):r?e(o,1,r(i)):e(o,2,i)}catch(t){e(o,2,t)}},o},t}();function n(e){return e instanceof t&&1&e.s}var r=/*#__PURE__*/function(){function r(){this.queue=[],this.running=!1}var o=r.prototype;return o.add=function(e){this.queue.push(e),this.running||this.run()},o.run=function(){try{var r=function(){o.running=!1},o=this;o.running=!0;var i=function(r,o,i){for(var s;;){var a=r();if(n(a)&&(a=a.v),!a)return f;if(a.then){s=0;break}var f=i();if(f&&f.then){if(!n(f)){s=1;break}f=f.s}}var l=new t,u=e.bind(null,l,2);return(0===s?a.then(c):1===s?f.then(b):(void 0).then(function(){(a=r())?a.then?a.then(c).then(void 0,u):c(a):e(l,1,f)})).then(void 0,u),l;function b(t){f=t;do{if(!(a=r())||n(a)&&!a.v)return void e(l,1,f);if(a.then)return void a.then(c).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(b).then(void 0,u)}function c(t){t?(f=i())&&f.then?f.then(b).then(void 0,u):b(f):e(l,1,f)}}(function(){return o.queue.length>0},0,function(){var e=o.queue.shift(),t=function(t,n){try{var r=Promise.resolve(e()).then(function(){})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){console.error(e)});if(t&&t.then)return t.then(function(){})});return Promise.resolve(i&&i.then?i.then(r):r())}catch(e){return Promise.reject(e)}},r}();function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.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)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,f,l,u,b,c,d,p={},h=[],m=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function g(e,t){for(var n in t)e[n]=t[n];return e}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return w(e,s,r,o,null)}function w(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++l:o};return null==o&&null!=f.vnode&&f.vnode(i),i}function y(e){return e.children}function j(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?x(e):null}function k(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return k(e)}}function C(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!P.__r++||b!==f.debounceRendering)&&((b=f.debounceRendering)||c)(P)}function P(){var e,t,n,r,o,i,s,a;for(u.sort(d);e=u.shift();)e.__d&&(t=u.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=g({},i)).__v=i.__v+1,z(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?x(i):s,i.__h),F(r,i),i.__e!=s&&k(i)),u.length>t&&u.sort(d));P.__r=0}function S(e,t,n,r,o,i,s,a,f,l){var u,b,c,d,m,g,_,v=r&&r.__k||h,j=v.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(d=n.__k[u]=null==(d=t[u])||"boolean"==typeof d||"function"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?w(null,d,null,null,d):Array.isArray(d)?w(y,{children:d},null,null,null):d.__b>0?w(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(c=v[u])||c&&d.key==c.key&&d.type===c.type)v[u]=void 0;else for(b=0;b<j;b++){if((c=v[b])&&d.key==c.key&&d.type===c.type){v[b]=void 0;break}c=null}z(e,d,c=c||p,o,i,s,a,f,l),m=d.__e,(b=d.ref)&&c.ref!=b&&(_||(_=[]),c.ref&&_.push(c.ref,null,d),_.push(b,d.__c||m,d)),null!=m?(null==g&&(g=m),"function"==typeof d.type&&d.__k===c.__k?d.__d=f=N(d,f,e):f=I(e,d,c,v,m,f),"function"==typeof n.type&&(n.__d=f)):f&&c.__e==f&&f.parentNode!=e&&(f=x(c))}for(n.__e=g,u=j;u--;)null!=v[u]&&("function"==typeof n.type&&null!=v[u].__e&&v[u].__e==n.__d&&(n.__d=E(r).nextSibling),A(v[u],v[u]));if(_)for(u=0;u<_.length;u++)U(_[u],_[++u],_[++u])}function N(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?N(r,t,n):I(n,r,r,o,r.__e,t));return t}function I(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function E(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=E(n)))return r;return null}function q(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||m.test(t)?n:n+"px"}function H(e,t,n,r,o){var i;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||q(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||q(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?L:T,i):e.removeEventListener(t,i?L:T,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function T(e){return this.l[e.type+!1](f.event?f.event(e):e)}function L(e){return this.l[e.type+!0](f.event?f.event(e):e)}function z(e,t,n,r,o,i,s,a,l){var u,b,c,d,p,h,m,_,v,w,x,k,C,P,N,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(u=f.__b)&&u(t);try{e:if("function"==typeof I){if(_=t.props,v=(u=I.contextType)&&r[u.__c],w=u?v?v.props.value:u.__:r,n.__c?m=(b=t.__c=n.__c).__=b.__E:("prototype"in I&&I.prototype.render?t.__c=b=new I(_,w):(t.__c=b=new j(_,w),b.constructor=I,b.render=M),v&&v.sub(b),b.props=_,b.state||(b.state={}),b.context=w,b.__n=r,c=b.__d=!0,b.__h=[],b._sb=[]),null==b.__s&&(b.__s=b.state),null!=I.getDerivedStateFromProps&&(b.__s==b.state&&(b.__s=g({},b.__s)),g(b.__s,I.getDerivedStateFromProps(_,b.__s))),d=b.props,p=b.state,b.__v=t,c)null==I.getDerivedStateFromProps&&null!=b.componentWillMount&&b.componentWillMount(),null!=b.componentDidMount&&b.__h.push(b.componentDidMount);else{if(null==I.getDerivedStateFromProps&&_!==d&&null!=b.componentWillReceiveProps&&b.componentWillReceiveProps(_,w),!b.__e&&null!=b.shouldComponentUpdate&&!1===b.shouldComponentUpdate(_,b.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(b.props=_,b.state=b.__s,b.__d=!1),b.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),x=0;x<b._sb.length;x++)b.__h.push(b._sb[x]);b._sb=[],b.__h.length&&s.push(b);break e}null!=b.componentWillUpdate&&b.componentWillUpdate(_,b.__s,w),null!=b.componentDidUpdate&&b.__h.push(function(){b.componentDidUpdate(d,p,h)})}if(b.context=w,b.props=_,b.__P=e,k=f.__r,C=0,"prototype"in I&&I.prototype.render){for(b.state=b.__s,b.__d=!1,k&&k(t),u=b.render(b.props,b.state,b.context),P=0;P<b._sb.length;P++)b.__h.push(b._sb[P]);b._sb=[]}else do{b.__d=!1,k&&k(t),u=b.render(b.props,b.state,b.context),b.state=b.__s}while(b.__d&&++C<25);b.state=b.__s,null!=b.getChildContext&&(r=g(g({},r),b.getChildContext())),c||null==b.getSnapshotBeforeUpdate||(h=b.getSnapshotBeforeUpdate(d,p)),N=null!=u&&u.type===y&&null==u.key?u.props.children:u,S(e,Array.isArray(N)?N:[N],t,n,r,o,i,s,a,l),b.base=t.__e,t.__h=null,b.__h.length&&s.push(b),m&&(b.__E=b.__=null),b.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=O(n.__e,t,n,r,o,i,s,l);(u=f.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=a,t.__h=!!l,i[i.indexOf(a)]=null),f.__e(e,t,n)}}function F(e,t){f.__c&&f.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){f.__e(e,t.__v)}})}function O(e,t,n,r,o,i,s,f){var l,u,b,c=n.props,d=t.props,h=t.type,m=0;if("svg"===h&&(o=!0),null!=i)for(;m<i.length;m++)if((l=i[m])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,i[m]=null;break}if(null==e){if(null===h)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,d.is&&d),i=null,f=!1}if(null===h)c===d||f&&e.data===d||(e.data=d);else{if(i=i&&a.call(e.childNodes),u=(c=n.props||p).dangerouslySetInnerHTML,b=d.dangerouslySetInnerHTML,!f){if(null!=i)for(c={},m=0;m<e.attributes.length;m++)c[e.attributes[m].name]=e.attributes[m].value;(b||u)&&(b&&(u&&b.__html==u.__html||b.__html===e.innerHTML)||(e.innerHTML=b&&b.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||H(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||H(e,i,t[i],n[i],r)}(e,d,c,o,f),b)t.__k=[];else if(m=t.props.children,S(e,Array.isArray(m)?m:[m],t,n,r,o&&"foreignObject"!==h,i,s,i?i[0]:n.__k&&x(n,0),f),null!=i)for(m=i.length;m--;)null!=i[m]&&_(i[m]);f||("value"in d&&void 0!==(m=d.value)&&(m!==e.value||"progress"===h&&!m||"option"===h&&m!==c.value)&&H(e,"value",m,c.value,!1),"checked"in d&&void 0!==(m=d.checked)&&m!==e.checked&&H(e,"checked",m,c.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){f.__e(e,n)}}function A(e,t,n){var r,o;if(f.unmount&&f.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){f.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&A(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||_(e.__e),e.__=e.__e=e.__d=void 0}function M(e,t,n){return this.constructor(e,n)}a=h.slice,f={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},l=0,j.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),C(this))},j.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),C(this))},j.prototype.render=y,u=[],c="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,d=function(e,t){return e.__v.__b-t.__v.__b},P.__r=0;var D,W,B,Q,J=0,Y=[],R=[],V=f.__b,X=f.__r,$=f.diffed,G=f.__c,K=f.unmount;function Z(e,t){f.__h&&f.__h(W,e,J||t),J=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:R}),n.__[e]}function ee(e){return J=1,function(e,t,n){var r=Z(D++,2);if(r.t=e,!r.__c&&(r.__=[ae(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},W.shouldComponentUpdate=o}return r.__N||r.__}(ae,e)}function te(e,t){var n=Z(D++,3);!f.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.i=t,W.__H.__h.push(n))}function ne(){for(var e;e=Y.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ie),e.__H.__h.forEach(se),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){W=null,V&&V(e)},f.__r=function(e){X&&X(e),D=0;var t=(W=e.__c).__H;t&&(B===W?(t.__h=[],W.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=R,e.__N=e.i=void 0})):(t.__h.forEach(ie),t.__h.forEach(se),t.__h=[])),B=W},f.diffed=function(e){$&&$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Y.push(t)&&Q===f.requestAnimationFrame||((Q=f.requestAnimationFrame)||oe)(ne)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==R&&(e.__=e.__V),e.i=void 0,e.__V=R})),B=W=null},f.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ie),e.__h=e.__h.filter(function(e){return!e.__||se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],f.__e(n,e.__v)}}),G&&G(e,t)},f.unmount=function(e){K&&K(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ie(e)}catch(e){t=e}}),n.__H=void 0,t&&f.__e(t,n.__v))};var re="function"==typeof requestAnimationFrame;function oe(e){var t,n=function(){clearTimeout(r),re&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);re&&(t=requestAnimationFrame(n))}function ie(e){var t=W,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),W=t}function se(e){var t=W;e.__c=e.__(),W=t}function ae(e,t){return"function"==typeof t?t(e):t}var fe=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function le(e){var t=e.children,n=e.isOpen,r=e.close,o=ee(!1),i=o[0],s=o[1];return te(function(){s(n)},[n]),v("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},v("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},v("div",{className:fe(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out fb-m-4")},v("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},v("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},v("span",{class:"fb-sr-only"},"Close"),v("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),v("div",{className:""},t))))}var ue=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){if(!e.ok)throw new Error("Could not update display")})}catch(e){return Promise.reject(e)}},be=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/responses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}};function ce(e){return v("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},v("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function de(e){return v("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function pe(e){return v("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function he(e){var t=e.headline,n=e.subheader;return v("div",{className:"fb-text-center"},v("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},v("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),v("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),v("div",null,v(de,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),v(pe,{subheader:n,questionId:"thankYouCard"})))}function me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ge(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return v("label",{key:e.id,className:fe(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},checked:s===e.label,style:{borderColor:o,color:o},required:t.required&&0===n}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function _e(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee([]),s=i[0],a=i[1],f=function(){return s.length>0};return v("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return v("label",{key:e.id,className:fe(s.includes(e.label)?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 hover:fb-bg-slate-50 focus:fb-outline-none")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"checkbox",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.checked?[].concat(s,[e.currentTarget.value]):s.filter(function(t){return t!==e.currentTarget.value}))},checked:s.includes(e.label),style:{borderColor:o,color:o}}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:t.required,value:f()?"checked":""}),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-my-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return v("label",{key:e,className:fe(s===e?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},v("input",{type:"radio",name:"nps",value:e,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:function(){return a(e)},required:t.required}),e)})),v("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},v("p",null,t.lowerLabel),v("p",null,t.upperLabel)))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function we(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=s(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=s(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=s(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function ye(e){return v("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:we(e.htmlString)}})}function je(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return v("div",null,v(de,{headline:t.headline,questionId:t.id}),v(ye,{htmlString:t.html,questionId:t.id}),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},v("div",null),!t.required&&v("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),v("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?v(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?v(ge,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?v(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?v(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?v(je,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function ke(e){var t,n=e.config,r=e.survey,o=e.close,i=e.brandColor,s=ee(r.questions[0].id),a=s[0],f=s[1],l=ee(0),u=l[0],b=l[1],c=ee(null),d=c[0],p=c[1],h=ee(null),m=h[0],g=h[1],_=ee(!1),w=_[0],y=_[1];te(function(){!function(){try{Promise.resolve(function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create display");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}({surveyId:r.id,personId:n.person.id},n)).then(function(e){g(e.id)})}catch(e){return Promise.reject(e)}}()},[n,r]),te(function(){var e;b((e=r.questions.findIndex(function(e){return e.id===a}),e/r.questions.length))},[a,r]);var j=function(e){try{var t=function(){y(!1),s?(b(100),r.thankYouCard.enabled?setTimeout(function(){o()},2e3):o()):f(r.questions[i+1].id)};y(!0);var i=r.questions.findIndex(function(e){return e.id===a}),s=i===r.questions.length-1,l={surveyId:r.id,personId:n.person.id,response:{finished:s,data:e}},u=d?Promise.resolve(function(e,t,n){try{return Promise.resolve(fetch(n.apiHost+"/api/v1/client/environments/"+n.environmentId+"/responses/"+t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw new Error("Could not update response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}(l,d,n)).then(function(){}):Promise.resolve(Promise.all([be(l,n),ue(m,n)])).then(function(e){p(e[0].id)});return Promise.resolve(u&&u.then?u.then(t):t())}catch(e){return Promise.reject(e)}};return v("div",null,v("div",{className:fe(w?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===u&&r.thankYouCard.enabled?v(he,{headline:r.thankYouCard.headline,subheader:r.thankYouCard.subheader,brandColor:null==(t=n.settings)?void 0:t.brandColor}):r.questions.map(function(e,t){return a===e.id&&v(xe,{key:e.id,brandColor:i,lastQuestion:t===r.questions.length-1,onSubmit:j,question:e})})),v(ce,{progress:u,brandColor:i}))}function Ce(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=ee(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return v("div",{id:"fbjs"},v(le,{isOpen:i[0],close:a},v(ke,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var Pe=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=o({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){localStorage.setItem("formbricksConfig",JSON.stringify(this.config))},e}();Pe.instance=void 0;var Se=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();Se.instance=void 0;var Ne=Se.getInstance(),Ie=Pe.getInstance(),Ee=function(){try{return Promise.resolve(fetch(Ie.get().apiHost+"/api/v1/client/environments/"+Ie.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Ie.get().person.id})})).then(function(e){if(!e.ok)throw Ne.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},qe="formbricks-web-container",He=Pe.getInstance(),Te=Se.getInstance(),Le=!1,ze=function(e){Le?Te.debug("A survey is already running. Skipping."):(Le=!0,function(e,t,n){var r,o;f.__&&f.__(e,t),r=t.__k,o=[],z(t,e=t.__k=v(y,null,[e]),r||p,p,void 0!==t.ownerSVGElement,r?null:t.firstChild?a.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),F(o,e)}(v(Ce,{config:He.get(),survey:e,closeSurvey:Fe}),document.getElementById(qe)))},Fe=function(){try{return document.getElementById(qe).remove(),Oe(),Promise.resolve(Ee()).then(function(e){He.update({settings:e}),Le=!1})}catch(e){return Promise.reject(e)}},Oe=function(){var e=document.createElement("div");e.id=qe,document.body.appendChild(e)},Ue=Se.getInstance(),Ae=Pe.getInstance(),Me=function(e,t){try{return Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Ae.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;Ue.debug('Formbricks: Event "'+e+'" tracked'),De(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){Ue.error("Formbricks: Error tracking event: "+JSON.stringify(e)),n=1})}();return o&&o.then?o.then(r):r(o)})}catch(e){return Promise.reject(e)}},De=function(e){for(var t,n=s(null==(r=Ae.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,a=s(i.triggers);!(o=a()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return Ue.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void ze(i)}},We=Pe.getInstance(),Be=Se.getInstance(),Qe=function(){try{return Be.debug("Creating new person"),Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/people",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){return e.ok?Promise.resolve(e.json()):(console.error("Formbricks: Error fetching person"),null)})}catch(e){return Promise.reject(e)}},Je=function(e,t){var n=We.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Ye=Se.getInstance(),Re=Pe.getInstance(),Ve=function(){try{return Re.get().person?Promise.resolve(fetch(Re.get().apiHost+"/api/v1/client/environments/"+Re.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Re.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Ye.error("Error creating session")}):(Ye.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},Xe=function(e){var t=o({},e);return t.expiresAt=Date.now()+36e5,t},$e=function(e){return!e||e.expiresAt<=Date.now()},Ge=Pe.getInstance(),Ke=Se.getInstance(),Ze=function(){var e=Ge.get().settings,t=null==e?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Ke.debug("checking page url"),0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&et(window.location.href,i.value,i.rule)&&Me(o.name)}};function et(e,t,n){switch(n){case"exactMatch":return e===t;case"contains":return e.includes(t);case"startsWith":return e.startsWith(t);case"endsWith":return e.endsWith(t);case"notMatch":return e!==t;case"notContains":return!e.includes(t);default:throw new Error("Invalid match type")}}var tt=function(e){var t=Ge.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&o.innerHTML===n.value&&Me(e.name)}),r.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&o.matches(n.value)&&Me(e.name)})},nt=Pe.getInstance(),rt=Se.getInstance(),ot=function(){if(!(nt.get().apiHost&&nt.get().environmentId&&nt.get().person&&nt.get().session&&nt.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},it=new r,st=function(e,t){it.add(function(){try{return ot(),Promise.resolve(function(e,t){try{return Be.debug("setting attribute: "+e+" to value: "+t),Je(e,t)?(Be.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return We.get().person&&We.get().person.id?Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/people/"+We.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})})).then(function(e){return Promise.resolve(e.json()).then(function(t){if(!e.ok)throw Be.error("Error updating person"),Error("Error updating person");return t})}):(console.error("Formbricks: Unable to update attribute. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e,t)).then(function(e){var t=e.person,n=e.settings;if(!t||!n)throw Be.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");We.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},at={init:function(e){it.add(function(){try{return function(e){try{var t=function(){(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Ye.debug("Session not expired, extending session"),Re.update({session:Xe(Re.get().session)})};Ye.debug("Checking session");var t=function(){if($e(Re.get().session))return Ye.debug("Session expired, creating new session"),Promise.resolve(Ve()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Ye.error("Error creating new session"),Error("Error creating new session");Re.update({session:t,settings:n}),Me("New Session")})}();return Promise.resolve(t&&t.then?t.then(e):e())}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ze),window.addEventListener("popstate",Ze),window.addEventListener("pushstate",Ze),window.addEventListener("replacestate",Ze),window.addEventListener("load",Ze)),"undefined"!=typeof window&&document.addEventListener("click",tt),rt.debug("Initialized")};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&rt.configure({logLevel:e.logLevel}),Oe(),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs :is(.fb-sr-only){clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-4){margin-right:1rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs :is(.fb-translate-x-28){--tw-translate-x:7rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-end){justify-content:flex-end}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.fb-space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.fb-shadow-lg){--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-shadow-sm){--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-ring-1){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.focus\\:fb-ring-0:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-2:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var n=function(){if(!nt.get().session||nt.get().environmentId!==e.environmentId||nt.get().apiHost!==e.apiHost)return rt.debug("No valid session found. Creating new config."),nt.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Qe()).then(function(e){var t=e.settings;nt.update({person:e.person,session:Xe(e.session),settings:t}),Me("New Session")});rt.debug("Found existing configuration. Checking session.");var t=nt.get().session,n=function(){if($e(t))return rt.debug("Session expired. Creating new session."),Promise.resolve(Ve()).then(function(e){var t=e.settings;nt.update({session:Xe(e.session),settings:t}),Me("New Session")});rt.debug("Session valid. Extending session."),nt.update({session:Xe(t)})}();return n&&n.then?n.then(function(){}):void 0}();Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){it.add(function(){try{return ot(),Promise.resolve(function(e){try{return Be.debug("setting userId: "+e),Je("userId",e)?(Be.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=We.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Be.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return We.get().person&&We.get().person.id?Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/people/"+We.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:We.get().session.id})})).then(function(e){if(!e.ok)throw Be.error("Formbricks: Error updating person"),Error("Error updating person");return Promise.resolve(e.json())}):(console.error("Formbricks: Unable to update userId. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e)).then(function(e){We.update({person:e.person,settings:e.settings})}))}catch(e){return Promise.reject(e)}var t}(e)).then(function(){})}catch(e){return Promise.reject(e)}})},setEmail:function(e){st("email",e)},setAttribute:st,track:function(e,t){void 0===t&&(t={}),it.add(function(){try{return ot(),Promise.resolve(Me(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){it.add(function(){try{return ot(),Promise.resolve(function(){try{return Be.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Qe()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Be.error("Error resetting user"),new Error("Formbricks: Error resetting user");We.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){it.add(function(){try{return ot(),Promise.resolve(function(){try{return Ne.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){Ie.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){it.add(function(){try{return ot(),Ze(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};module.exports=at;
var e=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();e.instance=void 0;var t=function(e){return{ok:!0,value:e}},n=function(e){return{ok:!1,error:e}};function r(e,t,n){return!0===e.ok?t(e.value):n(e.error)}e.getInstance();var o=/*#__PURE__*/function(){function t(t){this.handleError=void 0,this.handleError=t||function(t){return e.getInstance().error(JSON.stringify(t))}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.init=function(e){this.initialized=!0,console.log("🧱 Formbricks - initializing error handler"),console.log("🧱 Formbricks - Custom error handler: ","function"==typeof e?"yes":"no"),t.instance=new t(e)},t.prototype.handle=function(e){this.handleError(e)},t}();function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.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)?s(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}o.instance=void 0,o.initialized=!1;var f=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=i({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){var e,t=this;return(e=function(){return localStorage.setItem("formbricksConfig",JSON.stringify(t.config))},function(){try{return{ok:!0,value:e.apply(void 0,[].slice.call(arguments))}}catch(e){return{ok:!1,error:e}}})()},e}();f.instance=void 0;var l,u,c,b,d,p,h,g={},m=[],v=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function _(e,t){for(var n in t)e[n]=t[n];return e}function w(e){var t=e.parentNode;t&&t.removeChild(e)}function y(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?l.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return j(e,s,r,o,null)}function j(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++c:o};return null==o&&null!=u.vnode&&u.vnode(i),i}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?C(e):null}function S(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return S(e)}}function P(e){(!e.__d&&(e.__d=!0)&&b.push(e)&&!I.__r++||d!==u.debounceRendering)&&((d=u.debounceRendering)||p)(I)}function I(){var e,t,n,r,o,i,s,a;for(b.sort(h);e=b.shift();)e.__d&&(t=b.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=_({},i)).__v=i.__v+1,A(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?C(i):s,i.__h),O(r,i),i.__e!=s&&S(i)),b.length>t&&b.sort(h));I.__r=0}function N(e,t,n,r,o,i,s,a,f,l){var u,c,b,d,p,h,v,_=r&&r.__k||m,w=_.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(d=n.__k[u]=null==(d=t[u])||"boolean"==typeof d||"function"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?j(null,d,null,null,d):Array.isArray(d)?j(x,{children:d},null,null,null):d.__b>0?j(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(b=_[u])||b&&d.key==b.key&&d.type===b.type)_[u]=void 0;else for(c=0;c<w;c++){if((b=_[c])&&d.key==b.key&&d.type===b.type){_[c]=void 0;break}b=null}A(e,d,b=b||g,o,i,s,a,f,l),p=d.__e,(c=d.ref)&&b.ref!=c&&(v||(v=[]),b.ref&&v.push(b.ref,null,d),v.push(c,d.__c||p,d)),null!=p?(null==h&&(h=p),"function"==typeof d.type&&d.__k===b.__k?d.__d=f=E(d,f,e):f=q(e,d,b,_,p,f),"function"==typeof n.type&&(n.__d=f)):f&&b.__e==f&&f.parentNode!=e&&(f=C(b))}for(n.__e=h,u=w;u--;)null!=_[u]&&("function"==typeof n.type&&null!=_[u].__e&&_[u].__e==n.__d&&(n.__d=H(r).nextSibling),D(_[u],_[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function E(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?E(r,t,n):q(n,r,r,o,r.__e,t));return t}function q(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function H(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=H(n)))return r;return null}function T(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||v.test(t)?n:n+"px"}function z(e,t,n,r,o){var i;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||T(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||T(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?M:L,i):e.removeEventListener(t,i?M:L,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function L(e){return this.l[e.type+!1](u.event?u.event(e):e)}function M(e){return this.l[e.type+!0](u.event?u.event(e):e)}function A(e,t,n,r,o,i,s,a,f){var l,c,b,d,p,h,g,m,v,w,y,j,C,S,P,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(f=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(l=u.__b)&&l(t);try{e:if("function"==typeof I){if(m=t.props,v=(l=I.contextType)&&r[l.__c],w=l?v?v.props.value:l.__:r,n.__c?g=(c=t.__c=n.__c).__=c.__E:("prototype"in I&&I.prototype.render?t.__c=c=new I(m,w):(t.__c=c=new k(m,w),c.constructor=I,c.render=W),v&&v.sub(c),c.props=m,c.state||(c.state={}),c.context=w,c.__n=r,b=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=I.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=_({},c.__s)),_(c.__s,I.getDerivedStateFromProps(m,c.__s))),d=c.props,p=c.state,c.__v=t,b)null==I.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==I.getDerivedStateFromProps&&m!==d&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(m,w),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(m,c.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=m,c.state=c.__s,c.__d=!1),c.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),y=0;y<c._sb.length;y++)c.__h.push(c._sb[y]);c._sb=[],c.__h.length&&s.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(m,c.__s,w),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(d,p,h)})}if(c.context=w,c.props=m,c.__P=e,j=u.__r,C=0,"prototype"in I&&I.prototype.render){for(c.state=c.__s,c.__d=!1,j&&j(t),l=c.render(c.props,c.state,c.context),S=0;S<c._sb.length;S++)c.__h.push(c._sb[S]);c._sb=[]}else do{c.__d=!1,j&&j(t),l=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++C<25);c.state=c.__s,null!=c.getChildContext&&(r=_(_({},r),c.getChildContext())),b||null==c.getSnapshotBeforeUpdate||(h=c.getSnapshotBeforeUpdate(d,p)),P=null!=l&&l.type===x&&null==l.key?l.props.children:l,N(e,Array.isArray(P)?P:[P],t,n,r,o,i,s,a,f),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),g&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=F(n.__e,t,n,r,o,i,s,f);(l=u.diffed)&&l(t)}catch(e){t.__v=null,(f||null!=i)&&(t.__e=a,t.__h=!!f,i[i.indexOf(a)]=null),u.__e(e,t,n)}}function O(e,t){u.__c&&u.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u.__e(e,t.__v)}})}function F(e,t,n,r,o,i,s,a){var f,u,c,b=n.props,d=t.props,p=t.type,h=0;if("svg"===p&&(o=!0),null!=i)for(;h<i.length;h++)if((f=i[h])&&"setAttribute"in f==!!p&&(p?f.localName===p:3===f.nodeType)){e=f,i[h]=null;break}if(null==e){if(null===p)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,d.is&&d),i=null,a=!1}if(null===p)b===d||a&&e.data===d||(e.data=d);else{if(i=i&&l.call(e.childNodes),u=(b=n.props||g).dangerouslySetInnerHTML,c=d.dangerouslySetInnerHTML,!a){if(null!=i)for(b={},h=0;h<e.attributes.length;h++)b[e.attributes[h].name]=e.attributes[h].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||z(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||z(e,i,t[i],n[i],r)}(e,d,b,o,a),c)t.__k=[];else if(h=t.props.children,N(e,Array.isArray(h)?h:[h],t,n,r,o&&"foreignObject"!==p,i,s,i?i[0]:n.__k&&C(n,0),a),null!=i)for(h=i.length;h--;)null!=i[h]&&w(i[h]);a||("value"in d&&void 0!==(h=d.value)&&(h!==e.value||"progress"===p&&!h||"option"===p&&h!==b.value)&&z(e,"value",h,b.value,!1),"checked"in d&&void 0!==(h=d.checked)&&h!==e.checked&&z(e,"checked",h,b.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){u.__e(e,n)}}function D(e,t,n){var r,o;if(u.unmount&&u.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){u.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&D(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||w(e.__e),e.__=e.__e=e.__d=void 0}function W(e,t,n){return this.constructor(e,n)}l=m.slice,u={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},c=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=_({},this.state),"function"==typeof e&&(e=e(_({},n),this.props)),e&&_(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),P(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),P(this))},k.prototype.render=x,b=[],p="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0;var J,B,Q,Y,R=0,V=[],G=[],X=u.__b,$=u.__r,K=u.diffed,Z=u.__c,ee=u.unmount;function te(e,t){u.__h&&u.__h(B,e,R||t),R=0;var n=B.__H||(B.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:G}),n.__[e]}function ne(e){return R=1,function(e,t,n){var r=te(J++,2);if(r.t=e,!r.__c&&(r.__=[le(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=B,!B.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};B.u=!0;var i=B.shouldComponentUpdate,s=B.componentWillUpdate;B.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},B.shouldComponentUpdate=o}return r.__N||r.__}(le,e)}function re(e,t){var n=te(J++,3);!u.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.i=t,B.__H.__h.push(n))}function oe(){for(var e;e=V.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ae),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){B=null,X&&X(e)},u.__r=function(e){$&&$(e),J=0;var t=(B=e.__c).__H;t&&(Q===B?(t.__h=[],B.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=G,e.__N=e.i=void 0})):(t.__h.forEach(ae),t.__h.forEach(fe),t.__h=[])),Q=B},u.diffed=function(e){K&&K(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==V.push(t)&&Y===u.requestAnimationFrame||((Y=u.requestAnimationFrame)||se)(oe)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==G&&(e.__=e.__V),e.i=void 0,e.__V=G})),Q=B=null},u.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ae),e.__h=e.__h.filter(function(e){return!e.__||fe(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],u.__e(n,e.__v)}}),Z&&Z(e,t)},u.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ae(e)}catch(e){t=e}}),n.__H=void 0,t&&u.__e(t,n.__v))};var ie="function"==typeof requestAnimationFrame;function se(e){var t,n=function(){clearTimeout(r),ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ie&&(t=requestAnimationFrame(n))}function ae(e){var t=B,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),B=t}function fe(e){var t=B;e.__c=e.__(),B=t}function le(e,t){return"function"==typeof t?t(e):t}var ue=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function ce(e){var t=e.children,n=e.isOpen,r=e.close,o=ne(!1),i=o[0],s=o[1];return re(function(){s(n)},[n]),y("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},y("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},y("div",{className:ue(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out fb-m-4")},y("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},y("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},y("span",{class:"fb-sr-only"},"Close"),y("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),y("div",{className:""},t))))}var be=function(e,t){try{var r=t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){var t;function o(e){return t?e:{ok:!0,value:void 0}}var i=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(o){var i=n({code:"network_error",message:"Could not mark display as responded",status:e.status,url:r,responseMessage:o.message});return t=1,i})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},de=function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/responses";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not create response",status:e.status,url:o,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}};function pe(e){return y("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},y("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function he(e){return y("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function ge(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return y("label",{key:e.id,className:ue(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},checked:s===e.label,style:{borderColor:o,color:o},required:t.required&&0===n}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function _e(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne([]),s=i[0],a=i[1],f=function(){return s.length>0};return y("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return y("label",{key:e.id,className:ue(s.includes(e.label)?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 hover:fb-bg-slate-50 focus:fb-outline-none")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("input",{type:"checkbox",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.checked?[].concat(s,[e.currentTarget.value]):s.filter(function(t){return t!==e.currentTarget.value}))},checked:s.includes(e.label),style:{borderColor:o,color:o}}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:t.required,value:f()?"checked":""}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return y("label",{key:e,className:ue(s===e?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},y("input",{type:"radio",name:"nps",value:e,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:function(){return a(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ye(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=a(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=a(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=a(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function je(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:ye(e.htmlString)}})}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("div",null,y(he,{headline:t.headline,questionId:t.id}),y(je,{htmlString:t.html,questionId:t.id}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},y("div",null),!t.required&&y("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),y("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ke(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?y(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?y(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?y(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?y(we,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?y(xe,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function Ce(e){var t=e.headline,n=e.subheader;return y("div",{className:"fb-text-center"},y("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),y("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),y("div",null,y(he,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),y(ge,{subheader:n,questionId:"thankYouCard"})))}function Se(r){var o,i=r.config,s=r.survey,a=r.close,f=r.brandColor,l=r.errorHandler,u=ne(s.questions[0].id),c=u[0],b=u[1],d=ne(0),p=d[0],h=d[1],g=ne(null),m=g[0],v=g[1],_=ne(null),w=_[0],j=_[1],x=ne(!1),k=x[0],C=x[1];re(function(){!function(){try{Promise.resolve(function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/displays";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){var r;function i(n){return r?n:Promise.resolve(e.json()).then(t)}var s=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(t){var i=n({code:"network_error",message:"Could not create display",status:e.status,url:o,responseMessage:t.message});return r=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}}({surveyId:s.id,personId:i.person.id},i)).then(function(e){!0===e.ok?j(e.value.id):l(e.error)})}catch(e){return Promise.reject(e)}}()},[i,s,l]),re(function(){var e;h((e=s.questions.findIndex(function(e){return e.id===c}),e/s.questions.length))},[c,s]);var S=function(r){try{var o=function(){C(!1),u?(h(100),s.thankYouCard.enabled?setTimeout(function(){a()},2e3):a()):b(s.questions[f+1].id)};C(!0);var f=s.questions.findIndex(function(e){return e.id===c}),u=f===s.questions.length-1,d={surveyId:s.id,personId:i.person.id,response:{finished:u,data:r}},p=m?Promise.resolve(function(e,r,o){try{var i=o.apiHost+"/api/v1/client/environments/"+o.environmentId+"/responses/"+r;return Promise.resolve(fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not update response",status:e.status,url:i,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}}(d,m,i)).then(function(t){!0!==t.ok?l(t.error):d.response.finished&&e.getInstance().debug("Submitted response")}):Promise.resolve(Promise.all([de(d,i),be(w,i)])).then(function(e){var t=e[0];!0===t.ok?v(t.value.id):l(t.error)});return Promise.resolve(p&&p.then?p.then(o):o())}catch(e){return Promise.reject(e)}};return y("div",null,y("div",{className:ue(k?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===p&&s.thankYouCard.enabled?y(Ce,{headline:s.thankYouCard.headline,subheader:s.thankYouCard.subheader,brandColor:null==(o=i.settings)?void 0:o.brandColor}):s.questions.map(function(e,t){return c===e.id&&y(ke,{key:e.id,brandColor:f,lastQuestion:t===s.questions.length-1,onSubmit:S,question:e})})),y(pe,{progress:p,brandColor:f}))}function Pe(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=e.errorHandler,s=ne(!0),a=s[1],f=function(){a(!1),setTimeout(function(){o()},1e3)};return y("div",{id:"fbjs"},y(ce,{isOpen:s[0],close:f},y(Se,{config:n,survey:r,close:f,brandColor:null==(t=n.settings)?void 0:t.brandColor,errorHandler:i})))}var Ie=e.getInstance(),Ne=f.getInstance(),Ee=function(){try{var e=Ne.get().apiHost+"/api/v1/client/environments/"+Ne.get().environmentId+"/settings";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Ne.get().person.id})})).then(function(r){var o;function i(e){return o?e:Promise.resolve(r.json()).then(t)}var s=function(){if(!r.ok)return Promise.resolve(r.json()).then(function(t){var i=n({code:"network_error",status:r.status,message:"Error getting settings",url:e,responseMessage:t.message});return o=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}},qe=function(){try{return Ie.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){return!0!==e.ok?n(e.error):(Ie.debug("Settings refreshed"),Ne.update({settings:e.value}),{ok:!0,value:void 0})})}catch(e){return Promise.reject(e)}},He="formbricks-web-container",Te=f.getInstance(),ze=e.getInstance(),Le=o.getInstance(),Me=!1,Ae=function(e){Me?ze.debug("A survey is already running. Skipping."):(Me=!0,function(e,t,n){var r,o;u.__&&u.__(e,t),r=t.__k,o=[],A(t,e=t.__k=y(x,null,[e]),r||g,g,void 0!==t.ownerSVGElement,r?null:t.firstChild?l.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),O(o,e)}(y(Pe,{config:Te.get(),survey:e,closeSurvey:Oe,errorHandler:Le.handle}),document.getElementById(He)))},Oe=function(){try{return document.getElementById(He).remove(),Fe(),Promise.resolve(Ee()).then(function(e){r(e,function(e){Te.update({settings:e}),Me=!1},function(e){Le.handle(e)})})}catch(e){return Promise.reject(e)}},Fe=function(){var e=document.createElement("div");e.id=He,document.body.appendChild(e)},Ue=e.getInstance(),De=f.getInstance(),We=function(e,t){try{return Promise.resolve(fetch(De.get().apiHost+"/api/v1/client/environments/"+De.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:De.get().session.id,eventName:e,properties:t})})).then(function(t){var r;function o(t){return r?t:(Ue.debug('Formbricks: Event "'+e+'" tracked'),Je(e),{ok:!0,value:void 0})}var i=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){var o=n({code:"network_error",message:"Error tracking event: "+JSON.stringify(e),status:t.status,url:t.url,responseMessage:e.message});return r=1,o})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},Je=function(e){for(var t,n=a(null==(r=De.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,s=a(i.triggers);!(o=s()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return Ue.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ae(i)}},Be="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Qe(e,t,n){if(!e.s){if(n instanceof Ye){if(!n.s)return void(n.o=Qe.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Qe.bind(null,e,t),Qe.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Ye=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Qe(r,1,i(this.v))}catch(e){Qe(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Qe(r,1,t?t(o):o):n?Qe(r,1,n(o)):Qe(r,2,o)}catch(e){Qe(r,2,e)}},r},e}();function Re(e){return e instanceof Ye&&1&e.s}var Ve=f.getInstance(),Ge=e.getInstance(),Xe=o.getInstance(),$e=function(){try{var e,r=function(t){return e?t:{ok:!0,value:void 0}};Ge.debug("checking page url");var o=Ve.get().settings,i=null==o?void 0:o.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0===i.length)return Promise.resolve({ok:!0,value:void 0});var s=function(e,t,n){if("function"==typeof e[Be]){var r,o,i,s=e[Be]();if(function e(a){try{for(;!((r=s.next()).done||n&&n());)if((a=t(r.value))&&a.then){if(!Re(a))return void a.then(e,i||(i=Qe.bind(null,o=new Ye,2)));a=a.v}o?Qe(o,1,a):o=a}catch(e){Qe(o||(o=new Ye),2,e)}}(),s.return){var a=function(e){try{r.done||s.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<e.length;l++)f.push(e[l]);return function(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!Re(a))return void a.then(s,o||(o=Qe.bind(null,r=new Ye,2)));a=a.v}r?Qe(r,1,a):r=a}catch(e){Qe(r||(r=new Ye),2,e)}}(),r}(f,function(e){return t(f[e])},n)}(i,function(r){var o=r.noCodeConfig.pageUrl;if(o){var i=function(e,r,o){var i,s;switch(o){case"exactMatch":i=e===r;break;case"contains":i=e.includes(r);break;case"startsWith":i=e.startsWith(r);break;case"endsWith":i=e.endsWith(r);break;case"notMatch":i=e!==r;break;case"notContains":i=!e.includes(r);break;default:s=n({code:"invalid_match_type",message:"Invalid match type"})}return s||t(i)}(window.location.href,o.value,o.rule);if(!0!==i.ok){var s=n(i.error);return e=1,s}if(!1!==i.value)return Promise.resolve(We(r.name)).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}})}},function(){return e});return Promise.resolve(s&&s.then?s.then(r):r(s))}catch(e){return Promise.reject(e)}},Ke=function(e){var t=Ve.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),i=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&i.innerHTML===n.value&&We(e.name).then(function(e){r(e,function(e){},function(e){Xe.handle(e)})})}),o.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&i.matches(n.value)&&We(e.name).then(function(e){r(e,function(e){},function(e){Xe.handle(e)})})})},Ze=f.getInstance(),et=e.getInstance(),tt=function(){try{et.debug("Creating new person");var e=Ze.get().apiHost+"/api/v1/client/environments/"+Ze.get().environmentId+"/people";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating person",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},nt=function(e,t){var n=Ze.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},rt=function(e){try{return et.debug("setting userId: "+e),nt("userId",e)?(et.debug("userId already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):(r=Ze.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),r?Promise.resolve(n({code:"attribute_already_exists",message:"userId cannot be changed after it has been set. You need to reset first"})):Promise.resolve(function(e){try{if(!Ze.get().person||!Ze.get().person.id)return Promise.resolve(n({code:"missing_person",message:"Unable to update userId. No person set."}));var r=Ze.get().apiHost+"/api/v1/client/environments/"+Ze.get().environmentId+"/people/"+Ze.get().person.id+"/user-id";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Ze.get().session.id})})).then(function(e){return Promise.resolve(e.json()).then(function(o){return e.ok?t(o):n({code:"network_error",message:"Error updating person",status:e.status,url:r,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){if(!0!==e.ok)return n(e.error);var t=e.value;return Ze.update({person:t.person,settings:t.settings}),{ok:!0,value:void 0}}))}catch(e){return Promise.reject(e)}var r},ot=function(e,o){try{return et.debug("setting attribute: "+e+" to value: "+o),nt(e,o)?(et.debug("attribute already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):Promise.resolve(function(e,r){try{return Ze.get().person&&Ze.get().person.id?Promise.resolve(fetch(Ze.get().apiHost+"/api/v1/client/environments/"+Ze.get().environmentId+"/people/"+Ze.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:r})})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",status:e.status,message:"Error updating person",url:e.url,responseMessage:r.message})})}):Promise.resolve(n({code:"missing_person",message:"Unable to update attribute. No person set."}))}catch(e){return Promise.reject(e)}}(e,o)).then(function(e){var t;return r(e,function(e){Ze.update({person:e.person,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},it=function(){try{return et.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(tt()).then(function(e){var t;return r(e,function(e){Ze.update({person:e.person,session:e.session,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},st=e.getInstance(),at=f.getInstance(),ft=function(){try{if(!at.get().person)return Promise.resolve(n({code:"missing_person",message:"Unable to create session. No person found"}));var e=at.get().apiHost+"/api/v1/client/environments/"+at.get().environmentId+"/sessions";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:at.get().person.id})})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating session",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},lt=function(e){var t=i({},e);return t.expiresAt=Date.now()+36e5,t},ut=function(e){return!e||e.expiresAt<=Date.now()},ct=f.getInstance(),bt=e.getInstance(),dt=function(e){try{var t,r=function(e){return t?e:(bt.debug("Add session event listeners"),function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e,t=function(t){return e?t:(st.debug("Session not expired, extending session"),at.update({session:lt(at.get().session)}),{ok:!0,value:void 0})};st.debug("Checking session");var r=function(){if(ut(at.get().session))return st.debug("Session expired, creating new session"),Promise.resolve(ft()).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}var o=t.value;return at.update({session:o.session,settings:o.settings}),Promise.resolve(We("New Session")).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}return e=1,{ok:!0,value:void 0}})})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}}(),bt.debug("Add page url event listeners"),"undefined"!=typeof window&&(window.addEventListener("hashchange",$e),window.addEventListener("popstate",$e),window.addEventListener("pushstate",$e),window.addEventListener("replacestate",$e),window.addEventListener("load",$e)),bt.debug("Add click event listeners"),"undefined"!=typeof window&&document.addEventListener("click",Ke),bt.debug("Initialized"),{ok:!0,value:void 0})};if(bt.debug("Start initialize"),!e.environmentId)return bt.debug("No environmentId provided"),Promise.resolve(n({code:"missing_field",field:"environmentId"}));if(!e.apiHost)return bt.debug("No apiHost provided"),Promise.resolve(n({code:"missing_field",field:"apiHost"}));e.logLevel&&(bt.debug("Setting log level to "+e.logLevel),bt.configure({logLevel:e.logLevel})),bt.debug("Adding widget container to DOM"),Fe(),bt.debug("Adding styles to DOM"),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs :is(.fb-sr-only){clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-4){margin-right:1rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs :is(.fb-translate-x-28){--tw-translate-x:7rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-end){justify-content:flex-end}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.fb-space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.fb-shadow-lg){--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-shadow-sm){--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-ring-1){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.focus\\:fb-ring-0:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-2:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var o=function(){if(ct.get().session&&ct.get().environmentId===e.environmentId&&ct.get().apiHost===e.apiHost){bt.debug("Found existing configuration. Checking session.");var r=ct.get().session;return function(){if(ut(r))return bt.debug("Session expired. Creating new session."),Promise.resolve(ft()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({session:lt(o.session),settings:i}),Promise.resolve(We("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})});bt.debug("Session valid. Extending session."),ct.update({session:lt(r)})}()}return bt.debug("No valid session found. Creating new config."),ct.update({environmentId:e.environmentId,apiHost:e.apiHost}),bt.debug("Get person, session and settings from server"),Promise.resolve(tt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({person:o.person,session:lt(o.session),settings:i}),Promise.resolve(We("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})})}();return Promise.resolve(o&&o.then?o.then(r):r(o))}catch(e){return Promise.reject(e)}};function pt(e,t,n){if(!e.s){if(n instanceof gt){if(!n.s)return void(n.o=pt.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(pt.bind(null,e,t),pt.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var ht=e.getInstance();const gt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{pt(r,1,e(this.v))}catch(e){pt(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?pt(r,1,t?t(o):o):n?pt(r,1,n(o)):pt(r,2,o)}catch(e){pt(r,2,e)}},r},e}();function mt(e){return e instanceof gt&&1&e.s}var vt=/*#__PURE__*/function(){function e(){this.queue=[],this.running=!1}var t=e.prototype;return t.add=function(e,t){void 0===e&&(e=!0);var n=[].slice.call(arguments,2);ht.debug("Add command to queue: "+t.name+"("+JSON.stringify(n)+")"),this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||this.run()},t.run=function(){try{var e=function(){t.running=!1},t=this;t.running=!0;var r=function(e,t,n){for(var r;;){var o=e();if(mt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!mt(i)){r=1;break}i=i.s}}var s=new gt,a=pt.bind(null,s,2);return(0===r?o.then(l):1===r?i.then(f):(void 0).then(function(){(o=e())?o.then?o.then(l).then(void 0,a):l(o):pt(s,1,i)})).then(void 0,a),s;function f(t){i=t;do{if(!(o=e())||mt(o)&&!o.v)return void pt(s,1,i);if(o.then)return void o.then(l).then(void 0,a);mt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(f).then(void 0,a)}function l(e){e?(i=n())&&i.then?i.then(f).then(void 0,a):f(i):pt(s,1,i)}}(function(){return t.queue.length>0},0,function(){var e=o.getInstance(),r=t.queue.shift();if(r.checkInitialized){var i=(bt.debug("Check if initialized"),ct.get().apiHost&&ct.get().environmentId&&ct.get().person&&ct.get().session&&ct.get().settings&&o.initialized?{ok:!0,value:void 0}:n({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));i&&!0!==i.ok&&e.handle(i.error)}return Promise.resolve(r.command.apply(null,r.commandArgs)).then(function(t){t&&(ht.debug("Command result: "+(!0===t.ok?"OK":"Something went really wrong")+", "+r.command.name),!0!==t.ok&&e.handle(t.error))})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},e}();e.getInstance().debug("Create command queue");var _t=new vt,wt=function(e,t){_t.add(!0,ot,e,t)};module.exports={init:function(e){o.init(e.errorHandler),_t.add(!1,dt,e)},setUserId:function(e){_t.add(!0,rt,e)},setEmail:function(e){wt("email",e)},setAttribute:wt,track:function(e,t){void 0===t&&(t={}),_t.add(!0,We,e,t)},logout:function(){_t.add(!0,it)},refresh:function(){_t.add(!0,qe)},registerRouteChange:function(){_t.add(!0,$e)}};
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

var e,t,n,o,r,s,i,a={},f=[],l=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function b(e,t){for(var n in t)e[n]=t[n];return e}function d(e){var t=e.parentNode;t&&t.removeChild(e)}function c(t,n,o){var r,s,i,a={};for(i in n)"key"==i?r=n[i]:"ref"==i?s=n[i]:a[i]=n[i];if(arguments.length>2&&(a.children=arguments.length>3?e.call(arguments,2):o),"function"==typeof t&&null!=t.defaultProps)for(i in t.defaultProps)void 0===a[i]&&(a[i]=t.defaultProps[i]);return u(t,a,r,s,null)}function u(e,o,r,s,i){var a={type:e,props:o,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==i?++n:i};return null==i&&null!=t.vnode&&t.vnode(a),a}function p(e){return e.children}function g(e,t){this.props=e,this.context=t}function h(e,t){if(null==t)return e.__?h(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?h(e):null}function _(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return _(e)}}function m(e){(!e.__d&&(e.__d=!0)&&o.push(e)&&!w.__r++||r!==t.debounceRendering)&&((r=t.debounceRendering)||s)(w)}function w(){var e,t,n,r,s,a,f,l;for(o.sort(i);e=o.shift();)e.__d&&(t=o.length,r=void 0,s=void 0,f=(a=(n=e).__v).__e,(l=n.__P)&&(r=[],(s=b({},a)).__v=a.__v+1,I(l,a,s,n.__n,void 0!==l.ownerSVGElement,null!=a.__h?[f]:null,r,null==f?h(a):f,a.__h),E(r,a),a.__e!=f&&_(a)),o.length>t&&o.sort(i));w.__r=0}function v(e,t,n,o,r,s,i,l,b,d){var c,g,_,m,w,v,k,C=o&&o.__k||f,N=C.length;for(n.__k=[],c=0;c<t.length;c++)if(null!=(m=n.__k[c]=null==(m=t[c])||"boolean"==typeof m||"function"==typeof m?null:"string"==typeof m||"number"==typeof m||"bigint"==typeof m?u(null,m,null,null,m):Array.isArray(m)?u(p,{children:m},null,null,null):m.__b>0?u(m.type,m.props,m.key,m.ref?m.ref:null,m.__v):m)){if(m.__=n,m.__b=n.__b+1,null===(_=C[c])||_&&m.key==_.key&&m.type===_.type)C[c]=void 0;else for(g=0;g<N;g++){if((_=C[g])&&m.key==_.key&&m.type===_.type){C[g]=void 0;break}_=null}I(e,m,_=_||a,r,s,i,l,b,d),w=m.__e,(g=m.ref)&&_.ref!=g&&(k||(k=[]),_.ref&&k.push(_.ref,null,m),k.push(g,m.__c||w,m)),null!=w?(null==v&&(v=w),"function"==typeof m.type&&m.__k===_.__k?m.__d=b=y(m,b,e):b=j(e,m,_,C,w,b),"function"==typeof n.type&&(n.__d=b)):b&&_.__e==b&&b.parentNode!=e&&(b=h(_))}for(n.__e=v,c=N;c--;)null!=C[c]&&("function"==typeof n.type&&null!=C[c].__e&&C[c].__e==n.__d&&(n.__d=x(o).nextSibling),T(C[c],C[c]));if(k)for(c=0;c<k.length;c++)H(k[c],k[++c],k[++c])}function y(e,t,n){for(var o,r=e.__k,s=0;r&&s<r.length;s++)(o=r[s])&&(o.__=e,t="function"==typeof o.type?y(o,t,n):j(n,o,o,r,o.__e,t));return t}function j(e,t,n,o,r,s){var i,a,f;if(void 0!==t.__d)i=t.__d,t.__d=void 0;else if(null==n||r!=s||null==r.parentNode)e:if(null==s||s.parentNode!==e)e.appendChild(r),i=null;else{for(a=s,f=0;(a=a.nextSibling)&&f<o.length;f+=1)if(a==r)break e;e.insertBefore(r,s),i=s}return void 0!==i?i:r.nextSibling}function x(e){var t,n,o;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(o=x(n)))return o;return null}function k(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||l.test(t)?n:n+"px"}function C(e,t,n,o,r){var s;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||k(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||k(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])s=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?o||e.addEventListener(t,s?S:N,s):e.removeEventListener(t,s?S:N,s);else if("dangerouslySetInnerHTML"!==t){if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function N(e){return this.l[e.type+!1](t.event?t.event(e):e)}function S(e){return this.l[e.type+!0](t.event?t.event(e):e)}function I(e,n,o,r,s,i,a,f,l){var d,c,u,h,_,m,w,y,j,x,k,C,N,S,I,E=n.type;if(void 0!==n.constructor)return null;null!=o.__h&&(l=o.__h,f=n.__e=o.__e,n.__h=null,i=[f]),(d=t.__b)&&d(n);try{e:if("function"==typeof E){if(y=n.props,j=(d=E.contextType)&&r[d.__c],x=d?j?j.props.value:d.__:r,o.__c?w=(c=n.__c=o.__c).__=c.__E:("prototype"in E&&E.prototype.render?n.__c=c=new E(y,x):(n.__c=c=new g(y,x),c.constructor=E,c.render=L),j&&j.sub(c),c.props=y,c.state||(c.state={}),c.context=x,c.__n=r,u=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=E.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=b({},c.__s)),b(c.__s,E.getDerivedStateFromProps(y,c.__s))),h=c.props,_=c.state,c.__v=n,u)null==E.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==E.getDerivedStateFromProps&&y!==h&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(y,x),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(y,c.__s,x)||n.__v===o.__v){for(n.__v!==o.__v&&(c.props=y,c.state=c.__s,c.__d=!1),c.__e=!1,n.__e=o.__e,n.__k=o.__k,n.__k.forEach(function(e){e&&(e.__=n)}),k=0;k<c._sb.length;k++)c.__h.push(c._sb[k]);c._sb=[],c.__h.length&&a.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(y,c.__s,x),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(h,_,m)})}if(c.context=x,c.props=y,c.__P=e,C=t.__r,N=0,"prototype"in E&&E.prototype.render){for(c.state=c.__s,c.__d=!1,C&&C(n),d=c.render(c.props,c.state,c.context),S=0;S<c._sb.length;S++)c.__h.push(c._sb[S]);c._sb=[]}else do{c.__d=!1,C&&C(n),d=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++N<25);c.state=c.__s,null!=c.getChildContext&&(r=b(b({},r),c.getChildContext())),u||null==c.getSnapshotBeforeUpdate||(m=c.getSnapshotBeforeUpdate(h,_)),I=null!=d&&d.type===p&&null==d.key?d.props.children:d,v(e,Array.isArray(I)?I:[I],n,o,r,s,i,a,f,l),c.base=n.__e,n.__h=null,c.__h.length&&a.push(c),w&&(c.__E=c.__=null),c.__e=!1}else null==i&&n.__v===o.__v?(n.__k=o.__k,n.__e=o.__e):n.__e=q(o.__e,n,o,r,s,i,a,l);(d=t.diffed)&&d(n)}catch(e){n.__v=null,(l||null!=i)&&(n.__e=f,n.__h=!!l,i[i.indexOf(f)]=null),t.__e(e,n,o)}}function E(e,n){t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function q(t,n,o,r,s,i,f,l){var b,c,u,p=o.props,g=n.props,_=n.type,m=0;if("svg"===_&&(s=!0),null!=i)for(;m<i.length;m++)if((b=i[m])&&"setAttribute"in b==!!_&&(_?b.localName===_:3===b.nodeType)){t=b,i[m]=null;break}if(null==t){if(null===_)return document.createTextNode(g);t=s?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,g.is&&g),i=null,l=!1}if(null===_)p===g||l&&t.data===g||(t.data=g);else{if(i=i&&e.call(t.childNodes),c=(p=o.props||a).dangerouslySetInnerHTML,u=g.dangerouslySetInnerHTML,!l){if(null!=i)for(p={},m=0;m<t.attributes.length;m++)p[t.attributes[m].name]=t.attributes[m].value;(u||c)&&(u&&(c&&u.__html==c.__html||u.__html===t.innerHTML)||(t.innerHTML=u&&u.__html||""))}if(function(e,t,n,o,r){var s;for(s in n)"children"===s||"key"===s||s in t||C(e,s,null,n[s],o);for(s in t)r&&"function"!=typeof t[s]||"children"===s||"key"===s||"value"===s||"checked"===s||n[s]===t[s]||C(e,s,t[s],n[s],o)}(t,g,p,s,l),u)n.__k=[];else if(m=n.props.children,v(t,Array.isArray(m)?m:[m],n,o,r,s&&"foreignObject"!==_,i,f,i?i[0]:o.__k&&h(o,0),l),null!=i)for(m=i.length;m--;)null!=i[m]&&d(i[m]);l||("value"in g&&void 0!==(m=g.value)&&(m!==t.value||"progress"===_&&!m||"option"===_&&m!==p.value)&&C(t,"value",m,p.value,!1),"checked"in g&&void 0!==(m=g.checked)&&m!==t.checked&&C(t,"checked",m,p.checked,!1))}return t}function H(e,n,o){try{"function"==typeof e?e(n):e.current=n}catch(e){t.__e(e,o)}}function T(e,n,o){var r,s;if(t.unmount&&t.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||H(r,null,n)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){t.__e(e,n)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(s=0;s<r.length;s++)r[s]&&T(r[s],n,o||"function"!=typeof e.type);o||null==e.__e||d(e.__e),e.__=e.__e=e.__d=void 0}function L(e,t,n){return this.constructor(e,n)}e=f.slice,t={__e:function(e,t,n,o){for(var r,s,i;t=t.__;)if((r=t.__c)&&!r.__)try{if((s=r.constructor)&&null!=s.getDerivedStateFromError&&(r.setState(s.getDerivedStateFromError(e)),i=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),i=r.__d),i)return r.__E=r}catch(t){e=t}throw e}},n=0,g.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=b({},this.state),"function"==typeof e&&(e=e(b({},n),this.props)),e&&b(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),m(this))},g.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),m(this))},g.prototype.render=p,o=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,i=function(e,t){return e.__v.__b-t.__v.__b},w.__r=0;var z,F,$,O,U=0,P=[],M=[],A=t.__b,D=t.__r,W=t.diffed,B=t.__c,Q=t.unmount;function J(e,n){t.__h&&t.__h(F,e,U||n),U=0;var o=F.__H||(F.__H={__:[],__h:[]});return e>=o.__.length&&o.__.push({__V:M}),o.__[e]}function Y(e){return U=1,function(e,t,n){var o=J(z++,2);if(o.t=e,!o.__c&&(o.__=[ee(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=F,!F.u)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=o.__c.__H.__.filter(function(e){return e.__c});if(r.every(function(e){return!e.__N}))return!s||s.call(this,e,t,n);var i=!1;return r.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(i=!0)}}),!(!i&&o.__c.props===e)&&(!s||s.call(this,e,t,n))};F.u=!0;var s=F.shouldComponentUpdate,i=F.componentWillUpdate;F.componentWillUpdate=function(e,t,n){if(this.__e){var o=s;s=void 0,r(e,t,n),s=o}i&&i.call(this,e,t,n)},F.shouldComponentUpdate=r}return o.__N||o.__}(ee,e)}function R(e,n){var o=J(z++,3);!t.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(o.__H,n)&&(o.__=e,o.i=n,F.__H.__h.push(o))}function V(){for(var e;e=P.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(K),e.__H.__h.forEach(Z),e.__H.__h=[]}catch(n){e.__H.__h=[],t.__e(n,e.__v)}}t.__b=function(e){F=null,A&&A(e)},t.__r=function(e){D&&D(e),z=0;var t=(F=e.__c).__H;t&&($===F?(t.__h=[],F.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=M,e.__N=e.i=void 0})):(t.__h.forEach(K),t.__h.forEach(Z),t.__h=[])),$=F},t.diffed=function(e){W&&W(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(1!==P.push(n)&&O===t.requestAnimationFrame||((O=t.requestAnimationFrame)||G)(V)),n.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==M&&(e.__=e.__V),e.i=void 0,e.__V=M})),$=F=null},t.__c=function(e,n){n.some(function(e){try{e.__h.forEach(K),e.__h=e.__h.filter(function(e){return!e.__||Z(e)})}catch(o){n.some(function(e){e.__h&&(e.__h=[])}),n=[],t.__e(o,e.__v)}}),B&&B(e,n)},t.unmount=function(e){Q&&Q(e);var n,o=e.__c;o&&o.__H&&(o.__H.__.forEach(function(e){try{K(e)}catch(e){n=e}}),o.__H=void 0,n&&t.__e(n,o.__v))};var X="function"==typeof requestAnimationFrame;function G(e){var t,n=function(){clearTimeout(o),X&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);X&&(t=requestAnimationFrame(n))}function K(e){var t=F,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),F=t}function Z(e){var t=F;e.__c=e.__(),F=t}function ee(e,t){return"function"==typeof t?t(e):t}const te=(...e)=>e.filter(Boolean).join(" ");function ne({children:e,isOpen:t,close:n}){const[o,r]=Y(!1);return R(()=>{r(t)},[t]),c("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},c("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},c("div",{className:te(o?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out fb-m-4")},c("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},c("button",{type:"button",onClick:n,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},c("span",{class:"fb-sr-only"},"Close"),c("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},c("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),c("div",{className:""},e))))}const oe=async(e,t)=>{if(!(await fetch(`${t.apiHost}/api/v1/client/environments/${t.environmentId}/displays/${e}/responded`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Could not update display")},re=async(e,t)=>{const n=await fetch(`${t.apiHost}/api/v1/client/environments/${t.environmentId}/responses`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw console.error(n.text),new Error("Could not create response");return await n.json()};function se({progress:e,brandColor:t}){return c("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},c("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:t,width:`${Math.floor(100*e)}%`}}))}function ie({headline:e,questionId:t,style:n}){return c("label",{htmlFor:t,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:n},e)}function ae({subheader:e,questionId:t}){return c("label",{htmlFor:t,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e)}function fe({headline:e,subheader:t,brandColor:n}){return c("div",{className:"fb-text-center"},c("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:n}},c("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},c("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),c("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),c("div",null,c(ie,{headline:e,questionId:"thankYouCard",style:{"margin-right":0}}),c(ae,{subheader:t,questionId:"thankYouCard"})))}function le({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){return c("form",{onSubmit:n=>{n.preventDefault();const o={[e.id]:n.currentTarget[e.id].value};n.currentTarget[e.id].value="",t(o)}},c(ie,{headline:e.headline,questionId:e.id}),c(ae,{subheader:e.subheader,questionId:e.id}),c("div",{className:"fb-mt-4"},c("textarea",{rows:3,name:e.id,id:e.id,placeholder:e.placeholder,required:e.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),c("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},c("div",null),c("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:fb-ring-slate-500",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function be({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){const[r,s]=Y(null);return c("form",{onSubmit:n=>{n.preventDefault(),t({[e.id]:n.currentTarget[e.id].value}),s(null)}},c(ie,{headline:e.headline,questionId:e.id}),c(ae,{subheader:e.subheader,questionId:e.id}),c("div",{className:"fb-mt-4"},c("fieldset",null,c("legend",{className:"fb-sr-only"},"Choices"),c("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},e.choices&&e.choices.map((t,n)=>c("label",{key:t.id,className:te(r===t.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},c("span",{className:"fb-flex fb-items-center fb-text-sm"},c("input",{type:"radio",id:t.id,name:e.id,value:t.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":`${t.id}-label`,onChange:e=>{s(e.currentTarget.value)},checked:r===t.label,style:{borderColor:o,color:o},required:e.required&&0===n}),c("span",{id:`${t.id}-label`,className:"fb-ml-3 fb-font-medium"},t.label))))))),c("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},c("div",null),c("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function de({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){const[r,s]=Y([]),i=()=>r.length>0;return c("form",{onSubmit:n=>{n.preventDefault(),(i()||!e.required)&&(t({[e.id]:r}),s([]))}},c(ie,{headline:e.headline,questionId:e.id}),c(ae,{subheader:e.subheader,questionId:e.id}),c("div",{className:"fb-mt-4"},c("fieldset",null,c("legend",{className:"fb-sr-only"},"Choices"),c("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},e.choices&&e.choices.map(t=>c("label",{key:t.id,className:te(r.includes(t.label)?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 hover:fb-bg-slate-50 focus:fb-outline-none")},c("span",{className:"fb-flex fb-items-center fb-text-sm"},c("input",{type:"checkbox",id:t.id,name:e.id,value:t.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":`${t.id}-label`,onChange:e=>{s(e.currentTarget.checked?[...r,e.currentTarget.value]:r.filter(t=>t!==e.currentTarget.value))},checked:r.includes(t.label),style:{borderColor:o,color:o}}),c("span",{id:`${t.id}-label`,className:"fb-ml-3 fb-font-medium"},t.label))))))),c("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:e.required,value:i()?"checked":""}),c("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},c("div",null),c("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function ce({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){const[r,s]=Y(null);return c("form",{onSubmit:n=>{n.preventDefault(),t({[e.id]:r})}},c(ie,{headline:e.headline,questionId:e.id}),c(ae,{subheader:e.subheader,questionId:e.id}),c("div",{className:"fb-my-4"},c("fieldset",null,c("legend",{className:"fb-sr-only"},"Choices"),c("div",{className:"fb-flex"},Array.from({length:11},(e,t)=>t).map(t=>c("label",{key:t,className:te(r===t?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},c("input",{type:"radio",name:"nps",value:t,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:()=>s(t),required:e.required}),t))),c("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},c("p",null,e.lowerLabel),c("p",null,e.upperLabel)))),c("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},c("div",null),c("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function ue(e){function t(e,t){let n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){let n=e.attributes;for(let{name:o,value:r}of n)t(o,r)&&e.removeAttribute(o)}let o=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){let t=e.querySelectorAll("script");for(let e of t)e.remove()}(o),function e(t){let o=t.children;for(let t of o)n(t),e(t)}(o),o.innerHTML}function pe({htmlString:e,questionId:t}){return c("label",{htmlFor:t,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:ue(e)}})}function ge({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){return c("div",null,c(ie,{headline:e.headline,questionId:e.id}),c(pe,{htmlString:e.html,questionId:e.id}),c("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},c("div",null),!e.required&&c("button",{type:"button",onClick:()=>{t({[e.id]:"dismissed"})},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},e.dismissButtonLabel||"Skip"),c("button",{type:"button",onClick:()=>{var n,o;e.buttonExternal&&e.buttonUrl&&(null==(n=window)||null==(o=n.open(e.buttonUrl,"_blank"))||o.focus()),t({[e.id]:"clicked"})},className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function he({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){return"openText"===e.type?c(le,{question:e,onSubmit:t,lastQuestion:n,brandColor:o}):"multipleChoiceSingle"===e.type?c(be,{question:e,onSubmit:t,lastQuestion:n,brandColor:o}):"multipleChoiceMulti"===e.type?c(de,{question:e,onSubmit:t,lastQuestion:n,brandColor:o}):"nps"===e.type?c(ce,{question:e,onSubmit:t,lastQuestion:n,brandColor:o}):"cta"===e.type?c(ge,{question:e,onSubmit:t,lastQuestion:n,brandColor:o}):null}function _e({config:e,survey:t,close:n,brandColor:o}){var r;const[s,i]=Y(t.questions[0].id),[a,f]=Y(0),[l,b]=Y(null),[d,u]=Y(null),[p,g]=Y(!1);R(()=>{!async function(){const n=await(async(e,t)=>{const n=await fetch(`${t.apiHost}/api/v1/client/environments/${t.environmentId}/displays`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw console.error(n.text),new Error("Could not create display");return await n.json()})({surveyId:t.id,personId:e.person.id},e);u(n.id)}()},[e,t]),R(()=>{f(function(){const e=t.questions.findIndex(e=>e.id===s);return e/t.questions.length}())},[s,t]);const h=async o=>{g(!0);const r=t.questions.findIndex(e=>e.id===s),a=r===t.questions.length-1,c={surveyId:t.id,personId:e.person.id,response:{finished:a,data:o}};if(l)await(async(e,t,n)=>{const o=await fetch(`${n.apiHost}/api/v1/client/environments/${n.environmentId}/responses/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error("Could not update response");return await o.json()})(c,l,e);else{const[t,n]=await Promise.all([re(c,e),oe(d,e)]);b(t.id)}g(!1),a?(f(100),t.thankYouCard.enabled?setTimeout(()=>{n()},2e3):n()):i(t.questions[r+1].id)};return c("div",null,c("div",{className:te(p?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===a&&t.thankYouCard.enabled?c(fe,{headline:t.thankYouCard.headline,subheader:t.thankYouCard.subheader,brandColor:null==(r=e.settings)?void 0:r.brandColor}):t.questions.map((e,n)=>s===e.id&&c(he,{key:e.id,brandColor:o,lastQuestion:n===t.questions.length-1,onSubmit:h,question:e}))),c(se,{progress:a,brandColor:o}))}function me({config:e,survey:t,closeSurvey:n}){var o;const[r,s]=Y(!0),i=()=>{s(!1),setTimeout(()=>{n()},1e3)};return c("div",{id:"fbjs"},c(ne,{isOpen:r,close:i},c(_e,{config:e,survey:t,close:i,brandColor:null==(o=e.settings)?void 0:o.brandColor})))}function we(){return we=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},we.apply(this,arguments)}class ve{constructor(){this.config=this.loadFromLocalStorage()}static getInstance(){return ve.instance||(ve.instance=new ve),ve.instance}update(e){e&&(this.config=we({},this.config,e),this.saveToLocalStorage())}get(){return this.config}loadFromLocalStorage(){if("undefined"!=typeof window){const e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}}saveToLocalStorage(){localStorage.setItem("formbricksConfig",JSON.stringify(this.config))}}ve.instance=void 0;class ye{constructor(){this.logLevel="error"}static getInstance(){return ye.instance||(ye.instance=new ye),ye.instance}configure(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)}logger(e,t){if("debug"===t&&"debug"!==this.logLevel)return;const n=`🧱 Formbricks - ${(new Date).toISOString()} [${t.toUpperCase()}] - ${e}`;"error"===t?console.error(n):console.log(n)}debug(e){this.logger(e,"debug")}error(e){this.logger(e,"error")}}ye.instance=void 0;const je=ye.getInstance(),xe=ve.getInstance(),ke=async()=>{const e=await fetch(`${xe.get().apiHost}/api/v1/client/environments/${xe.get().environmentId}/settings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:xe.get().person.id})});if(!e.ok)throw je.error("Error getting settings"),Error("Error getting settings");return e.json()},Ce="formbricks-web-container",Ne=ve.getInstance(),Se=ye.getInstance();let Ie=!1;const Ee=n=>{Ie?Se.debug("A survey is already running. Skipping."):(Ie=!0,function(n,o,r){var s,i;t.__&&t.__(n,o),s=o.__k,i=[],I(o,n=o.__k=c(p,null,[n]),s||a,a,void 0!==o.ownerSVGElement,s?null:o.firstChild?e.call(o.childNodes):null,i,s?s.__e:o.firstChild,!1),E(i,n)}(c(me,{config:Ne.get(),survey:n,closeSurvey:qe}),document.getElementById(Ce)))},qe=async()=>{document.getElementById(Ce).remove(),He();const e=await ke();Ne.update({settings:e}),Ie=!1},He=()=>{const e=document.createElement("div");e.id=Ce,document.body.appendChild(e)},Te=ye.getInstance(),Le=ve.getInstance(),ze=async(e,t)=>{const n=await fetch(`${Le.get().apiHost}/api/v1/client/environments/${Le.get().environmentId}/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Le.get().session.id,eventName:e,properties:t})});if(n.ok)Te.debug(`Formbricks: Event "${e}" tracked`),Fe(e);else{const e=await n.json();Te.error(`Formbricks: Error tracking event: ${JSON.stringify(e)}`)}},Fe=e=>{for(const o of null==(t=Le.get().settings)?void 0:t.surveys){var t;for(const t of o.triggers){var n;if((null==(n=t.eventClass)?void 0:n.name)===e)return Te.debug(`Formbricks: survey ${o.id} triggered by event "${e}"`),void Ee(o)}}},$e=ve.getInstance(),Oe=ye.getInstance(),Ue=async()=>{Oe.debug("Creating new person");const e=await fetch(`${$e.get().apiHost}/api/v1/client/environments/${$e.get().environmentId}/people`,{method:"POST",headers:{"Content-Type":"application/json"}});return e.ok?await e.json():(console.error("Formbricks: Error fetching person"),null)},Pe=(e,t)=>{const n=$e.get().person.attributes.find(t=>{var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Me=ye.getInstance(),Ae=ve.getInstance(),De=async()=>{if(!Ae.get().person)return void Me.error("Formbricks: Unable to create session. No person found");const e=await fetch(`${Ae.get().apiHost}/api/v1/client/environments/${Ae.get().environmentId}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Ae.get().person.id})});if(e.ok)return await e.json();Me.error("Error creating session")},We=e=>{const t=we({},e);return t.expiresAt=Date.now()+36e5,t},Be=e=>!e||e.expiresAt<=Date.now(),Qe=ve.getInstance(),Je=ye.getInstance(),Ye=()=>{const{settings:e}=Qe.get(),t=null==e?void 0:e.noCodeEvents.filter(e=>{var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Je.debug("checking page url"),0!==t.length)for(const e of t){const{noCodeConfig:{pageUrl:t}}=e;t&&Re(window.location.href,t.value,t.rule)&&ze(e.name)}};function Re(e,t,n){switch(n){case"exactMatch":return e===t;case"contains":return e.includes(t);case"startsWith":return e.startsWith(t);case"endsWith":return e.endsWith(t);case"notMatch":return e!==t;case"notContains":return!e.includes(t);default:throw new Error("Invalid match type")}}const Ve=e=>{const{settings:t}=Qe.get(),n=null==t?void 0:t.noCodeEvents.filter(e=>{var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(e=>{var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=e.target;n.forEach(e=>{var t;const n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&r.innerHTML===n.value&&ze(e.name)}),o.forEach(e=>{var t;const n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&r.matches(n.value)&&ze(e.name)})},Xe=ve.getInstance(),Ge=ye.getInstance(),Ke=()=>{if(!(Xe.get().apiHost&&Xe.get().environmentId&&Xe.get().person&&Xe.get().session&&Xe.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Ze=new class{constructor(){this.queue=[],this.running=!1}add(e){this.queue.push(e),this.running||this.run()}async run(){for(this.running=!0;this.queue.length>0;){const e=this.queue.shift();try{await e()}catch(e){console.error(e)}}this.running=!1}},et=(e,t)=>{Ze.add(async()=>{Ke(),await(async(e,t)=>{if(Oe.debug("setting attribute: "+e+" to value: "+t),Pe(e,t))return void Oe.debug("attribute already set to this value. Skipping update.");const{person:n,settings:o}=await(async(e,t)=>{if(!$e.get().person||!$e.get().person.id)return void console.error("Formbricks: Unable to update attribute. No person set.");const n=await fetch(`${$e.get().apiHost}/api/v1/client/environments/${$e.get().environmentId}/people/${$e.get().person.id}/attribute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})}),o=await n.json();if(!n.ok)throw Oe.error("Error updating person"),Error("Error updating person");return o})(e,t);if(!n||!o)throw Oe.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");$e.update({person:n,settings:o})})(e,t)})},tt={init:e=>{Ze.add(async()=>{(async e=>{if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");if(e.logLevel&&Ge.configure({logLevel:e.logLevel}),He(),(()=>{if(null===document.getElementById("formbricks__css")){const e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs :is(.fb-sr-only){clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-4){margin-right:1rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs :is(.fb-translate-x-28){--tw-translate-x:7rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-end){justify-content:flex-end}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.fb-space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.fb-shadow-lg){--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-shadow-sm){--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-ring-1){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.focus\\:fb-ring-0:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-2:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}})(),Xe.get().session&&Xe.get().environmentId===e.environmentId&&Xe.get().apiHost===e.apiHost){Ge.debug("Found existing configuration. Checking session.");const e=Xe.get().session;if(Be(e)){Ge.debug("Session expired. Creating new session.");const{session:e,settings:t}=await De();Xe.update({session:We(e),settings:t}),ze("New Session")}else Ge.debug("Session valid. Extending session."),Xe.update({session:We(e)})}else{Ge.debug("No valid session found. Creating new config."),Xe.update({environmentId:e.environmentId,apiHost:e.apiHost});const{person:t,session:n,settings:o}=await Ue();Xe.update({person:t,session:We(n),settings:o}),ze("New Session")}(()=>{if("undefined"!=typeof window){const e=window.setInterval(async()=>{await(async()=>{if(Me.debug("Checking session"),Be(Ae.get().session)){Me.debug("Session expired, creating new session");const{session:e,settings:t}=await De();if(!e||!t)throw Me.error("Error creating new session"),Error("Error creating new session");Ae.update({session:e,settings:t}),ze("New Session")}Me.debug("Session not expired, extending session"),Ae.update({session:We(Ae.get().session)})})()},3e5);window.addEventListener("beforeunload",()=>{clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ye),window.addEventListener("popstate",Ye),window.addEventListener("pushstate",Ye),window.addEventListener("replacestate",Ye),window.addEventListener("load",Ye)),"undefined"!=typeof window&&document.addEventListener("click",Ve),Ge.debug("Initialized")})(e)})},setUserId:e=>{Ze.add(async()=>{Ke(),await(async e=>{if(Oe.debug("setting userId: "+e),Pe("userId",e))return void Oe.debug("userId already set to this value. Skipping update.");if((e=>{const t=$e.get().person.attributes.find(e=>{var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)});return!!t})())return void Oe.error("userId cannot be changed after it has been set. You need to reset first");const{person:t,settings:n}=await(async e=>{if(!$e.get().person||!$e.get().person.id)return void console.error("Formbricks: Unable to update userId. No person set.");const t=await fetch(`${$e.get().apiHost}/api/v1/client/environments/${$e.get().environmentId}/people/${$e.get().person.id}/user-id`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:$e.get().session.id})});if(!t.ok)throw Oe.error("Formbricks: Error updating person"),Error("Error updating person");return await t.json()})(e);$e.update({person:t,settings:n})})(e)})},setEmail:e=>{et("email",e)},setAttribute:et,track:(e,t={})=>{Ze.add(async()=>{Ke(),await ze(e,t)})},logout:()=>{Ze.add(async()=>{Ke(),await(async()=>{Oe.debug("Resetting person. Getting new person, session and settings from backend");const{person:e,session:t,settings:n}=await Ue();if(!e||!t||!n)throw Oe.error("Error resetting user"),new Error("Formbricks: Error resetting user");$e.update({person:e,session:t,settings:n})})()})},refresh:()=>{Ze.add(async()=>{Ke(),await(async()=>{je.debug("Refreshing - getting settings from backend");const e=await ke();xe.update({settings:e})})()})},registerRouteChange:()=>{Ze.add(async()=>{Ke(),Ye()})}};export{tt as default};
class e{constructor(){this.logLevel="error"}static getInstance(){return e.instance||(e.instance=new e),e.instance}configure(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)}logger(e,t){if("debug"===t&&"debug"!==this.logLevel)return;const n=`🧱 Formbricks - ${(new Date).toISOString()} [${t.toUpperCase()}] - ${e}`;"error"===t?console.error(n):console.log(n)}debug(e){this.logger(e,"debug")}error(e){this.logger(e,"error")}}e.instance=void 0;const t=e=>({ok:!0,value:e}),n=e=>({ok:!1,error:e});function o(e,t,n){return!0===e.ok?t(e.value):n(e.error)}e.getInstance();class s{constructor(t){this.handleError=void 0,this.handleError=t||(t=>e.getInstance().error(JSON.stringify(t)))}static getInstance(){return s.instance||(s.instance=new s),s.instance}static init(e){this.initialized=!0,console.log("🧱 Formbricks - initializing error handler"),console.log("🧱 Formbricks - Custom error handler: ","function"==typeof e?"yes":"no"),s.instance=new s(e)}handle(e){this.handleError(e)}}function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r.apply(this,arguments)}s.instance=void 0,s.initialized=!1;class i{constructor(){this.config=this.loadFromLocalStorage()}static getInstance(){return i.instance||(i.instance=new i),i.instance}update(e){e&&(this.config=r({},this.config,e),this.saveToLocalStorage())}get(){return this.config}loadFromLocalStorage(){if("undefined"!=typeof window){const e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}}saveToLocalStorage(){return(e=()=>localStorage.setItem("formbricksConfig",JSON.stringify(this.config)),(...t)=>{try{return{ok:!0,value:e(...t)}}catch(e){return{ok:!1,error:e}}})();var e}}i.instance=void 0;var a,f,l,b,d,u,c,p={},g=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function h(e,t){for(var n in t)e[n]=t[n];return e}function m(e){var t=e.parentNode;t&&t.removeChild(e)}function w(e,t,n){var o,s,r,i={};for(r in t)"key"==r?o=t[r]:"ref"==r?s=t[r]:i[r]=t[r];if(arguments.length>2&&(i.children=arguments.length>3?a.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===i[r]&&(i[r]=e.defaultProps[r]);return v(e,i,o,s,null)}function v(e,t,n,o,s){var r={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==s?++l:s};return null==s&&null!=f.vnode&&f.vnode(r),r}function y(e){return e.children}function j(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?x(e):null}function k(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return k(e)}}function C(e){(!e.__d&&(e.__d=!0)&&b.push(e)&&!S.__r++||d!==f.debounceRendering)&&((d=f.debounceRendering)||u)(S)}function S(){var e,t,n,o,s,r,i,a;for(b.sort(c);e=b.shift();)e.__d&&(t=b.length,o=void 0,s=void 0,i=(r=(n=e).__v).__e,(a=n.__P)&&(o=[],(s=h({},r)).__v=r.__v+1,$(a,r,s,n.__n,void 0!==a.ownerSVGElement,null!=r.__h?[i]:null,o,null==i?x(r):i,r.__h),M(o,r),r.__e!=i&&k(r)),b.length>t&&b.sort(c));S.__r=0}function N(e,t,n,o,s,r,i,a,f,l){var b,d,u,c,_,h,m,w=o&&o.__k||g,j=w.length;for(n.__k=[],b=0;b<t.length;b++)if(null!=(c=n.__k[b]=null==(c=t[b])||"boolean"==typeof c||"function"==typeof c?null:"string"==typeof c||"number"==typeof c||"bigint"==typeof c?v(null,c,null,null,c):Array.isArray(c)?v(y,{children:c},null,null,null):c.__b>0?v(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):c)){if(c.__=n,c.__b=n.__b+1,null===(u=w[b])||u&&c.key==u.key&&c.type===u.type)w[b]=void 0;else for(d=0;d<j;d++){if((u=w[d])&&c.key==u.key&&c.type===u.type){w[d]=void 0;break}u=null}$(e,c,u=u||p,s,r,i,a,f,l),_=c.__e,(d=c.ref)&&u.ref!=d&&(m||(m=[]),u.ref&&m.push(u.ref,null,c),m.push(d,c.__c||_,c)),null!=_?(null==h&&(h=_),"function"==typeof c.type&&c.__k===u.__k?c.__d=f=I(c,f,e):f=E(e,c,u,w,_,f),"function"==typeof n.type&&(n.__d=f)):f&&u.__e==f&&f.parentNode!=e&&(f=x(u))}for(n.__e=h,b=j;b--;)null!=w[b]&&("function"==typeof n.type&&null!=w[b].__e&&w[b].__e==n.__d&&(n.__d=q(o).nextSibling),F(w[b],w[b]));if(m)for(b=0;b<m.length;b++)A(m[b],m[++b],m[++b])}function I(e,t,n){for(var o,s=e.__k,r=0;s&&r<s.length;r++)(o=s[r])&&(o.__=e,t="function"==typeof o.type?I(o,t,n):E(n,o,o,s,o.__e,t));return t}function E(e,t,n,o,s,r){var i,a,f;if(void 0!==t.__d)i=t.__d,t.__d=void 0;else if(null==n||s!=r||null==s.parentNode)e:if(null==r||r.parentNode!==e)e.appendChild(s),i=null;else{for(a=r,f=0;(a=a.nextSibling)&&f<o.length;f+=1)if(a==s)break e;e.insertBefore(s,r),i=r}return void 0!==i?i:s.nextSibling}function q(e){var t,n,o;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(o=q(n)))return o;return null}function H(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||_.test(t)?n:n+"px"}function z(e,t,n,o,s){var r;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||H(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||H(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])r=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?o||e.addEventListener(t,r?L:T,r):e.removeEventListener(t,r?L:T,r);else if("dangerouslySetInnerHTML"!==t){if(s)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function T(e){return this.l[e.type+!1](f.event?f.event(e):e)}function L(e){return this.l[e.type+!0](f.event?f.event(e):e)}function $(e,t,n,o,s,r,i,a,l){var b,d,u,c,p,g,_,m,w,v,x,k,C,S,I,E=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,r=[a]),(b=f.__b)&&b(t);try{e:if("function"==typeof E){if(m=t.props,w=(b=E.contextType)&&o[b.__c],v=b?w?w.props.value:b.__:o,n.__c?_=(d=t.__c=n.__c).__=d.__E:("prototype"in E&&E.prototype.render?t.__c=d=new E(m,v):(t.__c=d=new j(m,v),d.constructor=E,d.render=U),w&&w.sub(d),d.props=m,d.state||(d.state={}),d.context=v,d.__n=o,u=d.__d=!0,d.__h=[],d._sb=[]),null==d.__s&&(d.__s=d.state),null!=E.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=h({},d.__s)),h(d.__s,E.getDerivedStateFromProps(m,d.__s))),c=d.props,p=d.state,d.__v=t,u)null==E.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(null==E.getDerivedStateFromProps&&m!==c&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(m,v),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(m,d.__s,v)||t.__v===n.__v){for(t.__v!==n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),d.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),x=0;x<d._sb.length;x++)d.__h.push(d._sb[x]);d._sb=[],d.__h.length&&i.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(m,d.__s,v),null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(c,p,g)})}if(d.context=v,d.props=m,d.__P=e,k=f.__r,C=0,"prototype"in E&&E.prototype.render){for(d.state=d.__s,d.__d=!1,k&&k(t),b=d.render(d.props,d.state,d.context),S=0;S<d._sb.length;S++)d.__h.push(d._sb[S]);d._sb=[]}else do{d.__d=!1,k&&k(t),b=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++C<25);d.state=d.__s,null!=d.getChildContext&&(o=h(h({},o),d.getChildContext())),u||null==d.getSnapshotBeforeUpdate||(g=d.getSnapshotBeforeUpdate(c,p)),I=null!=b&&b.type===y&&null==b.key?b.props.children:b,N(e,Array.isArray(I)?I:[I],t,n,o,s,r,i,a,l),d.base=t.__e,t.__h=null,d.__h.length&&i.push(d),_&&(d.__E=d.__=null),d.__e=!1}else null==r&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=O(n.__e,t,n,o,s,r,i,l);(b=f.diffed)&&b(t)}catch(e){t.__v=null,(l||null!=r)&&(t.__e=a,t.__h=!!l,r[r.indexOf(a)]=null),f.__e(e,t,n)}}function M(e,t){f.__c&&f.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){f.__e(e,t.__v)}})}function O(e,t,n,o,s,r,i,f){var l,b,d,u=n.props,c=t.props,g=t.type,_=0;if("svg"===g&&(s=!0),null!=r)for(;_<r.length;_++)if((l=r[_])&&"setAttribute"in l==!!g&&(g?l.localName===g:3===l.nodeType)){e=l,r[_]=null;break}if(null==e){if(null===g)return document.createTextNode(c);e=s?document.createElementNS("http://www.w3.org/2000/svg",g):document.createElement(g,c.is&&c),r=null,f=!1}if(null===g)u===c||f&&e.data===c||(e.data=c);else{if(r=r&&a.call(e.childNodes),b=(u=n.props||p).dangerouslySetInnerHTML,d=c.dangerouslySetInnerHTML,!f){if(null!=r)for(u={},_=0;_<e.attributes.length;_++)u[e.attributes[_].name]=e.attributes[_].value;(d||b)&&(d&&(b&&d.__html==b.__html||d.__html===e.innerHTML)||(e.innerHTML=d&&d.__html||""))}if(function(e,t,n,o,s){var r;for(r in n)"children"===r||"key"===r||r in t||z(e,r,null,n[r],o);for(r in t)s&&"function"!=typeof t[r]||"children"===r||"key"===r||"value"===r||"checked"===r||n[r]===t[r]||z(e,r,t[r],n[r],o)}(e,c,u,s,f),d)t.__k=[];else if(_=t.props.children,N(e,Array.isArray(_)?_:[_],t,n,o,s&&"foreignObject"!==g,r,i,r?r[0]:n.__k&&x(n,0),f),null!=r)for(_=r.length;_--;)null!=r[_]&&m(r[_]);f||("value"in c&&void 0!==(_=c.value)&&(_!==e.value||"progress"===g&&!_||"option"===g&&_!==u.value)&&z(e,"value",_,u.value,!1),"checked"in c&&void 0!==(_=c.checked)&&_!==e.checked&&z(e,"checked",_,u.checked,!1))}return e}function A(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){f.__e(e,n)}}function F(e,t,n){var o,s;if(f.unmount&&f.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||A(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){f.__e(e,t)}o.base=o.__P=null,e.__c=void 0}if(o=e.__k)for(s=0;s<o.length;s++)o[s]&&F(o[s],t,n||"function"!=typeof e.type);n||null==e.__e||m(e.__e),e.__=e.__e=e.__d=void 0}function U(e,t,n){return this.constructor(e,n)}a=g.slice,f={__e:function(e,t,n,o){for(var s,r,i;t=t.__;)if((s=t.__c)&&!s.__)try{if((r=s.constructor)&&null!=r.getDerivedStateFromError&&(s.setState(r.getDerivedStateFromError(e)),i=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(e,o||{}),i=s.__d),i)return s.__E=s}catch(t){e=t}throw e}},l=0,j.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h({},this.state),"function"==typeof e&&(e=e(h({},n),this.props)),e&&h(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),C(this))},j.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),C(this))},j.prototype.render=y,b=[],u="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,c=function(e,t){return e.__v.__b-t.__v.__b},S.__r=0;var P,D,W,J,B=0,Q=[],Y=[],R=f.__b,V=f.__r,G=f.diffed,X=f.__c,K=f.unmount;function Z(e,t){f.__h&&f.__h(D,e,B||t),B=0;var n=D.__H||(D.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Y}),n.__[e]}function ee(e){return B=1,function(e,t,n){var o=Z(P++,2);if(o.t=e,!o.__c&&(o.__=[ae(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=D,!D.u)){var s=function(e,t,n){if(!o.__c.__H)return!0;var s=o.__c.__H.__.filter(function(e){return e.__c});if(s.every(function(e){return!e.__N}))return!r||r.call(this,e,t,n);var i=!1;return s.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(i=!0)}}),!(!i&&o.__c.props===e)&&(!r||r.call(this,e,t,n))};D.u=!0;var r=D.shouldComponentUpdate,i=D.componentWillUpdate;D.componentWillUpdate=function(e,t,n){if(this.__e){var o=r;r=void 0,s(e,t,n),r=o}i&&i.call(this,e,t,n)},D.shouldComponentUpdate=s}return o.__N||o.__}(ae,e)}function te(e,t){var n=Z(P++,3);!f.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.i=t,D.__H.__h.push(n))}function ne(){for(var e;e=Q.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(re),e.__H.__h.forEach(ie),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){D=null,R&&R(e)},f.__r=function(e){V&&V(e),P=0;var t=(D=e.__c).__H;t&&(W===D?(t.__h=[],D.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=Y,e.__N=e.i=void 0})):(t.__h.forEach(re),t.__h.forEach(ie),t.__h=[])),W=D},f.diffed=function(e){G&&G(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Q.push(t)&&J===f.requestAnimationFrame||((J=f.requestAnimationFrame)||se)(ne)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==Y&&(e.__=e.__V),e.i=void 0,e.__V=Y})),W=D=null},f.__c=function(e,t){t.some(function(e){try{e.__h.forEach(re),e.__h=e.__h.filter(function(e){return!e.__||ie(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],f.__e(n,e.__v)}}),X&&X(e,t)},f.unmount=function(e){K&&K(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{re(e)}catch(e){t=e}}),n.__H=void 0,t&&f.__e(t,n.__v))};var oe="function"==typeof requestAnimationFrame;function se(e){var t,n=function(){clearTimeout(o),oe&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);oe&&(t=requestAnimationFrame(n))}function re(e){var t=D,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),D=t}function ie(e){var t=D;e.__c=e.__(),D=t}function ae(e,t){return"function"==typeof t?t(e):t}const fe=(...e)=>e.filter(Boolean).join(" ");function le({children:e,isOpen:t,close:n}){const[o,s]=ee(!1);return te(()=>{s(t)},[t]),w("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},w("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},w("div",{className:fe(o?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out fb-m-4")},w("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},w("button",{type:"button",onClick:n,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},w("span",{class:"fb-sr-only"},"Close"),w("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},w("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),w("div",{className:""},e))))}const be=async(e,t)=>{const o=`${t.apiHost}/api/v1/client/environments/${t.environmentId}/displays/${e}/responded`,s=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"}});if(!s.ok){const e=await s.json();return n({code:"network_error",message:"Could not mark display as responded",status:s.status,url:o,responseMessage:e.message})}return{ok:!0,value:void 0}},de=async(e,o)=>{const s=`${o.apiHost}/api/v1/client/environments/${o.environmentId}/responses`,r=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),i=await r.json();return r.ok?t(i):n({code:"network_error",message:"Could not create response",status:r.status,url:s,responseMessage:i.message})};function ue({progress:e,brandColor:t}){return w("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},w("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:t,width:`${Math.floor(100*e)}%`}}))}function ce({headline:e,questionId:t,style:n}){return w("label",{htmlFor:t,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:n},e)}function pe({subheader:e,questionId:t}){return w("label",{htmlFor:t,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e)}function ge({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){return w("form",{onSubmit:n=>{n.preventDefault();const o={[e.id]:n.currentTarget[e.id].value};n.currentTarget[e.id].value="",t(o)}},w(ce,{headline:e.headline,questionId:e.id}),w(pe,{subheader:e.subheader,questionId:e.id}),w("div",{className:"fb-mt-4"},w("textarea",{rows:3,name:e.id,id:e.id,placeholder:e.placeholder,required:e.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),w("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},w("div",null),w("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:fb-ring-slate-500",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function _e({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){const[s,r]=ee(null);return w("form",{onSubmit:n=>{n.preventDefault(),t({[e.id]:n.currentTarget[e.id].value}),r(null)}},w(ce,{headline:e.headline,questionId:e.id}),w(pe,{subheader:e.subheader,questionId:e.id}),w("div",{className:"fb-mt-4"},w("fieldset",null,w("legend",{className:"fb-sr-only"},"Choices"),w("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},e.choices&&e.choices.map((t,n)=>w("label",{key:t.id,className:fe(s===t.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},w("span",{className:"fb-flex fb-items-center fb-text-sm"},w("input",{type:"radio",id:t.id,name:e.id,value:t.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":`${t.id}-label`,onChange:e=>{r(e.currentTarget.value)},checked:s===t.label,style:{borderColor:o,color:o},required:e.required&&0===n}),w("span",{id:`${t.id}-label`,className:"fb-ml-3 fb-font-medium"},t.label))))))),w("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},w("div",null),w("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function he({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){const[s,r]=ee([]),i=()=>s.length>0;return w("form",{onSubmit:n=>{n.preventDefault(),(i()||!e.required)&&(t({[e.id]:s}),r([]))}},w(ce,{headline:e.headline,questionId:e.id}),w(pe,{subheader:e.subheader,questionId:e.id}),w("div",{className:"fb-mt-4"},w("fieldset",null,w("legend",{className:"fb-sr-only"},"Choices"),w("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},e.choices&&e.choices.map(t=>w("label",{key:t.id,className:fe(s.includes(t.label)?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 hover:fb-bg-slate-50 focus:fb-outline-none")},w("span",{className:"fb-flex fb-items-center fb-text-sm"},w("input",{type:"checkbox",id:t.id,name:e.id,value:t.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":`${t.id}-label`,onChange:e=>{r(e.currentTarget.checked?[...s,e.currentTarget.value]:s.filter(t=>t!==e.currentTarget.value))},checked:s.includes(t.label),style:{borderColor:o,color:o}}),w("span",{id:`${t.id}-label`,className:"fb-ml-3 fb-font-medium"},t.label))))))),w("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:e.required,value:i()?"checked":""}),w("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},w("div",null),w("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function me({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){const[s,r]=ee(null);return w("form",{onSubmit:n=>{n.preventDefault(),t({[e.id]:s})}},w(ce,{headline:e.headline,questionId:e.id}),w(pe,{subheader:e.subheader,questionId:e.id}),w("div",{className:"fb-my-4"},w("fieldset",null,w("legend",{className:"fb-sr-only"},"Choices"),w("div",{className:"fb-flex"},Array.from({length:11},(e,t)=>t).map(t=>w("label",{key:t,className:fe(s===t?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},w("input",{type:"radio",name:"nps",value:t,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:()=>r(t),required:e.required}),t))),w("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},w("p",null,e.lowerLabel),w("p",null,e.upperLabel)))),w("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},w("div",null),w("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function we(e){function t(e,t){let n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){let n=e.attributes;for(let{name:o,value:s}of n)t(o,s)&&e.removeAttribute(o)}let o=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){let t=e.querySelectorAll("script");for(let e of t)e.remove()}(o),function e(t){let o=t.children;for(let t of o)n(t),e(t)}(o),o.innerHTML}function ve({htmlString:e,questionId:t}){return w("label",{htmlFor:t,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:we(e)}})}function ye({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){return w("div",null,w(ce,{headline:e.headline,questionId:e.id}),w(ve,{htmlString:e.html,questionId:e.id}),w("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},w("div",null),!e.required&&w("button",{type:"button",onClick:()=>{t({[e.id]:"dismissed"})},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},e.dismissButtonLabel||"Skip"),w("button",{type:"button",onClick:()=>{var n,o;e.buttonExternal&&e.buttonUrl&&(null==(n=window)||null==(o=n.open(e.buttonUrl,"_blank"))||o.focus()),t({[e.id]:"clicked"})},className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function je({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){return"openText"===e.type?w(ge,{question:e,onSubmit:t,lastQuestion:n,brandColor:o}):"multipleChoiceSingle"===e.type?w(_e,{question:e,onSubmit:t,lastQuestion:n,brandColor:o}):"multipleChoiceMulti"===e.type?w(he,{question:e,onSubmit:t,lastQuestion:n,brandColor:o}):"nps"===e.type?w(me,{question:e,onSubmit:t,lastQuestion:n,brandColor:o}):"cta"===e.type?w(ye,{question:e,onSubmit:t,lastQuestion:n,brandColor:o}):null}function xe({headline:e,subheader:t,brandColor:n}){return w("div",{className:"fb-text-center"},w("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:n}},w("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},w("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),w("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),w("div",null,w(ce,{headline:e,questionId:"thankYouCard",style:{"margin-right":0}}),w(pe,{subheader:t,questionId:"thankYouCard"})))}function ke({config:o,survey:s,close:r,brandColor:i,errorHandler:a}){var f;const[l,b]=ee(s.questions[0].id),[d,u]=ee(0),[c,p]=ee(null),[g,_]=ee(null),[h,m]=ee(!1);te(()=>{!async function(){const e=await(async(e,o)=>{const s=`${o.apiHost}/api/v1/client/environments/${o.environmentId}/displays`,r=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){const e=await r.json();return n({code:"network_error",message:"Could not create display",status:r.status,url:s,responseMessage:e.message})}const i=await r.json();return t(i)})({surveyId:s.id,personId:o.person.id},o);!0===e.ok?_(e.value.id):a(e.error)}()},[o,s,a]),te(()=>{u(function(){const e=s.questions.findIndex(e=>e.id===l);return e/s.questions.length}())},[l,s]);const v=async i=>{m(!0);const f=s.questions.findIndex(e=>e.id===l),d=f===s.questions.length-1,_={surveyId:s.id,personId:o.person.id,response:{finished:d,data:i}};if(c){const s=await(async(e,o,s)=>{const r=`${s.apiHost}/api/v1/client/environments/${s.environmentId}/responses/${o}`,i=await fetch(r,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await i.json();return i.ok?t(a):n({code:"network_error",message:"Could not update response",status:i.status,url:r,responseMessage:a.message})})(_,c,o);!0!==s.ok?a(s.error):_.response.finished&&e.getInstance().debug("Submitted response")}else{const[e,t]=await Promise.all([de(_,o),be(g,o)]);!0===e.ok?p(e.value.id):a(e.error)}m(!1),d?(u(100),s.thankYouCard.enabled?setTimeout(()=>{r()},2e3):r()):b(s.questions[f+1].id)};return w("div",null,w("div",{className:fe(h?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===d&&s.thankYouCard.enabled?w(xe,{headline:s.thankYouCard.headline,subheader:s.thankYouCard.subheader,brandColor:null==(f=o.settings)?void 0:f.brandColor}):s.questions.map((e,t)=>l===e.id&&w(je,{key:e.id,brandColor:i,lastQuestion:t===s.questions.length-1,onSubmit:v,question:e}))),w(ue,{progress:d,brandColor:i}))}function Ce({config:e,survey:t,closeSurvey:n,errorHandler:o}){var s;const[r,i]=ee(!0),a=()=>{i(!1),setTimeout(()=>{n()},1e3)};return w("div",{id:"fbjs"},w(le,{isOpen:r,close:a},w(ke,{config:e,survey:t,close:a,brandColor:null==(s=e.settings)?void 0:s.brandColor,errorHandler:o})))}const Se=e.getInstance(),Ne=i.getInstance(),Ie=async()=>{const e=`${Ne.get().apiHost}/api/v1/client/environments/${Ne.get().environmentId}/settings`,o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Ne.get().person.id})});if(!o.ok){const t=await o.json();return n({code:"network_error",status:o.status,message:"Error getting settings",url:e,responseMessage:t.message})}return t(await o.json())},Ee=async()=>{Se.debug("Refreshing - getting settings from backend");const e=await Ie();return!0!==e.ok?n(e.error):(Se.debug("Settings refreshed"),Ne.update({settings:e.value}),{ok:!0,value:void 0})},qe="formbricks-web-container",He=i.getInstance(),ze=e.getInstance(),Te=s.getInstance();let Le=!1;const $e=e=>{Le?ze.debug("A survey is already running. Skipping."):(Le=!0,function(e,t,n){var o,s;f.__&&f.__(e,t),o=t.__k,s=[],$(t,e=t.__k=w(y,null,[e]),o||p,p,void 0!==t.ownerSVGElement,o?null:t.firstChild?a.call(t.childNodes):null,s,o?o.__e:t.firstChild,!1),M(s,e)}(w(Ce,{config:He.get(),survey:e,closeSurvey:Me,errorHandler:Te.handle}),document.getElementById(qe)))},Me=async()=>{document.getElementById(qe).remove(),Oe(),o(await Ie(),e=>{He.update({settings:e}),Le=!1},e=>{Te.handle(e)})},Oe=()=>{const e=document.createElement("div");e.id=qe,document.body.appendChild(e)},Ae=e.getInstance(),Fe=i.getInstance(),Ue=async(e,t)=>{const o=await fetch(`${Fe.get().apiHost}/api/v1/client/environments/${Fe.get().environmentId}/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Fe.get().session.id,eventName:e,properties:t})});if(!o.ok){const e=await o.json();return n({code:"network_error",message:`Error tracking event: ${JSON.stringify(e)}`,status:o.status,url:o.url,responseMessage:e.message})}return Ae.debug(`Formbricks: Event "${e}" tracked`),Pe(e),{ok:!0,value:void 0}},Pe=e=>{for(const o of null==(t=Fe.get().settings)?void 0:t.surveys){var t;for(const t of o.triggers){var n;if((null==(n=t.eventClass)?void 0:n.name)===e)return Ae.debug(`Formbricks: survey ${o.id} triggered by event "${e}"`),void $e(o)}}},De=i.getInstance(),We=e.getInstance(),Je=s.getInstance(),Be=async()=>{We.debug("checking page url");const{settings:e}=De.get(),t=null==e?void 0:e.noCodeEvents.filter(e=>{var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0===t.length)return{ok:!0,value:void 0};for(const e of t){const{noCodeConfig:{pageUrl:t}}=e;if(!t)continue;const o=Qe(window.location.href,t.value,t.rule);if(!0!==o.ok)return n(o.error);if(!1===o.value)continue;const s=await Ue(e.name);if(!0!==s.ok)return n(s.error)}return{ok:!0,value:void 0}};function Qe(e,o,s){let r,i;switch(s){case"exactMatch":r=e===o;break;case"contains":r=e.includes(o);break;case"startsWith":r=e.startsWith(o);break;case"endsWith":r=e.endsWith(o);break;case"notMatch":r=e!==o;break;case"notContains":r=!e.includes(o);break;default:i=n({code:"invalid_match_type",message:"Invalid match type"})}return i||t(r)}const Ye=e=>{const{settings:t}=De.get(),n=null==t?void 0:t.noCodeEvents.filter(e=>{var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),s=null==t?void 0:t.noCodeEvents.filter(e=>{var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=e.target;n.forEach(e=>{var t;const n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&r.innerHTML===n.value&&Ue(e.name).then(e=>{o(e,e=>{},e=>{Je.handle(e)})})}),s.forEach(e=>{var t;const n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&r.matches(n.value)&&Ue(e.name).then(e=>{o(e,e=>{},e=>{Je.handle(e)})})})},Re=i.getInstance(),Ve=e.getInstance(),Ge=async()=>{Ve.debug("Creating new person");const e=`${Re.get().apiHost}/api/v1/client/environments/${Re.get().environmentId}/people`,o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}}),s=await o.json();return o.ok?t(s):n({code:"network_error",message:"Error creating person",status:o.status,url:e,responseMessage:s.message})},Xe=(e,t)=>{const n=Re.get().person.attributes.find(t=>{var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Ke=async e=>{if(Ve.debug("setting userId: "+e),Xe("userId",e))return Ve.debug("userId already set to this value. Skipping update."),{ok:!0,value:void 0};if((e=>{const t=Re.get().person.attributes.find(e=>{var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)});return!!t})())return n({code:"attribute_already_exists",message:"userId cannot be changed after it has been set. You need to reset first"});const o=await(async e=>{if(!Re.get().person||!Re.get().person.id)return n({code:"missing_person",message:"Unable to update userId. No person set."});const o=`${Re.get().apiHost}/api/v1/client/environments/${Re.get().environmentId}/people/${Re.get().person.id}/user-id`,s=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Re.get().session.id})}),r=await s.json();return s.ok?t(r):n({code:"network_error",message:"Error updating person",status:s.status,url:o,responseMessage:r.message})})(e);if(!0!==o.ok)return n(o.error);const{person:s,settings:r}=o.value;return Re.update({person:s,settings:r}),{ok:!0,value:void 0}},Ze=async(e,s)=>{if(Ve.debug("setting attribute: "+e+" to value: "+s),Xe(e,s))return Ve.debug("attribute already set to this value. Skipping update."),{ok:!0,value:void 0};const r=await(async(e,o)=>{if(!Re.get().person||!Re.get().person.id)return n({code:"missing_person",message:"Unable to update attribute. No person set."});const s=await fetch(`${Re.get().apiHost}/api/v1/client/environments/${Re.get().environmentId}/people/${Re.get().person.id}/attribute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:o})}),r=await s.json();return s.ok?t(r):n({code:"network_error",status:s.status,message:"Error updating person",url:s.url,responseMessage:r.message})})(e,s);let i;return o(r,({person:e,settings:t})=>{Re.update({person:e,settings:t})},e=>{i=e}),i?n(i):{ok:!0,value:void 0}},et=async()=>{let e;return Ve.debug("Resetting person. Getting new person, session and settings from backend"),o(await Ge(),({person:e,session:t,settings:n})=>{Re.update({person:e,session:t,settings:n})},t=>{e=t}),e?n(e):{ok:!0,value:void 0}},tt=e.getInstance(),nt=i.getInstance(),ot=async()=>{if(!nt.get().person)return n({code:"missing_person",message:"Unable to create session. No person found"});const e=`${nt.get().apiHost}/api/v1/client/environments/${nt.get().environmentId}/sessions`,o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:nt.get().person.id})}),s=await o.json();return o.ok?t(s):n({code:"network_error",message:"Error creating session",status:o.status,url:e,responseMessage:s.message})},st=e=>{const t=r({},e);return t.expiresAt=Date.now()+36e5,t},rt=e=>!e||e.expiresAt<=Date.now(),it=i.getInstance(),at=e.getInstance(),ft=async e=>{if(at.debug("Start initialize"),!e.environmentId)return at.debug("No environmentId provided"),n({code:"missing_field",field:"environmentId"});if(!e.apiHost)return at.debug("No apiHost provided"),n({code:"missing_field",field:"apiHost"});if(e.logLevel&&(at.debug(`Setting log level to ${e.logLevel}`),at.configure({logLevel:e.logLevel})),at.debug("Adding widget container to DOM"),Oe(),at.debug("Adding styles to DOM"),(()=>{if(null===document.getElementById("formbricks__css")){const e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs :is(.fb-sr-only){clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-4){margin-right:1rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs :is(.fb-translate-x-28){--tw-translate-x:7rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-end){justify-content:flex-end}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.fb-space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.fb-shadow-lg){--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-shadow-sm){--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-ring-1){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.focus\\:fb-ring-0:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-2:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}})(),it.get().session&&it.get().environmentId===e.environmentId&&it.get().apiHost===e.apiHost){at.debug("Found existing configuration. Checking session.");const e=it.get().session;if(rt(e)){at.debug("Session expired. Creating new session.");const e=await ot();if(!0!==e.ok)return n(e.error);const{session:t,settings:o}=e.value;it.update({session:st(t),settings:o});const s=await Ue("New Session");if(!0!==s.ok)return n(s.error)}else at.debug("Session valid. Extending session."),it.update({session:st(e)})}else{at.debug("No valid session found. Creating new config."),it.update({environmentId:e.environmentId,apiHost:e.apiHost}),at.debug("Get person, session and settings from server");const t=await Ge();if(!0!==t.ok)return n(t.error);const{person:o,session:s,settings:r}=t.value;it.update({person:o,session:st(s),settings:r});const i=await Ue("New Session");if(!0!==i.ok)return n(i.error)}return at.debug("Add session event listeners"),(()=>{if("undefined"!=typeof window){const e=window.setInterval(async()=>{await(async()=>{if(tt.debug("Checking session"),rt(nt.get().session)){tt.debug("Session expired, creating new session");const e=await ot();if(!0!==e.ok)return n(e.error);const{session:t,settings:o}=e.value;nt.update({session:t,settings:o});const s=await Ue("New Session");return!0!==s.ok?n(s.error):{ok:!0,value:void 0}}return tt.debug("Session not expired, extending session"),nt.update({session:st(nt.get().session)}),{ok:!0,value:void 0}})()},3e5);window.addEventListener("beforeunload",()=>{clearInterval(e)})}})(),at.debug("Add page url event listeners"),"undefined"!=typeof window&&(window.addEventListener("hashchange",Be),window.addEventListener("popstate",Be),window.addEventListener("pushstate",Be),window.addEventListener("replacestate",Be),window.addEventListener("load",Be)),at.debug("Add click event listeners"),"undefined"!=typeof window&&document.addEventListener("click",Ye),at.debug("Initialized"),{ok:!0,value:void 0}},lt=e.getInstance();e.getInstance().debug("Create command queue");const bt=new class{constructor(){this.queue=[],this.running=!1}add(e=!0,t,...n){lt.debug(`Add command to queue: ${t.name}(${JSON.stringify(n)})`),this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||this.run()}async run(){for(this.running=!0;this.queue.length>0;){const e=s.getInstance(),t=this.queue.shift();if(t.checkInitialized){const t=(at.debug("Check if initialized"),it.get().apiHost&&it.get().environmentId&&it.get().person&&it.get().session&&it.get().settings&&s.initialized?{ok:!0,value:void 0}:n({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));t&&!0!==t.ok&&e.handle(t.error)}const o=await t.command.apply(null,t.commandArgs);o&&(lt.debug(`Command result: ${!0===o.ok?"OK":"Something went really wrong"}, ${t.command.name}`),!0!==o.ok&&e.handle(o.error))}this.running=!1}},dt=(e,t)=>{bt.add(!0,Ze,e,t)},ut={init:e=>{s.init(e.errorHandler),bt.add(!1,ft,e)},setUserId:e=>{bt.add(!0,Ke,e)},setEmail:e=>{dt("email",e)},setAttribute:dt,track:(e,t={})=>{bt.add(!0,Ue,e,t)},logout:()=>{bt.add(!0,et)},refresh:()=>{bt.add(!0,Ee)},registerRouteChange:()=>{bt.add(!0,Be)}};export{ut as default};
//# sourceMappingURL=index.modern.js.map

@@ -1,2 +0,2 @@

function e(n,r,o){if(!n.s){if(o instanceof t){if(!o.s)return void(o.o=e.bind(null,n,r));1&r&&(r=o.s),o=o.v}if(o&&o.then)return void o.then(e.bind(null,n,r),e.bind(null,n,2));n.s=r,n.v=o;var i=n.o;i&&i(n)}}var t=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(n,r){var o=new t,i=this.s;if(i){var s=1&i?n:r;if(s){try{e(o,1,s(this.v))}catch(t){e(o,2,t)}return o}return this}return this.o=function(t){try{var i=t.v;1&t.s?e(o,1,n?n(i):i):r?e(o,1,r(i)):e(o,2,i)}catch(t){e(o,2,t)}},o},t}();function n(e){return e instanceof t&&1&e.s}var r=/*#__PURE__*/function(){function r(){this.queue=[],this.running=!1}var o=r.prototype;return o.add=function(e){this.queue.push(e),this.running||this.run()},o.run=function(){try{var r=function(){o.running=!1},o=this;o.running=!0;var i=function(r,o,i){for(var s;;){var a=r();if(n(a)&&(a=a.v),!a)return f;if(a.then){s=0;break}var f=i();if(f&&f.then){if(!n(f)){s=1;break}f=f.s}}var l=new t,u=e.bind(null,l,2);return(0===s?a.then(c):1===s?f.then(b):(void 0).then(function(){(a=r())?a.then?a.then(c).then(void 0,u):c(a):e(l,1,f)})).then(void 0,u),l;function b(t){f=t;do{if(!(a=r())||n(a)&&!a.v)return void e(l,1,f);if(a.then)return void a.then(c).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(b).then(void 0,u)}function c(t){t?(f=i())&&f.then?f.then(b).then(void 0,u):b(f):e(l,1,f)}}(function(){return o.queue.length>0},0,function(){var e=o.queue.shift(),t=function(t,n){try{var r=Promise.resolve(e()).then(function(){})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){console.error(e)});if(t&&t.then)return t.then(function(){})});return Promise.resolve(i&&i.then?i.then(r):r())}catch(e){return Promise.reject(e)}},r}();function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.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)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,f,l,u,b,c,d,p={},h=[],m=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function g(e,t){for(var n in t)e[n]=t[n];return e}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return w(e,s,r,o,null)}function w(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++l:o};return null==o&&null!=f.vnode&&f.vnode(i),i}function y(e){return e.children}function j(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?x(e):null}function k(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return k(e)}}function C(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!P.__r++||b!==f.debounceRendering)&&((b=f.debounceRendering)||c)(P)}function P(){var e,t,n,r,o,i,s,a;for(u.sort(d);e=u.shift();)e.__d&&(t=u.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=g({},i)).__v=i.__v+1,z(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?x(i):s,i.__h),F(r,i),i.__e!=s&&k(i)),u.length>t&&u.sort(d));P.__r=0}function S(e,t,n,r,o,i,s,a,f,l){var u,b,c,d,m,g,_,v=r&&r.__k||h,j=v.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(d=n.__k[u]=null==(d=t[u])||"boolean"==typeof d||"function"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?w(null,d,null,null,d):Array.isArray(d)?w(y,{children:d},null,null,null):d.__b>0?w(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(c=v[u])||c&&d.key==c.key&&d.type===c.type)v[u]=void 0;else for(b=0;b<j;b++){if((c=v[b])&&d.key==c.key&&d.type===c.type){v[b]=void 0;break}c=null}z(e,d,c=c||p,o,i,s,a,f,l),m=d.__e,(b=d.ref)&&c.ref!=b&&(_||(_=[]),c.ref&&_.push(c.ref,null,d),_.push(b,d.__c||m,d)),null!=m?(null==g&&(g=m),"function"==typeof d.type&&d.__k===c.__k?d.__d=f=N(d,f,e):f=I(e,d,c,v,m,f),"function"==typeof n.type&&(n.__d=f)):f&&c.__e==f&&f.parentNode!=e&&(f=x(c))}for(n.__e=g,u=j;u--;)null!=v[u]&&("function"==typeof n.type&&null!=v[u].__e&&v[u].__e==n.__d&&(n.__d=E(r).nextSibling),A(v[u],v[u]));if(_)for(u=0;u<_.length;u++)U(_[u],_[++u],_[++u])}function N(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?N(r,t,n):I(n,r,r,o,r.__e,t));return t}function I(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function E(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=E(n)))return r;return null}function q(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||m.test(t)?n:n+"px"}function H(e,t,n,r,o){var i;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||q(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||q(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?L:T,i):e.removeEventListener(t,i?L:T,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function T(e){return this.l[e.type+!1](f.event?f.event(e):e)}function L(e){return this.l[e.type+!0](f.event?f.event(e):e)}function z(e,t,n,r,o,i,s,a,l){var u,b,c,d,p,h,m,_,v,w,x,k,C,P,N,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(u=f.__b)&&u(t);try{e:if("function"==typeof I){if(_=t.props,v=(u=I.contextType)&&r[u.__c],w=u?v?v.props.value:u.__:r,n.__c?m=(b=t.__c=n.__c).__=b.__E:("prototype"in I&&I.prototype.render?t.__c=b=new I(_,w):(t.__c=b=new j(_,w),b.constructor=I,b.render=M),v&&v.sub(b),b.props=_,b.state||(b.state={}),b.context=w,b.__n=r,c=b.__d=!0,b.__h=[],b._sb=[]),null==b.__s&&(b.__s=b.state),null!=I.getDerivedStateFromProps&&(b.__s==b.state&&(b.__s=g({},b.__s)),g(b.__s,I.getDerivedStateFromProps(_,b.__s))),d=b.props,p=b.state,b.__v=t,c)null==I.getDerivedStateFromProps&&null!=b.componentWillMount&&b.componentWillMount(),null!=b.componentDidMount&&b.__h.push(b.componentDidMount);else{if(null==I.getDerivedStateFromProps&&_!==d&&null!=b.componentWillReceiveProps&&b.componentWillReceiveProps(_,w),!b.__e&&null!=b.shouldComponentUpdate&&!1===b.shouldComponentUpdate(_,b.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(b.props=_,b.state=b.__s,b.__d=!1),b.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),x=0;x<b._sb.length;x++)b.__h.push(b._sb[x]);b._sb=[],b.__h.length&&s.push(b);break e}null!=b.componentWillUpdate&&b.componentWillUpdate(_,b.__s,w),null!=b.componentDidUpdate&&b.__h.push(function(){b.componentDidUpdate(d,p,h)})}if(b.context=w,b.props=_,b.__P=e,k=f.__r,C=0,"prototype"in I&&I.prototype.render){for(b.state=b.__s,b.__d=!1,k&&k(t),u=b.render(b.props,b.state,b.context),P=0;P<b._sb.length;P++)b.__h.push(b._sb[P]);b._sb=[]}else do{b.__d=!1,k&&k(t),u=b.render(b.props,b.state,b.context),b.state=b.__s}while(b.__d&&++C<25);b.state=b.__s,null!=b.getChildContext&&(r=g(g({},r),b.getChildContext())),c||null==b.getSnapshotBeforeUpdate||(h=b.getSnapshotBeforeUpdate(d,p)),N=null!=u&&u.type===y&&null==u.key?u.props.children:u,S(e,Array.isArray(N)?N:[N],t,n,r,o,i,s,a,l),b.base=t.__e,t.__h=null,b.__h.length&&s.push(b),m&&(b.__E=b.__=null),b.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=O(n.__e,t,n,r,o,i,s,l);(u=f.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=a,t.__h=!!l,i[i.indexOf(a)]=null),f.__e(e,t,n)}}function F(e,t){f.__c&&f.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){f.__e(e,t.__v)}})}function O(e,t,n,r,o,i,s,f){var l,u,b,c=n.props,d=t.props,h=t.type,m=0;if("svg"===h&&(o=!0),null!=i)for(;m<i.length;m++)if((l=i[m])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,i[m]=null;break}if(null==e){if(null===h)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,d.is&&d),i=null,f=!1}if(null===h)c===d||f&&e.data===d||(e.data=d);else{if(i=i&&a.call(e.childNodes),u=(c=n.props||p).dangerouslySetInnerHTML,b=d.dangerouslySetInnerHTML,!f){if(null!=i)for(c={},m=0;m<e.attributes.length;m++)c[e.attributes[m].name]=e.attributes[m].value;(b||u)&&(b&&(u&&b.__html==u.__html||b.__html===e.innerHTML)||(e.innerHTML=b&&b.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||H(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||H(e,i,t[i],n[i],r)}(e,d,c,o,f),b)t.__k=[];else if(m=t.props.children,S(e,Array.isArray(m)?m:[m],t,n,r,o&&"foreignObject"!==h,i,s,i?i[0]:n.__k&&x(n,0),f),null!=i)for(m=i.length;m--;)null!=i[m]&&_(i[m]);f||("value"in d&&void 0!==(m=d.value)&&(m!==e.value||"progress"===h&&!m||"option"===h&&m!==c.value)&&H(e,"value",m,c.value,!1),"checked"in d&&void 0!==(m=d.checked)&&m!==e.checked&&H(e,"checked",m,c.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){f.__e(e,n)}}function A(e,t,n){var r,o;if(f.unmount&&f.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){f.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&A(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||_(e.__e),e.__=e.__e=e.__d=void 0}function M(e,t,n){return this.constructor(e,n)}a=h.slice,f={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},l=0,j.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),C(this))},j.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),C(this))},j.prototype.render=y,u=[],c="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,d=function(e,t){return e.__v.__b-t.__v.__b},P.__r=0;var D,W,B,Q,J=0,Y=[],R=[],V=f.__b,X=f.__r,$=f.diffed,G=f.__c,K=f.unmount;function Z(e,t){f.__h&&f.__h(W,e,J||t),J=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:R}),n.__[e]}function ee(e){return J=1,function(e,t,n){var r=Z(D++,2);if(r.t=e,!r.__c&&(r.__=[ae(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},W.shouldComponentUpdate=o}return r.__N||r.__}(ae,e)}function te(e,t){var n=Z(D++,3);!f.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.i=t,W.__H.__h.push(n))}function ne(){for(var e;e=Y.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ie),e.__H.__h.forEach(se),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){W=null,V&&V(e)},f.__r=function(e){X&&X(e),D=0;var t=(W=e.__c).__H;t&&(B===W?(t.__h=[],W.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=R,e.__N=e.i=void 0})):(t.__h.forEach(ie),t.__h.forEach(se),t.__h=[])),B=W},f.diffed=function(e){$&&$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Y.push(t)&&Q===f.requestAnimationFrame||((Q=f.requestAnimationFrame)||oe)(ne)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==R&&(e.__=e.__V),e.i=void 0,e.__V=R})),B=W=null},f.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ie),e.__h=e.__h.filter(function(e){return!e.__||se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],f.__e(n,e.__v)}}),G&&G(e,t)},f.unmount=function(e){K&&K(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ie(e)}catch(e){t=e}}),n.__H=void 0,t&&f.__e(t,n.__v))};var re="function"==typeof requestAnimationFrame;function oe(e){var t,n=function(){clearTimeout(r),re&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);re&&(t=requestAnimationFrame(n))}function ie(e){var t=W,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),W=t}function se(e){var t=W;e.__c=e.__(),W=t}function ae(e,t){return"function"==typeof t?t(e):t}var fe=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function le(e){var t=e.children,n=e.isOpen,r=e.close,o=ee(!1),i=o[0],s=o[1];return te(function(){s(n)},[n]),v("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},v("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},v("div",{className:fe(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out fb-m-4")},v("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},v("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},v("span",{class:"fb-sr-only"},"Close"),v("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),v("div",{className:""},t))))}var ue=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){if(!e.ok)throw new Error("Could not update display")})}catch(e){return Promise.reject(e)}},be=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/responses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}};function ce(e){return v("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},v("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function de(e){return v("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function pe(e){return v("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function he(e){var t=e.headline,n=e.subheader;return v("div",{className:"fb-text-center"},v("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},v("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),v("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),v("div",null,v(de,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),v(pe,{subheader:n,questionId:"thankYouCard"})))}function me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ge(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return v("label",{key:e.id,className:fe(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},checked:s===e.label,style:{borderColor:o,color:o},required:t.required&&0===n}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function _e(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee([]),s=i[0],a=i[1],f=function(){return s.length>0};return v("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return v("label",{key:e.id,className:fe(s.includes(e.label)?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 hover:fb-bg-slate-50 focus:fb-outline-none")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"checkbox",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.checked?[].concat(s,[e.currentTarget.value]):s.filter(function(t){return t!==e.currentTarget.value}))},checked:s.includes(e.label),style:{borderColor:o,color:o}}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:t.required,value:f()?"checked":""}),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-my-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return v("label",{key:e,className:fe(s===e?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},v("input",{type:"radio",name:"nps",value:e,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:function(){return a(e)},required:t.required}),e)})),v("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},v("p",null,t.lowerLabel),v("p",null,t.upperLabel)))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function we(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=s(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=s(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=s(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function ye(e){return v("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:we(e.htmlString)}})}function je(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return v("div",null,v(de,{headline:t.headline,questionId:t.id}),v(ye,{htmlString:t.html,questionId:t.id}),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},v("div",null),!t.required&&v("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),v("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?v(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?v(ge,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?v(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?v(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?v(je,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function ke(e){var t,n=e.config,r=e.survey,o=e.close,i=e.brandColor,s=ee(r.questions[0].id),a=s[0],f=s[1],l=ee(0),u=l[0],b=l[1],c=ee(null),d=c[0],p=c[1],h=ee(null),m=h[0],g=h[1],_=ee(!1),w=_[0],y=_[1];te(function(){!function(){try{Promise.resolve(function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create display");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}({surveyId:r.id,personId:n.person.id},n)).then(function(e){g(e.id)})}catch(e){return Promise.reject(e)}}()},[n,r]),te(function(){var e;b((e=r.questions.findIndex(function(e){return e.id===a}),e/r.questions.length))},[a,r]);var j=function(e){try{var t=function(){y(!1),s?(b(100),r.thankYouCard.enabled?setTimeout(function(){o()},2e3):o()):f(r.questions[i+1].id)};y(!0);var i=r.questions.findIndex(function(e){return e.id===a}),s=i===r.questions.length-1,l={surveyId:r.id,personId:n.person.id,response:{finished:s,data:e}},u=d?Promise.resolve(function(e,t,n){try{return Promise.resolve(fetch(n.apiHost+"/api/v1/client/environments/"+n.environmentId+"/responses/"+t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw new Error("Could not update response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}(l,d,n)).then(function(){}):Promise.resolve(Promise.all([be(l,n),ue(m,n)])).then(function(e){p(e[0].id)});return Promise.resolve(u&&u.then?u.then(t):t())}catch(e){return Promise.reject(e)}};return v("div",null,v("div",{className:fe(w?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===u&&r.thankYouCard.enabled?v(he,{headline:r.thankYouCard.headline,subheader:r.thankYouCard.subheader,brandColor:null==(t=n.settings)?void 0:t.brandColor}):r.questions.map(function(e,t){return a===e.id&&v(xe,{key:e.id,brandColor:i,lastQuestion:t===r.questions.length-1,onSubmit:j,question:e})})),v(ce,{progress:u,brandColor:i}))}function Ce(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=ee(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return v("div",{id:"fbjs"},v(le,{isOpen:i[0],close:a},v(ke,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var Pe=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=o({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){localStorage.setItem("formbricksConfig",JSON.stringify(this.config))},e}();Pe.instance=void 0;var Se=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();Se.instance=void 0;var Ne=Se.getInstance(),Ie=Pe.getInstance(),Ee=function(){try{return Promise.resolve(fetch(Ie.get().apiHost+"/api/v1/client/environments/"+Ie.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Ie.get().person.id})})).then(function(e){if(!e.ok)throw Ne.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},qe="formbricks-web-container",He=Pe.getInstance(),Te=Se.getInstance(),Le=!1,ze=function(e){Le?Te.debug("A survey is already running. Skipping."):(Le=!0,function(e,t,n){var r,o;f.__&&f.__(e,t),r=t.__k,o=[],z(t,e=t.__k=v(y,null,[e]),r||p,p,void 0!==t.ownerSVGElement,r?null:t.firstChild?a.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),F(o,e)}(v(Ce,{config:He.get(),survey:e,closeSurvey:Fe}),document.getElementById(qe)))},Fe=function(){try{return document.getElementById(qe).remove(),Oe(),Promise.resolve(Ee()).then(function(e){He.update({settings:e}),Le=!1})}catch(e){return Promise.reject(e)}},Oe=function(){var e=document.createElement("div");e.id=qe,document.body.appendChild(e)},Ue=Se.getInstance(),Ae=Pe.getInstance(),Me=function(e,t){try{return Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Ae.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;Ue.debug('Formbricks: Event "'+e+'" tracked'),De(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){Ue.error("Formbricks: Error tracking event: "+JSON.stringify(e)),n=1})}();return o&&o.then?o.then(r):r(o)})}catch(e){return Promise.reject(e)}},De=function(e){for(var t,n=s(null==(r=Ae.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,a=s(i.triggers);!(o=a()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return Ue.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void ze(i)}},We=Pe.getInstance(),Be=Se.getInstance(),Qe=function(){try{return Be.debug("Creating new person"),Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/people",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){return e.ok?Promise.resolve(e.json()):(console.error("Formbricks: Error fetching person"),null)})}catch(e){return Promise.reject(e)}},Je=function(e,t){var n=We.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Ye=Se.getInstance(),Re=Pe.getInstance(),Ve=function(){try{return Re.get().person?Promise.resolve(fetch(Re.get().apiHost+"/api/v1/client/environments/"+Re.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Re.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Ye.error("Error creating session")}):(Ye.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},Xe=function(e){var t=o({},e);return t.expiresAt=Date.now()+36e5,t},$e=function(e){return!e||e.expiresAt<=Date.now()},Ge=Pe.getInstance(),Ke=Se.getInstance(),Ze=function(){var e=Ge.get().settings,t=null==e?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Ke.debug("checking page url"),0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&et(window.location.href,i.value,i.rule)&&Me(o.name)}};function et(e,t,n){switch(n){case"exactMatch":return e===t;case"contains":return e.includes(t);case"startsWith":return e.startsWith(t);case"endsWith":return e.endsWith(t);case"notMatch":return e!==t;case"notContains":return!e.includes(t);default:throw new Error("Invalid match type")}}var tt=function(e){var t=Ge.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&o.innerHTML===n.value&&Me(e.name)}),r.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&o.matches(n.value)&&Me(e.name)})},nt=Pe.getInstance(),rt=Se.getInstance(),ot=function(){if(!(nt.get().apiHost&&nt.get().environmentId&&nt.get().person&&nt.get().session&&nt.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},it=new r,st=function(e,t){it.add(function(){try{return ot(),Promise.resolve(function(e,t){try{return Be.debug("setting attribute: "+e+" to value: "+t),Je(e,t)?(Be.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return We.get().person&&We.get().person.id?Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/people/"+We.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})})).then(function(e){return Promise.resolve(e.json()).then(function(t){if(!e.ok)throw Be.error("Error updating person"),Error("Error updating person");return t})}):(console.error("Formbricks: Unable to update attribute. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e,t)).then(function(e){var t=e.person,n=e.settings;if(!t||!n)throw Be.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");We.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},at={init:function(e){it.add(function(){try{return function(e){try{var t=function(){(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Ye.debug("Session not expired, extending session"),Re.update({session:Xe(Re.get().session)})};Ye.debug("Checking session");var t=function(){if($e(Re.get().session))return Ye.debug("Session expired, creating new session"),Promise.resolve(Ve()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Ye.error("Error creating new session"),Error("Error creating new session");Re.update({session:t,settings:n}),Me("New Session")})}();return Promise.resolve(t&&t.then?t.then(e):e())}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ze),window.addEventListener("popstate",Ze),window.addEventListener("pushstate",Ze),window.addEventListener("replacestate",Ze),window.addEventListener("load",Ze)),"undefined"!=typeof window&&document.addEventListener("click",tt),rt.debug("Initialized")};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&rt.configure({logLevel:e.logLevel}),Oe(),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs :is(.fb-sr-only){clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-4){margin-right:1rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs :is(.fb-translate-x-28){--tw-translate-x:7rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-end){justify-content:flex-end}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.fb-space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.fb-shadow-lg){--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-shadow-sm){--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-ring-1){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.focus\\:fb-ring-0:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-2:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var n=function(){if(!nt.get().session||nt.get().environmentId!==e.environmentId||nt.get().apiHost!==e.apiHost)return rt.debug("No valid session found. Creating new config."),nt.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Qe()).then(function(e){var t=e.settings;nt.update({person:e.person,session:Xe(e.session),settings:t}),Me("New Session")});rt.debug("Found existing configuration. Checking session.");var t=nt.get().session,n=function(){if($e(t))return rt.debug("Session expired. Creating new session."),Promise.resolve(Ve()).then(function(e){var t=e.settings;nt.update({session:Xe(e.session),settings:t}),Me("New Session")});rt.debug("Session valid. Extending session."),nt.update({session:Xe(t)})}();return n&&n.then?n.then(function(){}):void 0}();Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){it.add(function(){try{return ot(),Promise.resolve(function(e){try{return Be.debug("setting userId: "+e),Je("userId",e)?(Be.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=We.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Be.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return We.get().person&&We.get().person.id?Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/people/"+We.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:We.get().session.id})})).then(function(e){if(!e.ok)throw Be.error("Formbricks: Error updating person"),Error("Error updating person");return Promise.resolve(e.json())}):(console.error("Formbricks: Unable to update userId. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e)).then(function(e){We.update({person:e.person,settings:e.settings})}))}catch(e){return Promise.reject(e)}var t}(e)).then(function(){})}catch(e){return Promise.reject(e)}})},setEmail:function(e){st("email",e)},setAttribute:st,track:function(e,t){void 0===t&&(t={}),it.add(function(){try{return ot(),Promise.resolve(Me(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){it.add(function(){try{return ot(),Promise.resolve(function(){try{return Be.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Qe()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Be.error("Error resetting user"),new Error("Formbricks: Error resetting user");We.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){it.add(function(){try{return ot(),Promise.resolve(function(){try{return Ne.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){Ie.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){it.add(function(){try{return ot(),Ze(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};export{at as default};
var e=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();e.instance=void 0;var t=function(e){return{ok:!0,value:e}},n=function(e){return{ok:!1,error:e}};function r(e,t,n){return!0===e.ok?t(e.value):n(e.error)}e.getInstance();var o=/*#__PURE__*/function(){function t(t){this.handleError=void 0,this.handleError=t||function(t){return e.getInstance().error(JSON.stringify(t))}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.init=function(e){this.initialized=!0,console.log("🧱 Formbricks - initializing error handler"),console.log("🧱 Formbricks - Custom error handler: ","function"==typeof e?"yes":"no"),t.instance=new t(e)},t.prototype.handle=function(e){this.handleError(e)},t}();function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.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)?s(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}o.instance=void 0,o.initialized=!1;var f=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=i({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){var e,t=this;return(e=function(){return localStorage.setItem("formbricksConfig",JSON.stringify(t.config))},function(){try{return{ok:!0,value:e.apply(void 0,[].slice.call(arguments))}}catch(e){return{ok:!1,error:e}}})()},e}();f.instance=void 0;var l,u,c,b,d,p,h,g={},m=[],v=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function _(e,t){for(var n in t)e[n]=t[n];return e}function w(e){var t=e.parentNode;t&&t.removeChild(e)}function y(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?l.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return j(e,s,r,o,null)}function j(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++c:o};return null==o&&null!=u.vnode&&u.vnode(i),i}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?C(e):null}function S(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return S(e)}}function P(e){(!e.__d&&(e.__d=!0)&&b.push(e)&&!I.__r++||d!==u.debounceRendering)&&((d=u.debounceRendering)||p)(I)}function I(){var e,t,n,r,o,i,s,a;for(b.sort(h);e=b.shift();)e.__d&&(t=b.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=_({},i)).__v=i.__v+1,A(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?C(i):s,i.__h),O(r,i),i.__e!=s&&S(i)),b.length>t&&b.sort(h));I.__r=0}function N(e,t,n,r,o,i,s,a,f,l){var u,c,b,d,p,h,v,_=r&&r.__k||m,w=_.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(d=n.__k[u]=null==(d=t[u])||"boolean"==typeof d||"function"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?j(null,d,null,null,d):Array.isArray(d)?j(x,{children:d},null,null,null):d.__b>0?j(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(b=_[u])||b&&d.key==b.key&&d.type===b.type)_[u]=void 0;else for(c=0;c<w;c++){if((b=_[c])&&d.key==b.key&&d.type===b.type){_[c]=void 0;break}b=null}A(e,d,b=b||g,o,i,s,a,f,l),p=d.__e,(c=d.ref)&&b.ref!=c&&(v||(v=[]),b.ref&&v.push(b.ref,null,d),v.push(c,d.__c||p,d)),null!=p?(null==h&&(h=p),"function"==typeof d.type&&d.__k===b.__k?d.__d=f=E(d,f,e):f=q(e,d,b,_,p,f),"function"==typeof n.type&&(n.__d=f)):f&&b.__e==f&&f.parentNode!=e&&(f=C(b))}for(n.__e=h,u=w;u--;)null!=_[u]&&("function"==typeof n.type&&null!=_[u].__e&&_[u].__e==n.__d&&(n.__d=H(r).nextSibling),D(_[u],_[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function E(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?E(r,t,n):q(n,r,r,o,r.__e,t));return t}function q(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function H(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=H(n)))return r;return null}function T(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||v.test(t)?n:n+"px"}function z(e,t,n,r,o){var i;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||T(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||T(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?M:L,i):e.removeEventListener(t,i?M:L,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function L(e){return this.l[e.type+!1](u.event?u.event(e):e)}function M(e){return this.l[e.type+!0](u.event?u.event(e):e)}function A(e,t,n,r,o,i,s,a,f){var l,c,b,d,p,h,g,m,v,w,y,j,C,S,P,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(f=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(l=u.__b)&&l(t);try{e:if("function"==typeof I){if(m=t.props,v=(l=I.contextType)&&r[l.__c],w=l?v?v.props.value:l.__:r,n.__c?g=(c=t.__c=n.__c).__=c.__E:("prototype"in I&&I.prototype.render?t.__c=c=new I(m,w):(t.__c=c=new k(m,w),c.constructor=I,c.render=W),v&&v.sub(c),c.props=m,c.state||(c.state={}),c.context=w,c.__n=r,b=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=I.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=_({},c.__s)),_(c.__s,I.getDerivedStateFromProps(m,c.__s))),d=c.props,p=c.state,c.__v=t,b)null==I.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==I.getDerivedStateFromProps&&m!==d&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(m,w),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(m,c.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=m,c.state=c.__s,c.__d=!1),c.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),y=0;y<c._sb.length;y++)c.__h.push(c._sb[y]);c._sb=[],c.__h.length&&s.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(m,c.__s,w),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(d,p,h)})}if(c.context=w,c.props=m,c.__P=e,j=u.__r,C=0,"prototype"in I&&I.prototype.render){for(c.state=c.__s,c.__d=!1,j&&j(t),l=c.render(c.props,c.state,c.context),S=0;S<c._sb.length;S++)c.__h.push(c._sb[S]);c._sb=[]}else do{c.__d=!1,j&&j(t),l=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++C<25);c.state=c.__s,null!=c.getChildContext&&(r=_(_({},r),c.getChildContext())),b||null==c.getSnapshotBeforeUpdate||(h=c.getSnapshotBeforeUpdate(d,p)),P=null!=l&&l.type===x&&null==l.key?l.props.children:l,N(e,Array.isArray(P)?P:[P],t,n,r,o,i,s,a,f),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),g&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=F(n.__e,t,n,r,o,i,s,f);(l=u.diffed)&&l(t)}catch(e){t.__v=null,(f||null!=i)&&(t.__e=a,t.__h=!!f,i[i.indexOf(a)]=null),u.__e(e,t,n)}}function O(e,t){u.__c&&u.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u.__e(e,t.__v)}})}function F(e,t,n,r,o,i,s,a){var f,u,c,b=n.props,d=t.props,p=t.type,h=0;if("svg"===p&&(o=!0),null!=i)for(;h<i.length;h++)if((f=i[h])&&"setAttribute"in f==!!p&&(p?f.localName===p:3===f.nodeType)){e=f,i[h]=null;break}if(null==e){if(null===p)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,d.is&&d),i=null,a=!1}if(null===p)b===d||a&&e.data===d||(e.data=d);else{if(i=i&&l.call(e.childNodes),u=(b=n.props||g).dangerouslySetInnerHTML,c=d.dangerouslySetInnerHTML,!a){if(null!=i)for(b={},h=0;h<e.attributes.length;h++)b[e.attributes[h].name]=e.attributes[h].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||z(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||z(e,i,t[i],n[i],r)}(e,d,b,o,a),c)t.__k=[];else if(h=t.props.children,N(e,Array.isArray(h)?h:[h],t,n,r,o&&"foreignObject"!==p,i,s,i?i[0]:n.__k&&C(n,0),a),null!=i)for(h=i.length;h--;)null!=i[h]&&w(i[h]);a||("value"in d&&void 0!==(h=d.value)&&(h!==e.value||"progress"===p&&!h||"option"===p&&h!==b.value)&&z(e,"value",h,b.value,!1),"checked"in d&&void 0!==(h=d.checked)&&h!==e.checked&&z(e,"checked",h,b.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){u.__e(e,n)}}function D(e,t,n){var r,o;if(u.unmount&&u.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){u.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&D(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||w(e.__e),e.__=e.__e=e.__d=void 0}function W(e,t,n){return this.constructor(e,n)}l=m.slice,u={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},c=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=_({},this.state),"function"==typeof e&&(e=e(_({},n),this.props)),e&&_(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),P(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),P(this))},k.prototype.render=x,b=[],p="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0;var J,B,Q,Y,R=0,V=[],G=[],X=u.__b,$=u.__r,K=u.diffed,Z=u.__c,ee=u.unmount;function te(e,t){u.__h&&u.__h(B,e,R||t),R=0;var n=B.__H||(B.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:G}),n.__[e]}function ne(e){return R=1,function(e,t,n){var r=te(J++,2);if(r.t=e,!r.__c&&(r.__=[le(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=B,!B.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};B.u=!0;var i=B.shouldComponentUpdate,s=B.componentWillUpdate;B.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},B.shouldComponentUpdate=o}return r.__N||r.__}(le,e)}function re(e,t){var n=te(J++,3);!u.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.i=t,B.__H.__h.push(n))}function oe(){for(var e;e=V.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ae),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){B=null,X&&X(e)},u.__r=function(e){$&&$(e),J=0;var t=(B=e.__c).__H;t&&(Q===B?(t.__h=[],B.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=G,e.__N=e.i=void 0})):(t.__h.forEach(ae),t.__h.forEach(fe),t.__h=[])),Q=B},u.diffed=function(e){K&&K(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==V.push(t)&&Y===u.requestAnimationFrame||((Y=u.requestAnimationFrame)||se)(oe)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==G&&(e.__=e.__V),e.i=void 0,e.__V=G})),Q=B=null},u.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ae),e.__h=e.__h.filter(function(e){return!e.__||fe(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],u.__e(n,e.__v)}}),Z&&Z(e,t)},u.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ae(e)}catch(e){t=e}}),n.__H=void 0,t&&u.__e(t,n.__v))};var ie="function"==typeof requestAnimationFrame;function se(e){var t,n=function(){clearTimeout(r),ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ie&&(t=requestAnimationFrame(n))}function ae(e){var t=B,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),B=t}function fe(e){var t=B;e.__c=e.__(),B=t}function le(e,t){return"function"==typeof t?t(e):t}var ue=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function ce(e){var t=e.children,n=e.isOpen,r=e.close,o=ne(!1),i=o[0],s=o[1];return re(function(){s(n)},[n]),y("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},y("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},y("div",{className:ue(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out fb-m-4")},y("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},y("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},y("span",{class:"fb-sr-only"},"Close"),y("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),y("div",{className:""},t))))}var be=function(e,t){try{var r=t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){var t;function o(e){return t?e:{ok:!0,value:void 0}}var i=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(o){var i=n({code:"network_error",message:"Could not mark display as responded",status:e.status,url:r,responseMessage:o.message});return t=1,i})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},de=function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/responses";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not create response",status:e.status,url:o,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}};function pe(e){return y("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},y("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function he(e){return y("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function ge(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return y("label",{key:e.id,className:ue(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},checked:s===e.label,style:{borderColor:o,color:o},required:t.required&&0===n}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function _e(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne([]),s=i[0],a=i[1],f=function(){return s.length>0};return y("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return y("label",{key:e.id,className:ue(s.includes(e.label)?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 hover:fb-bg-slate-50 focus:fb-outline-none")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("input",{type:"checkbox",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.checked?[].concat(s,[e.currentTarget.value]):s.filter(function(t){return t!==e.currentTarget.value}))},checked:s.includes(e.label),style:{borderColor:o,color:o}}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:t.required,value:f()?"checked":""}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return y("label",{key:e,className:ue(s===e?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},y("input",{type:"radio",name:"nps",value:e,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:function(){return a(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ye(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=a(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=a(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=a(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function je(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:ye(e.htmlString)}})}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("div",null,y(he,{headline:t.headline,questionId:t.id}),y(je,{htmlString:t.html,questionId:t.id}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},y("div",null),!t.required&&y("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),y("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ke(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?y(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?y(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?y(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?y(we,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?y(xe,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function Ce(e){var t=e.headline,n=e.subheader;return y("div",{className:"fb-text-center"},y("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),y("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),y("div",null,y(he,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),y(ge,{subheader:n,questionId:"thankYouCard"})))}function Se(r){var o,i=r.config,s=r.survey,a=r.close,f=r.brandColor,l=r.errorHandler,u=ne(s.questions[0].id),c=u[0],b=u[1],d=ne(0),p=d[0],h=d[1],g=ne(null),m=g[0],v=g[1],_=ne(null),w=_[0],j=_[1],x=ne(!1),k=x[0],C=x[1];re(function(){!function(){try{Promise.resolve(function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/displays";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){var r;function i(n){return r?n:Promise.resolve(e.json()).then(t)}var s=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(t){var i=n({code:"network_error",message:"Could not create display",status:e.status,url:o,responseMessage:t.message});return r=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}}({surveyId:s.id,personId:i.person.id},i)).then(function(e){!0===e.ok?j(e.value.id):l(e.error)})}catch(e){return Promise.reject(e)}}()},[i,s,l]),re(function(){var e;h((e=s.questions.findIndex(function(e){return e.id===c}),e/s.questions.length))},[c,s]);var S=function(r){try{var o=function(){C(!1),u?(h(100),s.thankYouCard.enabled?setTimeout(function(){a()},2e3):a()):b(s.questions[f+1].id)};C(!0);var f=s.questions.findIndex(function(e){return e.id===c}),u=f===s.questions.length-1,d={surveyId:s.id,personId:i.person.id,response:{finished:u,data:r}},p=m?Promise.resolve(function(e,r,o){try{var i=o.apiHost+"/api/v1/client/environments/"+o.environmentId+"/responses/"+r;return Promise.resolve(fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not update response",status:e.status,url:i,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}}(d,m,i)).then(function(t){!0!==t.ok?l(t.error):d.response.finished&&e.getInstance().debug("Submitted response")}):Promise.resolve(Promise.all([de(d,i),be(w,i)])).then(function(e){var t=e[0];!0===t.ok?v(t.value.id):l(t.error)});return Promise.resolve(p&&p.then?p.then(o):o())}catch(e){return Promise.reject(e)}};return y("div",null,y("div",{className:ue(k?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===p&&s.thankYouCard.enabled?y(Ce,{headline:s.thankYouCard.headline,subheader:s.thankYouCard.subheader,brandColor:null==(o=i.settings)?void 0:o.brandColor}):s.questions.map(function(e,t){return c===e.id&&y(ke,{key:e.id,brandColor:f,lastQuestion:t===s.questions.length-1,onSubmit:S,question:e})})),y(pe,{progress:p,brandColor:f}))}function Pe(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=e.errorHandler,s=ne(!0),a=s[1],f=function(){a(!1),setTimeout(function(){o()},1e3)};return y("div",{id:"fbjs"},y(ce,{isOpen:s[0],close:f},y(Se,{config:n,survey:r,close:f,brandColor:null==(t=n.settings)?void 0:t.brandColor,errorHandler:i})))}var Ie=e.getInstance(),Ne=f.getInstance(),Ee=function(){try{var e=Ne.get().apiHost+"/api/v1/client/environments/"+Ne.get().environmentId+"/settings";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Ne.get().person.id})})).then(function(r){var o;function i(e){return o?e:Promise.resolve(r.json()).then(t)}var s=function(){if(!r.ok)return Promise.resolve(r.json()).then(function(t){var i=n({code:"network_error",status:r.status,message:"Error getting settings",url:e,responseMessage:t.message});return o=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}},qe=function(){try{return Ie.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){return!0!==e.ok?n(e.error):(Ie.debug("Settings refreshed"),Ne.update({settings:e.value}),{ok:!0,value:void 0})})}catch(e){return Promise.reject(e)}},He="formbricks-web-container",Te=f.getInstance(),ze=e.getInstance(),Le=o.getInstance(),Me=!1,Ae=function(e){Me?ze.debug("A survey is already running. Skipping."):(Me=!0,function(e,t,n){var r,o;u.__&&u.__(e,t),r=t.__k,o=[],A(t,e=t.__k=y(x,null,[e]),r||g,g,void 0!==t.ownerSVGElement,r?null:t.firstChild?l.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),O(o,e)}(y(Pe,{config:Te.get(),survey:e,closeSurvey:Oe,errorHandler:Le.handle}),document.getElementById(He)))},Oe=function(){try{return document.getElementById(He).remove(),Fe(),Promise.resolve(Ee()).then(function(e){r(e,function(e){Te.update({settings:e}),Me=!1},function(e){Le.handle(e)})})}catch(e){return Promise.reject(e)}},Fe=function(){var e=document.createElement("div");e.id=He,document.body.appendChild(e)},Ue=e.getInstance(),De=f.getInstance(),We=function(e,t){try{return Promise.resolve(fetch(De.get().apiHost+"/api/v1/client/environments/"+De.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:De.get().session.id,eventName:e,properties:t})})).then(function(t){var r;function o(t){return r?t:(Ue.debug('Formbricks: Event "'+e+'" tracked'),Je(e),{ok:!0,value:void 0})}var i=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){var o=n({code:"network_error",message:"Error tracking event: "+JSON.stringify(e),status:t.status,url:t.url,responseMessage:e.message});return r=1,o})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},Je=function(e){for(var t,n=a(null==(r=De.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,s=a(i.triggers);!(o=s()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return Ue.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ae(i)}},Be="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Qe(e,t,n){if(!e.s){if(n instanceof Ye){if(!n.s)return void(n.o=Qe.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Qe.bind(null,e,t),Qe.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Ye=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Qe(r,1,i(this.v))}catch(e){Qe(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Qe(r,1,t?t(o):o):n?Qe(r,1,n(o)):Qe(r,2,o)}catch(e){Qe(r,2,e)}},r},e}();function Re(e){return e instanceof Ye&&1&e.s}var Ve=f.getInstance(),Ge=e.getInstance(),Xe=o.getInstance(),$e=function(){try{var e,r=function(t){return e?t:{ok:!0,value:void 0}};Ge.debug("checking page url");var o=Ve.get().settings,i=null==o?void 0:o.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0===i.length)return Promise.resolve({ok:!0,value:void 0});var s=function(e,t,n){if("function"==typeof e[Be]){var r,o,i,s=e[Be]();if(function e(a){try{for(;!((r=s.next()).done||n&&n());)if((a=t(r.value))&&a.then){if(!Re(a))return void a.then(e,i||(i=Qe.bind(null,o=new Ye,2)));a=a.v}o?Qe(o,1,a):o=a}catch(e){Qe(o||(o=new Ye),2,e)}}(),s.return){var a=function(e){try{r.done||s.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<e.length;l++)f.push(e[l]);return function(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!Re(a))return void a.then(s,o||(o=Qe.bind(null,r=new Ye,2)));a=a.v}r?Qe(r,1,a):r=a}catch(e){Qe(r||(r=new Ye),2,e)}}(),r}(f,function(e){return t(f[e])},n)}(i,function(r){var o=r.noCodeConfig.pageUrl;if(o){var i=function(e,r,o){var i,s;switch(o){case"exactMatch":i=e===r;break;case"contains":i=e.includes(r);break;case"startsWith":i=e.startsWith(r);break;case"endsWith":i=e.endsWith(r);break;case"notMatch":i=e!==r;break;case"notContains":i=!e.includes(r);break;default:s=n({code:"invalid_match_type",message:"Invalid match type"})}return s||t(i)}(window.location.href,o.value,o.rule);if(!0!==i.ok){var s=n(i.error);return e=1,s}if(!1!==i.value)return Promise.resolve(We(r.name)).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}})}},function(){return e});return Promise.resolve(s&&s.then?s.then(r):r(s))}catch(e){return Promise.reject(e)}},Ke=function(e){var t=Ve.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),i=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&i.innerHTML===n.value&&We(e.name).then(function(e){r(e,function(e){},function(e){Xe.handle(e)})})}),o.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&i.matches(n.value)&&We(e.name).then(function(e){r(e,function(e){},function(e){Xe.handle(e)})})})},Ze=f.getInstance(),et=e.getInstance(),tt=function(){try{et.debug("Creating new person");var e=Ze.get().apiHost+"/api/v1/client/environments/"+Ze.get().environmentId+"/people";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating person",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},nt=function(e,t){var n=Ze.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},rt=function(e){try{return et.debug("setting userId: "+e),nt("userId",e)?(et.debug("userId already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):(r=Ze.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),r?Promise.resolve(n({code:"attribute_already_exists",message:"userId cannot be changed after it has been set. You need to reset first"})):Promise.resolve(function(e){try{if(!Ze.get().person||!Ze.get().person.id)return Promise.resolve(n({code:"missing_person",message:"Unable to update userId. No person set."}));var r=Ze.get().apiHost+"/api/v1/client/environments/"+Ze.get().environmentId+"/people/"+Ze.get().person.id+"/user-id";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Ze.get().session.id})})).then(function(e){return Promise.resolve(e.json()).then(function(o){return e.ok?t(o):n({code:"network_error",message:"Error updating person",status:e.status,url:r,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){if(!0!==e.ok)return n(e.error);var t=e.value;return Ze.update({person:t.person,settings:t.settings}),{ok:!0,value:void 0}}))}catch(e){return Promise.reject(e)}var r},ot=function(e,o){try{return et.debug("setting attribute: "+e+" to value: "+o),nt(e,o)?(et.debug("attribute already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):Promise.resolve(function(e,r){try{return Ze.get().person&&Ze.get().person.id?Promise.resolve(fetch(Ze.get().apiHost+"/api/v1/client/environments/"+Ze.get().environmentId+"/people/"+Ze.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:r})})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",status:e.status,message:"Error updating person",url:e.url,responseMessage:r.message})})}):Promise.resolve(n({code:"missing_person",message:"Unable to update attribute. No person set."}))}catch(e){return Promise.reject(e)}}(e,o)).then(function(e){var t;return r(e,function(e){Ze.update({person:e.person,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},it=function(){try{return et.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(tt()).then(function(e){var t;return r(e,function(e){Ze.update({person:e.person,session:e.session,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},st=e.getInstance(),at=f.getInstance(),ft=function(){try{if(!at.get().person)return Promise.resolve(n({code:"missing_person",message:"Unable to create session. No person found"}));var e=at.get().apiHost+"/api/v1/client/environments/"+at.get().environmentId+"/sessions";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:at.get().person.id})})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating session",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},lt=function(e){var t=i({},e);return t.expiresAt=Date.now()+36e5,t},ut=function(e){return!e||e.expiresAt<=Date.now()},ct=f.getInstance(),bt=e.getInstance(),dt=function(e){try{var t,r=function(e){return t?e:(bt.debug("Add session event listeners"),function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e,t=function(t){return e?t:(st.debug("Session not expired, extending session"),at.update({session:lt(at.get().session)}),{ok:!0,value:void 0})};st.debug("Checking session");var r=function(){if(ut(at.get().session))return st.debug("Session expired, creating new session"),Promise.resolve(ft()).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}var o=t.value;return at.update({session:o.session,settings:o.settings}),Promise.resolve(We("New Session")).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}return e=1,{ok:!0,value:void 0}})})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}}(),bt.debug("Add page url event listeners"),"undefined"!=typeof window&&(window.addEventListener("hashchange",$e),window.addEventListener("popstate",$e),window.addEventListener("pushstate",$e),window.addEventListener("replacestate",$e),window.addEventListener("load",$e)),bt.debug("Add click event listeners"),"undefined"!=typeof window&&document.addEventListener("click",Ke),bt.debug("Initialized"),{ok:!0,value:void 0})};if(bt.debug("Start initialize"),!e.environmentId)return bt.debug("No environmentId provided"),Promise.resolve(n({code:"missing_field",field:"environmentId"}));if(!e.apiHost)return bt.debug("No apiHost provided"),Promise.resolve(n({code:"missing_field",field:"apiHost"}));e.logLevel&&(bt.debug("Setting log level to "+e.logLevel),bt.configure({logLevel:e.logLevel})),bt.debug("Adding widget container to DOM"),Fe(),bt.debug("Adding styles to DOM"),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs :is(.fb-sr-only){clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-4){margin-right:1rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs :is(.fb-translate-x-28){--tw-translate-x:7rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-end){justify-content:flex-end}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.fb-space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.fb-shadow-lg){--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-shadow-sm){--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-ring-1){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.focus\\:fb-ring-0:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-2:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var o=function(){if(ct.get().session&&ct.get().environmentId===e.environmentId&&ct.get().apiHost===e.apiHost){bt.debug("Found existing configuration. Checking session.");var r=ct.get().session;return function(){if(ut(r))return bt.debug("Session expired. Creating new session."),Promise.resolve(ft()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({session:lt(o.session),settings:i}),Promise.resolve(We("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})});bt.debug("Session valid. Extending session."),ct.update({session:lt(r)})}()}return bt.debug("No valid session found. Creating new config."),ct.update({environmentId:e.environmentId,apiHost:e.apiHost}),bt.debug("Get person, session and settings from server"),Promise.resolve(tt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({person:o.person,session:lt(o.session),settings:i}),Promise.resolve(We("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})})}();return Promise.resolve(o&&o.then?o.then(r):r(o))}catch(e){return Promise.reject(e)}};function pt(e,t,n){if(!e.s){if(n instanceof gt){if(!n.s)return void(n.o=pt.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(pt.bind(null,e,t),pt.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var ht=e.getInstance();const gt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{pt(r,1,e(this.v))}catch(e){pt(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?pt(r,1,t?t(o):o):n?pt(r,1,n(o)):pt(r,2,o)}catch(e){pt(r,2,e)}},r},e}();function mt(e){return e instanceof gt&&1&e.s}var vt=/*#__PURE__*/function(){function e(){this.queue=[],this.running=!1}var t=e.prototype;return t.add=function(e,t){void 0===e&&(e=!0);var n=[].slice.call(arguments,2);ht.debug("Add command to queue: "+t.name+"("+JSON.stringify(n)+")"),this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||this.run()},t.run=function(){try{var e=function(){t.running=!1},t=this;t.running=!0;var r=function(e,t,n){for(var r;;){var o=e();if(mt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!mt(i)){r=1;break}i=i.s}}var s=new gt,a=pt.bind(null,s,2);return(0===r?o.then(l):1===r?i.then(f):(void 0).then(function(){(o=e())?o.then?o.then(l).then(void 0,a):l(o):pt(s,1,i)})).then(void 0,a),s;function f(t){i=t;do{if(!(o=e())||mt(o)&&!o.v)return void pt(s,1,i);if(o.then)return void o.then(l).then(void 0,a);mt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(f).then(void 0,a)}function l(e){e?(i=n())&&i.then?i.then(f).then(void 0,a):f(i):pt(s,1,i)}}(function(){return t.queue.length>0},0,function(){var e=o.getInstance(),r=t.queue.shift();if(r.checkInitialized){var i=(bt.debug("Check if initialized"),ct.get().apiHost&&ct.get().environmentId&&ct.get().person&&ct.get().session&&ct.get().settings&&o.initialized?{ok:!0,value:void 0}:n({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));i&&!0!==i.ok&&e.handle(i.error)}return Promise.resolve(r.command.apply(null,r.commandArgs)).then(function(t){t&&(ht.debug("Command result: "+(!0===t.ok?"OK":"Something went really wrong")+", "+r.command.name),!0!==t.ok&&e.handle(t.error))})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},e}();e.getInstance().debug("Create command queue");var _t=new vt,wt=function(e,t){_t.add(!0,ot,e,t)},yt={init:function(e){o.init(e.errorHandler),_t.add(!1,dt,e)},setUserId:function(e){_t.add(!0,rt,e)},setEmail:function(e){wt("email",e)},setAttribute:wt,track:function(e,t){void 0===t&&(t={}),_t.add(!0,We,e,t)},logout:function(){_t.add(!0,it)},refresh:function(){_t.add(!0,qe)},registerRouteChange:function(){_t.add(!0,$e)}};export{yt as default};
//# sourceMappingURL=index.module.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).js=t()}(this,function(){function e(n,r,o){if(!n.s){if(o instanceof t){if(!o.s)return void(o.o=e.bind(null,n,r));1&r&&(r=o.s),o=o.v}if(o&&o.then)return void o.then(e.bind(null,n,r),e.bind(null,n,2));n.s=r,n.v=o;var i=n.o;i&&i(n)}}var t=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(n,r){var o=new t,i=this.s;if(i){var s=1&i?n:r;if(s){try{e(o,1,s(this.v))}catch(t){e(o,2,t)}return o}return this}return this.o=function(t){try{var i=t.v;1&t.s?e(o,1,n?n(i):i):r?e(o,1,r(i)):e(o,2,i)}catch(t){e(o,2,t)}},o},t}();function n(e){return e instanceof t&&1&e.s}var r=/*#__PURE__*/function(){function r(){this.queue=[],this.running=!1}var o=r.prototype;return o.add=function(e){this.queue.push(e),this.running||this.run()},o.run=function(){try{var r=function(){o.running=!1},o=this;o.running=!0;var i=function(r,o,i){for(var s;;){var a=r();if(n(a)&&(a=a.v),!a)return f;if(a.then){s=0;break}var f=i();if(f&&f.then){if(!n(f)){s=1;break}f=f.s}}var l=new t,u=e.bind(null,l,2);return(0===s?a.then(c):1===s?f.then(b):(void 0).then(function(){(a=r())?a.then?a.then(c).then(void 0,u):c(a):e(l,1,f)})).then(void 0,u),l;function b(t){f=t;do{if(!(a=r())||n(a)&&!a.v)return void e(l,1,f);if(a.then)return void a.then(c).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(b).then(void 0,u)}function c(t){t?(f=i())&&f.then?f.then(b).then(void 0,u):b(f):e(l,1,f)}}(function(){return o.queue.length>0},0,function(){var e=o.queue.shift(),t=function(t,n){try{var r=Promise.resolve(e()).then(function(){})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){console.error(e)});if(t&&t.then)return t.then(function(){})});return Promise.resolve(i&&i.then?i.then(r):r())}catch(e){return Promise.reject(e)}},r}();function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.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)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,f,l,u,b,c,d,p={},h=[],m=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function g(e,t){for(var n in t)e[n]=t[n];return e}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return w(e,s,r,o,null)}function w(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++l:o};return null==o&&null!=f.vnode&&f.vnode(i),i}function y(e){return e.children}function j(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?x(e):null}function k(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return k(e)}}function C(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!P.__r++||b!==f.debounceRendering)&&((b=f.debounceRendering)||c)(P)}function P(){var e,t,n,r,o,i,s,a;for(u.sort(d);e=u.shift();)e.__d&&(t=u.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=g({},i)).__v=i.__v+1,z(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?x(i):s,i.__h),F(r,i),i.__e!=s&&k(i)),u.length>t&&u.sort(d));P.__r=0}function S(e,t,n,r,o,i,s,a,f,l){var u,b,c,d,m,g,_,v=r&&r.__k||h,j=v.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(d=n.__k[u]=null==(d=t[u])||"boolean"==typeof d||"function"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?w(null,d,null,null,d):Array.isArray(d)?w(y,{children:d},null,null,null):d.__b>0?w(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(c=v[u])||c&&d.key==c.key&&d.type===c.type)v[u]=void 0;else for(b=0;b<j;b++){if((c=v[b])&&d.key==c.key&&d.type===c.type){v[b]=void 0;break}c=null}z(e,d,c=c||p,o,i,s,a,f,l),m=d.__e,(b=d.ref)&&c.ref!=b&&(_||(_=[]),c.ref&&_.push(c.ref,null,d),_.push(b,d.__c||m,d)),null!=m?(null==g&&(g=m),"function"==typeof d.type&&d.__k===c.__k?d.__d=f=N(d,f,e):f=I(e,d,c,v,m,f),"function"==typeof n.type&&(n.__d=f)):f&&c.__e==f&&f.parentNode!=e&&(f=x(c))}for(n.__e=g,u=j;u--;)null!=v[u]&&("function"==typeof n.type&&null!=v[u].__e&&v[u].__e==n.__d&&(n.__d=E(r).nextSibling),A(v[u],v[u]));if(_)for(u=0;u<_.length;u++)U(_[u],_[++u],_[++u])}function N(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?N(r,t,n):I(n,r,r,o,r.__e,t));return t}function I(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function E(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=E(n)))return r;return null}function q(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||m.test(t)?n:n+"px"}function T(e,t,n,r,o){var i;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||q(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||q(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?L:H,i):e.removeEventListener(t,i?L:H,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function H(e){return this.l[e.type+!1](f.event?f.event(e):e)}function L(e){return this.l[e.type+!0](f.event?f.event(e):e)}function z(e,t,n,r,o,i,s,a,l){var u,b,c,d,p,h,m,_,v,w,x,k,C,P,N,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(u=f.__b)&&u(t);try{e:if("function"==typeof I){if(_=t.props,v=(u=I.contextType)&&r[u.__c],w=u?v?v.props.value:u.__:r,n.__c?m=(b=t.__c=n.__c).__=b.__E:("prototype"in I&&I.prototype.render?t.__c=b=new I(_,w):(t.__c=b=new j(_,w),b.constructor=I,b.render=M),v&&v.sub(b),b.props=_,b.state||(b.state={}),b.context=w,b.__n=r,c=b.__d=!0,b.__h=[],b._sb=[]),null==b.__s&&(b.__s=b.state),null!=I.getDerivedStateFromProps&&(b.__s==b.state&&(b.__s=g({},b.__s)),g(b.__s,I.getDerivedStateFromProps(_,b.__s))),d=b.props,p=b.state,b.__v=t,c)null==I.getDerivedStateFromProps&&null!=b.componentWillMount&&b.componentWillMount(),null!=b.componentDidMount&&b.__h.push(b.componentDidMount);else{if(null==I.getDerivedStateFromProps&&_!==d&&null!=b.componentWillReceiveProps&&b.componentWillReceiveProps(_,w),!b.__e&&null!=b.shouldComponentUpdate&&!1===b.shouldComponentUpdate(_,b.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(b.props=_,b.state=b.__s,b.__d=!1),b.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),x=0;x<b._sb.length;x++)b.__h.push(b._sb[x]);b._sb=[],b.__h.length&&s.push(b);break e}null!=b.componentWillUpdate&&b.componentWillUpdate(_,b.__s,w),null!=b.componentDidUpdate&&b.__h.push(function(){b.componentDidUpdate(d,p,h)})}if(b.context=w,b.props=_,b.__P=e,k=f.__r,C=0,"prototype"in I&&I.prototype.render){for(b.state=b.__s,b.__d=!1,k&&k(t),u=b.render(b.props,b.state,b.context),P=0;P<b._sb.length;P++)b.__h.push(b._sb[P]);b._sb=[]}else do{b.__d=!1,k&&k(t),u=b.render(b.props,b.state,b.context),b.state=b.__s}while(b.__d&&++C<25);b.state=b.__s,null!=b.getChildContext&&(r=g(g({},r),b.getChildContext())),c||null==b.getSnapshotBeforeUpdate||(h=b.getSnapshotBeforeUpdate(d,p)),N=null!=u&&u.type===y&&null==u.key?u.props.children:u,S(e,Array.isArray(N)?N:[N],t,n,r,o,i,s,a,l),b.base=t.__e,t.__h=null,b.__h.length&&s.push(b),m&&(b.__E=b.__=null),b.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=O(n.__e,t,n,r,o,i,s,l);(u=f.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=a,t.__h=!!l,i[i.indexOf(a)]=null),f.__e(e,t,n)}}function F(e,t){f.__c&&f.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){f.__e(e,t.__v)}})}function O(e,t,n,r,o,i,s,f){var l,u,b,c=n.props,d=t.props,h=t.type,m=0;if("svg"===h&&(o=!0),null!=i)for(;m<i.length;m++)if((l=i[m])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,i[m]=null;break}if(null==e){if(null===h)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,d.is&&d),i=null,f=!1}if(null===h)c===d||f&&e.data===d||(e.data=d);else{if(i=i&&a.call(e.childNodes),u=(c=n.props||p).dangerouslySetInnerHTML,b=d.dangerouslySetInnerHTML,!f){if(null!=i)for(c={},m=0;m<e.attributes.length;m++)c[e.attributes[m].name]=e.attributes[m].value;(b||u)&&(b&&(u&&b.__html==u.__html||b.__html===e.innerHTML)||(e.innerHTML=b&&b.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||T(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||T(e,i,t[i],n[i],r)}(e,d,c,o,f),b)t.__k=[];else if(m=t.props.children,S(e,Array.isArray(m)?m:[m],t,n,r,o&&"foreignObject"!==h,i,s,i?i[0]:n.__k&&x(n,0),f),null!=i)for(m=i.length;m--;)null!=i[m]&&_(i[m]);f||("value"in d&&void 0!==(m=d.value)&&(m!==e.value||"progress"===h&&!m||"option"===h&&m!==c.value)&&T(e,"value",m,c.value,!1),"checked"in d&&void 0!==(m=d.checked)&&m!==e.checked&&T(e,"checked",m,c.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){f.__e(e,n)}}function A(e,t,n){var r,o;if(f.unmount&&f.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){f.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&A(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||_(e.__e),e.__=e.__e=e.__d=void 0}function M(e,t,n){return this.constructor(e,n)}a=h.slice,f={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},l=0,j.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),C(this))},j.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),C(this))},j.prototype.render=y,u=[],c="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,d=function(e,t){return e.__v.__b-t.__v.__b},P.__r=0;var D,W,B,Q,J=0,Y=[],R=[],V=f.__b,X=f.__r,$=f.diffed,G=f.__c,K=f.unmount;function Z(e,t){f.__h&&f.__h(W,e,J||t),J=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:R}),n.__[e]}function ee(e){return J=1,function(e,t,n){var r=Z(D++,2);if(r.t=e,!r.__c&&(r.__=[ae(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},W.shouldComponentUpdate=o}return r.__N||r.__}(ae,e)}function te(e,t){var n=Z(D++,3);!f.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.i=t,W.__H.__h.push(n))}function ne(){for(var e;e=Y.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ie),e.__H.__h.forEach(se),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){W=null,V&&V(e)},f.__r=function(e){X&&X(e),D=0;var t=(W=e.__c).__H;t&&(B===W?(t.__h=[],W.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=R,e.__N=e.i=void 0})):(t.__h.forEach(ie),t.__h.forEach(se),t.__h=[])),B=W},f.diffed=function(e){$&&$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Y.push(t)&&Q===f.requestAnimationFrame||((Q=f.requestAnimationFrame)||oe)(ne)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==R&&(e.__=e.__V),e.i=void 0,e.__V=R})),B=W=null},f.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ie),e.__h=e.__h.filter(function(e){return!e.__||se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],f.__e(n,e.__v)}}),G&&G(e,t)},f.unmount=function(e){K&&K(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ie(e)}catch(e){t=e}}),n.__H=void 0,t&&f.__e(t,n.__v))};var re="function"==typeof requestAnimationFrame;function oe(e){var t,n=function(){clearTimeout(r),re&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);re&&(t=requestAnimationFrame(n))}function ie(e){var t=W,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),W=t}function se(e){var t=W;e.__c=e.__(),W=t}function ae(e,t){return"function"==typeof t?t(e):t}var fe=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function le(e){var t=e.children,n=e.isOpen,r=e.close,o=ee(!1),i=o[0],s=o[1];return te(function(){s(n)},[n]),v("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},v("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},v("div",{className:fe(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out fb-m-4")},v("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},v("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},v("span",{class:"fb-sr-only"},"Close"),v("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),v("div",{className:""},t))))}var ue=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){if(!e.ok)throw new Error("Could not update display")})}catch(e){return Promise.reject(e)}},be=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/responses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}};function ce(e){return v("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},v("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function de(e){return v("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function pe(e){return v("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function he(e){var t=e.headline,n=e.subheader;return v("div",{className:"fb-text-center"},v("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},v("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),v("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),v("div",null,v(de,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),v(pe,{subheader:n,questionId:"thankYouCard"})))}function me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ge(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return v("label",{key:e.id,className:fe(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},checked:s===e.label,style:{borderColor:o,color:o},required:t.required&&0===n}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function _e(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee([]),s=i[0],a=i[1],f=function(){return s.length>0};return v("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return v("label",{key:e.id,className:fe(s.includes(e.label)?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 hover:fb-bg-slate-50 focus:fb-outline-none")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"checkbox",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.checked?[].concat(s,[e.currentTarget.value]):s.filter(function(t){return t!==e.currentTarget.value}))},checked:s.includes(e.label),style:{borderColor:o,color:o}}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:t.required,value:f()?"checked":""}),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-my-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return v("label",{key:e,className:fe(s===e?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},v("input",{type:"radio",name:"nps",value:e,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:function(){return a(e)},required:t.required}),e)})),v("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},v("p",null,t.lowerLabel),v("p",null,t.upperLabel)))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function we(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=s(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=s(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=s(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function ye(e){return v("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:we(e.htmlString)}})}function je(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return v("div",null,v(de,{headline:t.headline,questionId:t.id}),v(ye,{htmlString:t.html,questionId:t.id}),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},v("div",null),!t.required&&v("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),v("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?v(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?v(ge,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?v(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?v(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?v(je,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function ke(e){var t,n=e.config,r=e.survey,o=e.close,i=e.brandColor,s=ee(r.questions[0].id),a=s[0],f=s[1],l=ee(0),u=l[0],b=l[1],c=ee(null),d=c[0],p=c[1],h=ee(null),m=h[0],g=h[1],_=ee(!1),w=_[0],y=_[1];te(function(){!function(){try{Promise.resolve(function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create display");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}({surveyId:r.id,personId:n.person.id},n)).then(function(e){g(e.id)})}catch(e){return Promise.reject(e)}}()},[n,r]),te(function(){var e;b((e=r.questions.findIndex(function(e){return e.id===a}),e/r.questions.length))},[a,r]);var j=function(e){try{var t=function(){y(!1),s?(b(100),r.thankYouCard.enabled?setTimeout(function(){o()},2e3):o()):f(r.questions[i+1].id)};y(!0);var i=r.questions.findIndex(function(e){return e.id===a}),s=i===r.questions.length-1,l={surveyId:r.id,personId:n.person.id,response:{finished:s,data:e}},u=d?Promise.resolve(function(e,t,n){try{return Promise.resolve(fetch(n.apiHost+"/api/v1/client/environments/"+n.environmentId+"/responses/"+t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw new Error("Could not update response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}(l,d,n)).then(function(){}):Promise.resolve(Promise.all([be(l,n),ue(m,n)])).then(function(e){p(e[0].id)});return Promise.resolve(u&&u.then?u.then(t):t())}catch(e){return Promise.reject(e)}};return v("div",null,v("div",{className:fe(w?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===u&&r.thankYouCard.enabled?v(he,{headline:r.thankYouCard.headline,subheader:r.thankYouCard.subheader,brandColor:null==(t=n.settings)?void 0:t.brandColor}):r.questions.map(function(e,t){return a===e.id&&v(xe,{key:e.id,brandColor:i,lastQuestion:t===r.questions.length-1,onSubmit:j,question:e})})),v(ce,{progress:u,brandColor:i}))}function Ce(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=ee(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return v("div",{id:"fbjs"},v(le,{isOpen:i[0],close:a},v(ke,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var Pe=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=o({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){localStorage.setItem("formbricksConfig",JSON.stringify(this.config))},e}();Pe.instance=void 0;var Se=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();Se.instance=void 0;var Ne=Se.getInstance(),Ie=Pe.getInstance(),Ee=function(){try{return Promise.resolve(fetch(Ie.get().apiHost+"/api/v1/client/environments/"+Ie.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Ie.get().person.id})})).then(function(e){if(!e.ok)throw Ne.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},qe="formbricks-web-container",Te=Pe.getInstance(),He=Se.getInstance(),Le=!1,ze=function(e){Le?He.debug("A survey is already running. Skipping."):(Le=!0,function(e,t,n){var r,o;f.__&&f.__(e,t),r=t.__k,o=[],z(t,e=t.__k=v(y,null,[e]),r||p,p,void 0!==t.ownerSVGElement,r?null:t.firstChild?a.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),F(o,e)}(v(Ce,{config:Te.get(),survey:e,closeSurvey:Fe}),document.getElementById(qe)))},Fe=function(){try{return document.getElementById(qe).remove(),Oe(),Promise.resolve(Ee()).then(function(e){Te.update({settings:e}),Le=!1})}catch(e){return Promise.reject(e)}},Oe=function(){var e=document.createElement("div");e.id=qe,document.body.appendChild(e)},Ue=Se.getInstance(),Ae=Pe.getInstance(),Me=function(e,t){try{return Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Ae.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;Ue.debug('Formbricks: Event "'+e+'" tracked'),De(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){Ue.error("Formbricks: Error tracking event: "+JSON.stringify(e)),n=1})}();return o&&o.then?o.then(r):r(o)})}catch(e){return Promise.reject(e)}},De=function(e){for(var t,n=s(null==(r=Ae.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,a=s(i.triggers);!(o=a()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return Ue.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void ze(i)}},We=Pe.getInstance(),Be=Se.getInstance(),Qe=function(){try{return Be.debug("Creating new person"),Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/people",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){return e.ok?Promise.resolve(e.json()):(console.error("Formbricks: Error fetching person"),null)})}catch(e){return Promise.reject(e)}},Je=function(e,t){var n=We.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Ye=Se.getInstance(),Re=Pe.getInstance(),Ve=function(){try{return Re.get().person?Promise.resolve(fetch(Re.get().apiHost+"/api/v1/client/environments/"+Re.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Re.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Ye.error("Error creating session")}):(Ye.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},Xe=function(e){var t=o({},e);return t.expiresAt=Date.now()+36e5,t},$e=function(e){return!e||e.expiresAt<=Date.now()},Ge=Pe.getInstance(),Ke=Se.getInstance(),Ze=function(){var e=Ge.get().settings,t=null==e?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Ke.debug("checking page url"),0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&et(window.location.href,i.value,i.rule)&&Me(o.name)}};function et(e,t,n){switch(n){case"exactMatch":return e===t;case"contains":return e.includes(t);case"startsWith":return e.startsWith(t);case"endsWith":return e.endsWith(t);case"notMatch":return e!==t;case"notContains":return!e.includes(t);default:throw new Error("Invalid match type")}}var tt=function(e){var t=Ge.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&o.innerHTML===n.value&&Me(e.name)}),r.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&o.matches(n.value)&&Me(e.name)})},nt=Pe.getInstance(),rt=Se.getInstance(),ot=function(){if(!(nt.get().apiHost&&nt.get().environmentId&&nt.get().person&&nt.get().session&&nt.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},it=new r,st=function(e,t){it.add(function(){try{return ot(),Promise.resolve(function(e,t){try{return Be.debug("setting attribute: "+e+" to value: "+t),Je(e,t)?(Be.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return We.get().person&&We.get().person.id?Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/people/"+We.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})})).then(function(e){return Promise.resolve(e.json()).then(function(t){if(!e.ok)throw Be.error("Error updating person"),Error("Error updating person");return t})}):(console.error("Formbricks: Unable to update attribute. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e,t)).then(function(e){var t=e.person,n=e.settings;if(!t||!n)throw Be.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");We.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},at={init:function(e){it.add(function(){try{return function(e){try{var t=function(){(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Ye.debug("Session not expired, extending session"),Re.update({session:Xe(Re.get().session)})};Ye.debug("Checking session");var t=function(){if($e(Re.get().session))return Ye.debug("Session expired, creating new session"),Promise.resolve(Ve()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Ye.error("Error creating new session"),Error("Error creating new session");Re.update({session:t,settings:n}),Me("New Session")})}();return Promise.resolve(t&&t.then?t.then(e):e())}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ze),window.addEventListener("popstate",Ze),window.addEventListener("pushstate",Ze),window.addEventListener("replacestate",Ze),window.addEventListener("load",Ze)),"undefined"!=typeof window&&document.addEventListener("click",tt),rt.debug("Initialized")};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&rt.configure({logLevel:e.logLevel}),Oe(),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs :is(.fb-sr-only){clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-4){margin-right:1rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs :is(.fb-translate-x-28){--tw-translate-x:7rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-end){justify-content:flex-end}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.fb-space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.fb-shadow-lg){--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-shadow-sm){--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-ring-1){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.focus\\:fb-ring-0:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-2:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var n=function(){if(!nt.get().session||nt.get().environmentId!==e.environmentId||nt.get().apiHost!==e.apiHost)return rt.debug("No valid session found. Creating new config."),nt.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Qe()).then(function(e){var t=e.settings;nt.update({person:e.person,session:Xe(e.session),settings:t}),Me("New Session")});rt.debug("Found existing configuration. Checking session.");var t=nt.get().session,n=function(){if($e(t))return rt.debug("Session expired. Creating new session."),Promise.resolve(Ve()).then(function(e){var t=e.settings;nt.update({session:Xe(e.session),settings:t}),Me("New Session")});rt.debug("Session valid. Extending session."),nt.update({session:Xe(t)})}();return n&&n.then?n.then(function(){}):void 0}();Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){it.add(function(){try{return ot(),Promise.resolve(function(e){try{return Be.debug("setting userId: "+e),Je("userId",e)?(Be.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=We.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Be.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return We.get().person&&We.get().person.id?Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/people/"+We.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:We.get().session.id})})).then(function(e){if(!e.ok)throw Be.error("Formbricks: Error updating person"),Error("Error updating person");return Promise.resolve(e.json())}):(console.error("Formbricks: Unable to update userId. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e)).then(function(e){We.update({person:e.person,settings:e.settings})}))}catch(e){return Promise.reject(e)}var t}(e)).then(function(){})}catch(e){return Promise.reject(e)}})},setEmail:function(e){st("email",e)},setAttribute:st,track:function(e,t){void 0===t&&(t={}),it.add(function(){try{return ot(),Promise.resolve(Me(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){it.add(function(){try{return ot(),Promise.resolve(function(){try{return Be.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Qe()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Be.error("Error resetting user"),new Error("Formbricks: Error resetting user");We.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){it.add(function(){try{return ot(),Promise.resolve(function(){try{return Ne.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){Ie.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){it.add(function(){try{return ot(),Ze(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};return at});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).js=t()}(this,function(){var e=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();e.instance=void 0;var t=function(e){return{ok:!0,value:e}},n=function(e){return{ok:!1,error:e}};function r(e,t,n){return!0===e.ok?t(e.value):n(e.error)}e.getInstance();var o=/*#__PURE__*/function(){function t(t){this.handleError=void 0,this.handleError=t||function(t){return e.getInstance().error(JSON.stringify(t))}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.init=function(e){this.initialized=!0,console.log("🧱 Formbricks - initializing error handler"),console.log("🧱 Formbricks - Custom error handler: ","function"==typeof e?"yes":"no"),t.instance=new t(e)},t.prototype.handle=function(e){this.handleError(e)},t}();function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.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)?s(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}o.instance=void 0,o.initialized=!1;var f=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=i({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){var e,t=this;return(e=function(){return localStorage.setItem("formbricksConfig",JSON.stringify(t.config))},function(){try{return{ok:!0,value:e.apply(void 0,[].slice.call(arguments))}}catch(e){return{ok:!1,error:e}}})()},e}();f.instance=void 0;var l,u,c,b,d,p,h,g={},m=[],v=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function _(e,t){for(var n in t)e[n]=t[n];return e}function w(e){var t=e.parentNode;t&&t.removeChild(e)}function y(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?l.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return j(e,s,r,o,null)}function j(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++c:o};return null==o&&null!=u.vnode&&u.vnode(i),i}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?C(e):null}function S(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return S(e)}}function P(e){(!e.__d&&(e.__d=!0)&&b.push(e)&&!I.__r++||d!==u.debounceRendering)&&((d=u.debounceRendering)||p)(I)}function I(){var e,t,n,r,o,i,s,a;for(b.sort(h);e=b.shift();)e.__d&&(t=b.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=_({},i)).__v=i.__v+1,A(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?C(i):s,i.__h),O(r,i),i.__e!=s&&S(i)),b.length>t&&b.sort(h));I.__r=0}function N(e,t,n,r,o,i,s,a,f,l){var u,c,b,d,p,h,v,_=r&&r.__k||m,w=_.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(d=n.__k[u]=null==(d=t[u])||"boolean"==typeof d||"function"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?j(null,d,null,null,d):Array.isArray(d)?j(x,{children:d},null,null,null):d.__b>0?j(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(b=_[u])||b&&d.key==b.key&&d.type===b.type)_[u]=void 0;else for(c=0;c<w;c++){if((b=_[c])&&d.key==b.key&&d.type===b.type){_[c]=void 0;break}b=null}A(e,d,b=b||g,o,i,s,a,f,l),p=d.__e,(c=d.ref)&&b.ref!=c&&(v||(v=[]),b.ref&&v.push(b.ref,null,d),v.push(c,d.__c||p,d)),null!=p?(null==h&&(h=p),"function"==typeof d.type&&d.__k===b.__k?d.__d=f=E(d,f,e):f=q(e,d,b,_,p,f),"function"==typeof n.type&&(n.__d=f)):f&&b.__e==f&&f.parentNode!=e&&(f=C(b))}for(n.__e=h,u=w;u--;)null!=_[u]&&("function"==typeof n.type&&null!=_[u].__e&&_[u].__e==n.__d&&(n.__d=H(r).nextSibling),D(_[u],_[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function E(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?E(r,t,n):q(n,r,r,o,r.__e,t));return t}function q(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function H(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=H(n)))return r;return null}function T(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||v.test(t)?n:n+"px"}function z(e,t,n,r,o){var i;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||T(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||T(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?M:L,i):e.removeEventListener(t,i?M:L,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function L(e){return this.l[e.type+!1](u.event?u.event(e):e)}function M(e){return this.l[e.type+!0](u.event?u.event(e):e)}function A(e,t,n,r,o,i,s,a,f){var l,c,b,d,p,h,g,m,v,w,y,j,C,S,P,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(f=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(l=u.__b)&&l(t);try{e:if("function"==typeof I){if(m=t.props,v=(l=I.contextType)&&r[l.__c],w=l?v?v.props.value:l.__:r,n.__c?g=(c=t.__c=n.__c).__=c.__E:("prototype"in I&&I.prototype.render?t.__c=c=new I(m,w):(t.__c=c=new k(m,w),c.constructor=I,c.render=W),v&&v.sub(c),c.props=m,c.state||(c.state={}),c.context=w,c.__n=r,b=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=I.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=_({},c.__s)),_(c.__s,I.getDerivedStateFromProps(m,c.__s))),d=c.props,p=c.state,c.__v=t,b)null==I.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==I.getDerivedStateFromProps&&m!==d&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(m,w),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(m,c.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=m,c.state=c.__s,c.__d=!1),c.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),y=0;y<c._sb.length;y++)c.__h.push(c._sb[y]);c._sb=[],c.__h.length&&s.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(m,c.__s,w),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(d,p,h)})}if(c.context=w,c.props=m,c.__P=e,j=u.__r,C=0,"prototype"in I&&I.prototype.render){for(c.state=c.__s,c.__d=!1,j&&j(t),l=c.render(c.props,c.state,c.context),S=0;S<c._sb.length;S++)c.__h.push(c._sb[S]);c._sb=[]}else do{c.__d=!1,j&&j(t),l=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++C<25);c.state=c.__s,null!=c.getChildContext&&(r=_(_({},r),c.getChildContext())),b||null==c.getSnapshotBeforeUpdate||(h=c.getSnapshotBeforeUpdate(d,p)),P=null!=l&&l.type===x&&null==l.key?l.props.children:l,N(e,Array.isArray(P)?P:[P],t,n,r,o,i,s,a,f),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),g&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=F(n.__e,t,n,r,o,i,s,f);(l=u.diffed)&&l(t)}catch(e){t.__v=null,(f||null!=i)&&(t.__e=a,t.__h=!!f,i[i.indexOf(a)]=null),u.__e(e,t,n)}}function O(e,t){u.__c&&u.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u.__e(e,t.__v)}})}function F(e,t,n,r,o,i,s,a){var f,u,c,b=n.props,d=t.props,p=t.type,h=0;if("svg"===p&&(o=!0),null!=i)for(;h<i.length;h++)if((f=i[h])&&"setAttribute"in f==!!p&&(p?f.localName===p:3===f.nodeType)){e=f,i[h]=null;break}if(null==e){if(null===p)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,d.is&&d),i=null,a=!1}if(null===p)b===d||a&&e.data===d||(e.data=d);else{if(i=i&&l.call(e.childNodes),u=(b=n.props||g).dangerouslySetInnerHTML,c=d.dangerouslySetInnerHTML,!a){if(null!=i)for(b={},h=0;h<e.attributes.length;h++)b[e.attributes[h].name]=e.attributes[h].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||z(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||z(e,i,t[i],n[i],r)}(e,d,b,o,a),c)t.__k=[];else if(h=t.props.children,N(e,Array.isArray(h)?h:[h],t,n,r,o&&"foreignObject"!==p,i,s,i?i[0]:n.__k&&C(n,0),a),null!=i)for(h=i.length;h--;)null!=i[h]&&w(i[h]);a||("value"in d&&void 0!==(h=d.value)&&(h!==e.value||"progress"===p&&!h||"option"===p&&h!==b.value)&&z(e,"value",h,b.value,!1),"checked"in d&&void 0!==(h=d.checked)&&h!==e.checked&&z(e,"checked",h,b.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){u.__e(e,n)}}function D(e,t,n){var r,o;if(u.unmount&&u.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){u.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&D(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||w(e.__e),e.__=e.__e=e.__d=void 0}function W(e,t,n){return this.constructor(e,n)}l=m.slice,u={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},c=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=_({},this.state),"function"==typeof e&&(e=e(_({},n),this.props)),e&&_(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),P(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),P(this))},k.prototype.render=x,b=[],p="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0;var J,B,Q,Y,R=0,V=[],G=[],X=u.__b,$=u.__r,K=u.diffed,Z=u.__c,ee=u.unmount;function te(e,t){u.__h&&u.__h(B,e,R||t),R=0;var n=B.__H||(B.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:G}),n.__[e]}function ne(e){return R=1,function(e,t,n){var r=te(J++,2);if(r.t=e,!r.__c&&(r.__=[le(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=B,!B.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};B.u=!0;var i=B.shouldComponentUpdate,s=B.componentWillUpdate;B.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},B.shouldComponentUpdate=o}return r.__N||r.__}(le,e)}function re(e,t){var n=te(J++,3);!u.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.i=t,B.__H.__h.push(n))}function oe(){for(var e;e=V.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ae),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){B=null,X&&X(e)},u.__r=function(e){$&&$(e),J=0;var t=(B=e.__c).__H;t&&(Q===B?(t.__h=[],B.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=G,e.__N=e.i=void 0})):(t.__h.forEach(ae),t.__h.forEach(fe),t.__h=[])),Q=B},u.diffed=function(e){K&&K(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==V.push(t)&&Y===u.requestAnimationFrame||((Y=u.requestAnimationFrame)||se)(oe)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==G&&(e.__=e.__V),e.i=void 0,e.__V=G})),Q=B=null},u.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ae),e.__h=e.__h.filter(function(e){return!e.__||fe(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],u.__e(n,e.__v)}}),Z&&Z(e,t)},u.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ae(e)}catch(e){t=e}}),n.__H=void 0,t&&u.__e(t,n.__v))};var ie="function"==typeof requestAnimationFrame;function se(e){var t,n=function(){clearTimeout(r),ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ie&&(t=requestAnimationFrame(n))}function ae(e){var t=B,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),B=t}function fe(e){var t=B;e.__c=e.__(),B=t}function le(e,t){return"function"==typeof t?t(e):t}var ue=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function ce(e){var t=e.children,n=e.isOpen,r=e.close,o=ne(!1),i=o[0],s=o[1];return re(function(){s(n)},[n]),y("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},y("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},y("div",{className:ue(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out fb-m-4")},y("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},y("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},y("span",{class:"fb-sr-only"},"Close"),y("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),y("div",{className:""},t))))}var be=function(e,t){try{var r=t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){var t;function o(e){return t?e:{ok:!0,value:void 0}}var i=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(o){var i=n({code:"network_error",message:"Could not mark display as responded",status:e.status,url:r,responseMessage:o.message});return t=1,i})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},de=function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/responses";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not create response",status:e.status,url:o,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}};function pe(e){return y("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},y("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function he(e){return y("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function ge(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return y("label",{key:e.id,className:ue(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},checked:s===e.label,style:{borderColor:o,color:o},required:t.required&&0===n}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function _e(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne([]),s=i[0],a=i[1],f=function(){return s.length>0};return y("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return y("label",{key:e.id,className:ue(s.includes(e.label)?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 hover:fb-bg-slate-50 focus:fb-outline-none")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("input",{type:"checkbox",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.checked?[].concat(s,[e.currentTarget.value]):s.filter(function(t){return t!==e.currentTarget.value}))},checked:s.includes(e.label),style:{borderColor:o,color:o}}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:t.required,value:f()?"checked":""}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return y("label",{key:e,className:ue(s===e?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},y("input",{type:"radio",name:"nps",value:e,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:function(){return a(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ye(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=a(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=a(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=a(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function je(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:ye(e.htmlString)}})}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("div",null,y(he,{headline:t.headline,questionId:t.id}),y(je,{htmlString:t.html,questionId:t.id}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},y("div",null),!t.required&&y("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),y("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ke(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?y(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?y(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?y(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?y(we,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?y(xe,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function Ce(e){var t=e.headline,n=e.subheader;return y("div",{className:"fb-text-center"},y("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},y("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),y("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),y("div",null,y(he,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),y(ge,{subheader:n,questionId:"thankYouCard"})))}function Se(r){var o,i=r.config,s=r.survey,a=r.close,f=r.brandColor,l=r.errorHandler,u=ne(s.questions[0].id),c=u[0],b=u[1],d=ne(0),p=d[0],h=d[1],g=ne(null),m=g[0],v=g[1],_=ne(null),w=_[0],j=_[1],x=ne(!1),k=x[0],C=x[1];re(function(){!function(){try{Promise.resolve(function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/displays";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){var r;function i(n){return r?n:Promise.resolve(e.json()).then(t)}var s=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(t){var i=n({code:"network_error",message:"Could not create display",status:e.status,url:o,responseMessage:t.message});return r=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}}({surveyId:s.id,personId:i.person.id},i)).then(function(e){!0===e.ok?j(e.value.id):l(e.error)})}catch(e){return Promise.reject(e)}}()},[i,s,l]),re(function(){var e;h((e=s.questions.findIndex(function(e){return e.id===c}),e/s.questions.length))},[c,s]);var S=function(r){try{var o=function(){C(!1),u?(h(100),s.thankYouCard.enabled?setTimeout(function(){a()},2e3):a()):b(s.questions[f+1].id)};C(!0);var f=s.questions.findIndex(function(e){return e.id===c}),u=f===s.questions.length-1,d={surveyId:s.id,personId:i.person.id,response:{finished:u,data:r}},p=m?Promise.resolve(function(e,r,o){try{var i=o.apiHost+"/api/v1/client/environments/"+o.environmentId+"/responses/"+r;return Promise.resolve(fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not update response",status:e.status,url:i,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}}(d,m,i)).then(function(t){!0!==t.ok?l(t.error):d.response.finished&&e.getInstance().debug("Submitted response")}):Promise.resolve(Promise.all([de(d,i),be(w,i)])).then(function(e){var t=e[0];!0===t.ok?v(t.value.id):l(t.error)});return Promise.resolve(p&&p.then?p.then(o):o())}catch(e){return Promise.reject(e)}};return y("div",null,y("div",{className:ue(k?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===p&&s.thankYouCard.enabled?y(Ce,{headline:s.thankYouCard.headline,subheader:s.thankYouCard.subheader,brandColor:null==(o=i.settings)?void 0:o.brandColor}):s.questions.map(function(e,t){return c===e.id&&y(ke,{key:e.id,brandColor:f,lastQuestion:t===s.questions.length-1,onSubmit:S,question:e})})),y(pe,{progress:p,brandColor:f}))}function Pe(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=e.errorHandler,s=ne(!0),a=s[1],f=function(){a(!1),setTimeout(function(){o()},1e3)};return y("div",{id:"fbjs"},y(ce,{isOpen:s[0],close:f},y(Se,{config:n,survey:r,close:f,brandColor:null==(t=n.settings)?void 0:t.brandColor,errorHandler:i})))}var Ie=e.getInstance(),Ne=f.getInstance(),Ee=function(){try{var e=Ne.get().apiHost+"/api/v1/client/environments/"+Ne.get().environmentId+"/settings";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Ne.get().person.id})})).then(function(r){var o;function i(e){return o?e:Promise.resolve(r.json()).then(t)}var s=function(){if(!r.ok)return Promise.resolve(r.json()).then(function(t){var i=n({code:"network_error",status:r.status,message:"Error getting settings",url:e,responseMessage:t.message});return o=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}},qe=function(){try{return Ie.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){return!0!==e.ok?n(e.error):(Ie.debug("Settings refreshed"),Ne.update({settings:e.value}),{ok:!0,value:void 0})})}catch(e){return Promise.reject(e)}},He="formbricks-web-container",Te=f.getInstance(),ze=e.getInstance(),Le=o.getInstance(),Me=!1,Ae=function(e){Me?ze.debug("A survey is already running. Skipping."):(Me=!0,function(e,t,n){var r,o;u.__&&u.__(e,t),r=t.__k,o=[],A(t,e=t.__k=y(x,null,[e]),r||g,g,void 0!==t.ownerSVGElement,r?null:t.firstChild?l.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),O(o,e)}(y(Pe,{config:Te.get(),survey:e,closeSurvey:Oe,errorHandler:Le.handle}),document.getElementById(He)))},Oe=function(){try{return document.getElementById(He).remove(),Fe(),Promise.resolve(Ee()).then(function(e){r(e,function(e){Te.update({settings:e}),Me=!1},function(e){Le.handle(e)})})}catch(e){return Promise.reject(e)}},Fe=function(){var e=document.createElement("div");e.id=He,document.body.appendChild(e)},Ue=e.getInstance(),De=f.getInstance(),We=function(e,t){try{return Promise.resolve(fetch(De.get().apiHost+"/api/v1/client/environments/"+De.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:De.get().session.id,eventName:e,properties:t})})).then(function(t){var r;function o(t){return r?t:(Ue.debug('Formbricks: Event "'+e+'" tracked'),Je(e),{ok:!0,value:void 0})}var i=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){var o=n({code:"network_error",message:"Error tracking event: "+JSON.stringify(e),status:t.status,url:t.url,responseMessage:e.message});return r=1,o})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},Je=function(e){for(var t,n=a(null==(r=De.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,s=a(i.triggers);!(o=s()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return Ue.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ae(i)}},Be="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Qe(e,t,n){if(!e.s){if(n instanceof Ye){if(!n.s)return void(n.o=Qe.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Qe.bind(null,e,t),Qe.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Ye=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Qe(r,1,i(this.v))}catch(e){Qe(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Qe(r,1,t?t(o):o):n?Qe(r,1,n(o)):Qe(r,2,o)}catch(e){Qe(r,2,e)}},r},e}();function Re(e){return e instanceof Ye&&1&e.s}var Ve=f.getInstance(),Ge=e.getInstance(),Xe=o.getInstance(),$e=function(){try{var e,r=function(t){return e?t:{ok:!0,value:void 0}};Ge.debug("checking page url");var o=Ve.get().settings,i=null==o?void 0:o.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0===i.length)return Promise.resolve({ok:!0,value:void 0});var s=function(e,t,n){if("function"==typeof e[Be]){var r,o,i,s=e[Be]();if(function e(a){try{for(;!((r=s.next()).done||n&&n());)if((a=t(r.value))&&a.then){if(!Re(a))return void a.then(e,i||(i=Qe.bind(null,o=new Ye,2)));a=a.v}o?Qe(o,1,a):o=a}catch(e){Qe(o||(o=new Ye),2,e)}}(),s.return){var a=function(e){try{r.done||s.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<e.length;l++)f.push(e[l]);return function(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!Re(a))return void a.then(s,o||(o=Qe.bind(null,r=new Ye,2)));a=a.v}r?Qe(r,1,a):r=a}catch(e){Qe(r||(r=new Ye),2,e)}}(),r}(f,function(e){return t(f[e])},n)}(i,function(r){var o=r.noCodeConfig.pageUrl;if(o){var i=function(e,r,o){var i,s;switch(o){case"exactMatch":i=e===r;break;case"contains":i=e.includes(r);break;case"startsWith":i=e.startsWith(r);break;case"endsWith":i=e.endsWith(r);break;case"notMatch":i=e!==r;break;case"notContains":i=!e.includes(r);break;default:s=n({code:"invalid_match_type",message:"Invalid match type"})}return s||t(i)}(window.location.href,o.value,o.rule);if(!0!==i.ok){var s=n(i.error);return e=1,s}if(!1!==i.value)return Promise.resolve(We(r.name)).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}})}},function(){return e});return Promise.resolve(s&&s.then?s.then(r):r(s))}catch(e){return Promise.reject(e)}},Ke=function(e){var t=Ve.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),i=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&i.innerHTML===n.value&&We(e.name).then(function(e){r(e,function(e){},function(e){Xe.handle(e)})})}),o.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&i.matches(n.value)&&We(e.name).then(function(e){r(e,function(e){},function(e){Xe.handle(e)})})})},Ze=f.getInstance(),et=e.getInstance(),tt=function(){try{et.debug("Creating new person");var e=Ze.get().apiHost+"/api/v1/client/environments/"+Ze.get().environmentId+"/people";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating person",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},nt=function(e,t){var n=Ze.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},rt=function(e){try{return et.debug("setting userId: "+e),nt("userId",e)?(et.debug("userId already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):(r=Ze.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),r?Promise.resolve(n({code:"attribute_already_exists",message:"userId cannot be changed after it has been set. You need to reset first"})):Promise.resolve(function(e){try{if(!Ze.get().person||!Ze.get().person.id)return Promise.resolve(n({code:"missing_person",message:"Unable to update userId. No person set."}));var r=Ze.get().apiHost+"/api/v1/client/environments/"+Ze.get().environmentId+"/people/"+Ze.get().person.id+"/user-id";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Ze.get().session.id})})).then(function(e){return Promise.resolve(e.json()).then(function(o){return e.ok?t(o):n({code:"network_error",message:"Error updating person",status:e.status,url:r,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){if(!0!==e.ok)return n(e.error);var t=e.value;return Ze.update({person:t.person,settings:t.settings}),{ok:!0,value:void 0}}))}catch(e){return Promise.reject(e)}var r},ot=function(e,o){try{return et.debug("setting attribute: "+e+" to value: "+o),nt(e,o)?(et.debug("attribute already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):Promise.resolve(function(e,r){try{return Ze.get().person&&Ze.get().person.id?Promise.resolve(fetch(Ze.get().apiHost+"/api/v1/client/environments/"+Ze.get().environmentId+"/people/"+Ze.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:r})})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",status:e.status,message:"Error updating person",url:e.url,responseMessage:r.message})})}):Promise.resolve(n({code:"missing_person",message:"Unable to update attribute. No person set."}))}catch(e){return Promise.reject(e)}}(e,o)).then(function(e){var t;return r(e,function(e){Ze.update({person:e.person,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},it=function(){try{return et.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(tt()).then(function(e){var t;return r(e,function(e){Ze.update({person:e.person,session:e.session,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},st=e.getInstance(),at=f.getInstance(),ft=function(){try{if(!at.get().person)return Promise.resolve(n({code:"missing_person",message:"Unable to create session. No person found"}));var e=at.get().apiHost+"/api/v1/client/environments/"+at.get().environmentId+"/sessions";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:at.get().person.id})})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating session",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},lt=function(e){var t=i({},e);return t.expiresAt=Date.now()+36e5,t},ut=function(e){return!e||e.expiresAt<=Date.now()},ct=f.getInstance(),bt=e.getInstance(),dt=function(e){try{var t,r=function(e){return t?e:(bt.debug("Add session event listeners"),function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e,t=function(t){return e?t:(st.debug("Session not expired, extending session"),at.update({session:lt(at.get().session)}),{ok:!0,value:void 0})};st.debug("Checking session");var r=function(){if(ut(at.get().session))return st.debug("Session expired, creating new session"),Promise.resolve(ft()).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}var o=t.value;return at.update({session:o.session,settings:o.settings}),Promise.resolve(We("New Session")).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}return e=1,{ok:!0,value:void 0}})})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}}(),bt.debug("Add page url event listeners"),"undefined"!=typeof window&&(window.addEventListener("hashchange",$e),window.addEventListener("popstate",$e),window.addEventListener("pushstate",$e),window.addEventListener("replacestate",$e),window.addEventListener("load",$e)),bt.debug("Add click event listeners"),"undefined"!=typeof window&&document.addEventListener("click",Ke),bt.debug("Initialized"),{ok:!0,value:void 0})};if(bt.debug("Start initialize"),!e.environmentId)return bt.debug("No environmentId provided"),Promise.resolve(n({code:"missing_field",field:"environmentId"}));if(!e.apiHost)return bt.debug("No apiHost provided"),Promise.resolve(n({code:"missing_field",field:"apiHost"}));e.logLevel&&(bt.debug("Setting log level to "+e.logLevel),bt.configure({logLevel:e.logLevel})),bt.debug("Adding widget container to DOM"),Fe(),bt.debug("Adding styles to DOM"),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs :is(.fb-sr-only){clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-4){margin-right:1rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs :is(.fb-translate-x-28){--tw-translate-x:7rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-end){justify-content:flex-end}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.fb-space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-space-y-4>:not([hidden])~:not([hidden])){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.fb-shadow-lg){--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-shadow-sm){--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.fb-ring-1){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.focus\\:fb-ring-0:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-2:focus){--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var o=function(){if(ct.get().session&&ct.get().environmentId===e.environmentId&&ct.get().apiHost===e.apiHost){bt.debug("Found existing configuration. Checking session.");var r=ct.get().session;return function(){if(ut(r))return bt.debug("Session expired. Creating new session."),Promise.resolve(ft()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({session:lt(o.session),settings:i}),Promise.resolve(We("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})});bt.debug("Session valid. Extending session."),ct.update({session:lt(r)})}()}return bt.debug("No valid session found. Creating new config."),ct.update({environmentId:e.environmentId,apiHost:e.apiHost}),bt.debug("Get person, session and settings from server"),Promise.resolve(tt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({person:o.person,session:lt(o.session),settings:i}),Promise.resolve(We("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})})}();return Promise.resolve(o&&o.then?o.then(r):r(o))}catch(e){return Promise.reject(e)}};function pt(e,t,n){if(!e.s){if(n instanceof gt){if(!n.s)return void(n.o=pt.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(pt.bind(null,e,t),pt.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var ht=e.getInstance();const gt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{pt(r,1,e(this.v))}catch(e){pt(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?pt(r,1,t?t(o):o):n?pt(r,1,n(o)):pt(r,2,o)}catch(e){pt(r,2,e)}},r},e}();function mt(e){return e instanceof gt&&1&e.s}var vt=/*#__PURE__*/function(){function e(){this.queue=[],this.running=!1}var t=e.prototype;return t.add=function(e,t){void 0===e&&(e=!0);var n=[].slice.call(arguments,2);ht.debug("Add command to queue: "+t.name+"("+JSON.stringify(n)+")"),this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||this.run()},t.run=function(){try{var e=function(){t.running=!1},t=this;t.running=!0;var r=function(e,t,n){for(var r;;){var o=e();if(mt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!mt(i)){r=1;break}i=i.s}}var s=new gt,a=pt.bind(null,s,2);return(0===r?o.then(l):1===r?i.then(f):(void 0).then(function(){(o=e())?o.then?o.then(l).then(void 0,a):l(o):pt(s,1,i)})).then(void 0,a),s;function f(t){i=t;do{if(!(o=e())||mt(o)&&!o.v)return void pt(s,1,i);if(o.then)return void o.then(l).then(void 0,a);mt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(f).then(void 0,a)}function l(e){e?(i=n())&&i.then?i.then(f).then(void 0,a):f(i):pt(s,1,i)}}(function(){return t.queue.length>0},0,function(){var e=o.getInstance(),r=t.queue.shift();if(r.checkInitialized){var i=(bt.debug("Check if initialized"),ct.get().apiHost&&ct.get().environmentId&&ct.get().person&&ct.get().session&&ct.get().settings&&o.initialized?{ok:!0,value:void 0}:n({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));i&&!0!==i.ok&&e.handle(i.error)}return Promise.resolve(r.command.apply(null,r.commandArgs)).then(function(t){t&&(ht.debug("Command result: "+(!0===t.ok?"OK":"Something went really wrong")+", "+r.command.name),!0!==t.ok&&e.handle(t.error))})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},e}();e.getInstance().debug("Create command queue");var _t=new vt,wt=function(e,t){_t.add(!0,ot,e,t)};return{init:function(e){o.init(e.errorHandler),_t.add(!1,dt,e)},setUserId:function(e){_t.add(!0,rt,e)},setEmail:function(e){wt("email",e)},setAttribute:wt,track:function(e,t){void 0===t&&(t={}),_t.add(!0,We,e,t)},logout:function(){_t.add(!0,it)},refresh:function(){_t.add(!0,qe)},registerRouteChange:function(){_t.add(!0,$e)}}});
//# sourceMappingURL=index.umd.js.map

@@ -0,6 +1,7 @@

import { Result } from "./errors";
export declare class CommandQueue {
private queue;
private running;
add(command: () => Promise<any>): void;
add<A>(checkInitialized: boolean, command: (...args: A[]) => Promise<Result<void, any>> | Result<void, any>, ...args: A[]): void;
private run;
}

@@ -5,3 +5,2 @@ import { JsConfig } from "@formbricks/types/js";

private config;
private constructor();
static getInstance(): Config;

@@ -8,0 +7,0 @@ update(newConfig: Partial<JsConfig>): void;

@@ -1,3 +0,4 @@

import { Response, DisplayCreateRequest, JsConfig } from "@formbricks/types/js";
export declare const createDisplay: (displayCreateRequest: DisplayCreateRequest, config: JsConfig) => Promise<Response>;
export declare const markDisplayResponded: (displayId: string, config: JsConfig) => Promise<void>;
import { DisplayCreateRequest, JsConfig, Response } from "@formbricks/types/js";
import { NetworkError, Result } from "./errors";
export declare const createDisplay: (displayCreateRequest: DisplayCreateRequest, config: JsConfig) => Promise<Result<Response, NetworkError>>;
export declare const markDisplayResponded: (displayId: string, config: JsConfig) => Promise<Result<void, NetworkError>>;

@@ -1,2 +0,2 @@

export { ErrorHandler } from "@formbricks/types/js";
export { ErrorHandler as IErrorHandler } from "@formbricks/types/js";
export type Result<T, E = Error> = {

@@ -10,2 +10,3 @@ ok: true;

export declare const ok: <T, E>(value: T) => Result<T, E>;
export declare const okVoid: <E>() => Result<void, E>;
export declare const err: <E = Error>(error: E) => Result<never, E>;

@@ -26,6 +27,2 @@ export declare const wrap: <T, R>(fn: (value: T) => R) => (result: Result<T, Error>) => Result<R, Error>;

};
export type MissingSessionError = {
code: "missing_session";
message: string;
};
export type InvalidMatchTypeError = {

@@ -43,1 +40,14 @@ code: "invalid_match_type";

};
export type AttributeAlreadyExistsError = {
code: "attribute_already_exists";
message: string;
};
export declare class ErrorHandler {
private static instance;
private handleError;
static initialized: boolean;
private constructor();
static getInstance(): ErrorHandler;
static init(errorHandler?: (error: any) => void): void;
handle(error: any): void;
}

@@ -1,2 +0,3 @@

export declare const trackEvent: (eventName: string, properties?: any) => Promise<void>;
import { NetworkError, Result } from "./errors";
export declare const trackEvent: (eventName: string, properties?: any) => Promise<Result<void, NetworkError>>;
export declare const triggerSurvey: (eventName: string) => void;
import { InitConfig } from "@formbricks/types/js";
export declare const initialize: (c: InitConfig) => Promise<void>;
export declare const checkInitialized: () => void;
import { MissingFieldError, MissingPersonError, NetworkError, NotInitializedError, Result } from "./errors";
export declare const initialize: (c: InitConfig) => Promise<Result<void, MissingFieldError | NetworkError | MissingPersonError>>;
export declare const checkInitialized: () => Result<void, NotInitializedError>;
import type { MatchType } from "@formbricks/types/js";
export declare const checkPageUrl: () => void;
import { InvalidMatchTypeError, NetworkError, Result } from "./errors";
export declare const checkPageUrl: () => Promise<Result<void, InvalidMatchTypeError | NetworkError>>;
export declare const addPageUrlEventListeners: () => void;
export declare function checkUrlMatch(url: string, pageUrlValue: string, pageUrlRule: MatchType): boolean;
export declare function checkUrlMatch(url: string, pageUrlValue: string, pageUrlRule: MatchType): Result<boolean, InvalidMatchTypeError>;
export declare const checkClickMatch: (event: MouseEvent) => void;
export declare const addClickEventListener: () => void;
import type { Person } from "@formbricks/types/js";
import { Session, Settings } from "@formbricks/types/js";
export declare const createPerson: () => Promise<{
import { AttributeAlreadyExistsError, MissingPersonError, NetworkError, Result } from "./errors";
export declare const createPerson: () => Promise<Result<{
session: Session;
person: Person;
settings: Settings;
}>;
export declare const updatePersonUserId: (userId: string) => Promise<{
}, NetworkError>>;
export declare const updatePersonUserId: (userId: string) => Promise<Result<{
person: Person;
settings: Settings;
}>;
export declare const updatePersonAttribute: (key: string, value: string) => Promise<{
}, NetworkError | MissingPersonError>>;
export declare const updatePersonAttribute: (key: string, value: string) => Promise<Result<{
person: Person;
settings: Settings;
}>;
}, NetworkError | MissingPersonError>>;
export declare const attributeAlreadySet: (key: string, value: string) => boolean;
export declare const attributeAlreadyExists: (key: string) => boolean;
export declare const setPersonUserId: (userId: string) => Promise<void>;
export declare const setPersonAttribute: (key: string, value: string) => Promise<void>;
export declare const resetPerson: () => Promise<void>;
export declare const setPersonUserId: (userId: string) => Promise<Result<void, NetworkError | MissingPersonError | AttributeAlreadyExistsError>>;
export declare const setPersonAttribute: (key: string, value: string) => Promise<Result<void, NetworkError | MissingPersonError>>;
export declare const resetPerson: () => Promise<Result<void, NetworkError>>;

@@ -1,3 +0,4 @@

import { Response, ResponseCreateRequest, ResponseUpdateRequest } from "@formbricks/types/js";
export declare const createResponse: (responseRequest: ResponseCreateRequest, config: any) => Promise<Response>;
export declare const updateResponse: (responseRequest: ResponseUpdateRequest, responseId: any, config: any) => Promise<Response>;
import { JsConfig, Response, ResponseCreateRequest, ResponseUpdateRequest } from "@formbricks/types/js";
import { NetworkError, Result } from "./errors";
export declare const createResponse: (responseRequest: ResponseCreateRequest, config: any) => Promise<Result<Response, NetworkError>>;
export declare const updateResponse: (responseRequest: ResponseUpdateRequest, responseId: string, config: JsConfig) => Promise<Result<Response, NetworkError>>;
import type { Session, Settings } from "@formbricks/types/js";
export declare const createSession: () => Promise<{
import { MissingPersonError, NetworkError, Result } from "./errors";
export declare const createSession: () => Promise<Result<{
session: Session;
settings: Settings;
}>;
}, NetworkError | MissingPersonError>>;
export declare const extendSession: (session: Session) => Session;
export declare const isExpired: (session: Session) => boolean;
export declare const extendOrCreateSession: () => Promise<void>;
export declare const extendOrCreateSession: () => Promise<Result<void, NetworkError | MissingPersonError>>;
import type { Settings } from "@formbricks/types/js";
export declare const getSettings: () => Promise<Settings>;
export declare const refreshSettings: () => Promise<void>;
import { NetworkError, Result } from "./errors";
export declare const getSettings: () => Promise<Result<Settings, NetworkError>>;
export declare const refreshSettings: () => Promise<Result<void, NetworkError>>;
{
"name": "@formbricks/js",
"version": "0.1.13",
"version": "0.1.14",
"description": "Formbricks-js allows you to connect your app to Formbricks, display surveys and trigger events.",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc