@sprig-technologies/sprig-browser
Version:
npm package for the sprig web sdk
1 lines • 117 kB
JavaScript
"use strict";const V=require("./core-CY0ieyzc.cjs"),E=require("./metricsReporter-Bin621Yz.cjs");var he,C,rr,X,ft,nr,$e,or,fe={},ir=[],un=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,je=Array.isArray;function Q(e,t){for(var r in t)e[r]=t[r];return e}function ar(e){var t=e.parentNode;t&&t.removeChild(e)}function q(e,t,r){var o,n,i,a={};for(i in t)i=="key"?o=t[i]:i=="ref"?n=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?he.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return pe(e,a,o,n,null)}function pe(e,t,r,o,n){var i={type:e,props:t,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:n??++rr,__i:-1,__u:0};return n==null&&C.vnode!=null&&C.vnode(i),i}function sr(){return{current:null}}function H(e){return e.children}function z(e,t){this.props=e,this.context=t}function ae(e,t){if(t==null)return e.__?ae(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?ae(e):null}function lr(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return lr(e)}}function Qe(e){(!e.__d&&(e.__d=!0)&&X.push(e)&&!Ie.__r++||ft!==C.debounceRendering)&&((ft=C.debounceRendering)||nr)(Ie)}function Ie(){var e,t,r,o,n,i,a,s,l;for(X.sort($e);e=X.shift();)e.__d&&(t=X.length,o=void 0,i=(n=(r=e).__v).__e,s=[],l=[],(a=r.__P)&&((o=Q({},n)).__v=n.__v+1,C.vnode&&C.vnode(o),et(a,o,n,r.__n,a.ownerSVGElement!==void 0,32&n.__u?[i]:null,s,i??ae(n),!!(32&n.__u),l),o.__.__k[o.__i]=o,dr(s,o,l),o.__e!=i&&lr(o)),X.length>t&&X.sort($e));Ie.__r=0}function cr(e,t,r,o,n,i,a,s,l,c,d){var u,m,p,v,g,h=o&&o.__k||ir,x=t.length;for(r.__d=l,function(f,k,w){var _,b,y,A,R,N=k.length,P=w.length,T=P,L=0;for(f.__k=[],_=0;_<N;_++)(b=f.__k[_]=(b=k[_])==null||typeof b=="boolean"||typeof b=="function"?null:typeof b=="string"||typeof b=="number"||typeof b=="bigint"||b.constructor==String?pe(null,b,null,null,b):je(b)?pe(H,{children:b},null,null,null):b.constructor===void 0&&b.__b>0?pe(b.type,b.props,b.key,b.ref?b.ref:null,b.__v):b)!=null?(b.__=f,b.__b=f.__b+1,R=dn(b,w,A=_+L,T),b.__i=R,y=null,R!==-1&&(T--,(y=w[R])&&(y.__u|=131072)),y==null||y.__v===null?(R==-1&&L--,typeof b.type!="function"&&(b.__u|=65536)):R!==A&&(R===A+1?L++:R>A?T>N-A?L+=R-A:L--:L=R<A&&R==A-1?R-A:0,R!==_+L&&(b.__u|=65536))):(y=w[_])&&y.key==null&&y.__e&&(y.__e==f.__d&&(f.__d=ae(y)),We(y,y,!1),w[_]=null,T--);if(T)for(_=0;_<P;_++)(y=w[_])!=null&&!(131072&y.__u)&&(y.__e==f.__d&&(f.__d=ae(y)),We(y,y))}(r,t,h),l=r.__d,u=0;u<x;u++)(p=r.__k[u])!=null&&typeof p!="boolean"&&typeof p!="function"&&(m=p.__i===-1?fe:h[p.__i]||fe,p.__i=u,et(e,p,m,n,i,a,s,l,c,d),v=p.__e,p.ref&&m.ref!=p.ref&&(m.ref&&tt(m.ref,null,p),d.push(p.ref,p.__c||v,p)),g==null&&v!=null&&(g=v),65536&p.__u||m.__k===p.__k?l=ur(p,l,e):typeof p.type=="function"&&p.__d!==void 0?l=p.__d:v&&(l=v.nextSibling),p.__d=void 0,p.__u&=-196609);r.__d=l,r.__e=g}function ur(e,t,r){var o,n;if(typeof e.type=="function"){for(o=e.__k,n=0;o&&n<o.length;n++)o[n]&&(o[n].__=e,t=ur(o[n],t,r));return t}return e.__e!=t&&(r.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function W(e,t){return t=t||[],e==null||typeof e=="boolean"||(je(e)?e.some(function(r){W(r,t)}):t.push(e)),t}function dn(e,t,r,o){var n=e.key,i=e.type,a=r-1,s=r+1,l=t[r];if(l===null||l&&n==l.key&&i===l.type)return r;if(o>(l==null||131072&l.__u?0:1))for(;a>=0||s<t.length;){if(a>=0){if((l=t[a])&&!(131072&l.__u)&&n==l.key&&i===l.type)return a;a--}if(s<t.length){if((l=t[s])&&!(131072&l.__u)&&n==l.key&&i===l.type)return s;s++}}return-1}function gt(e,t,r){t[0]==="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||un.test(t)?r:r+"px"}function xe(e,t,r,o,n){var i;e:if(t==="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)r&&t in r||gt(e.style,t,"");if(r)for(t in r)o&&r[t]===o[t]||gt(e.style,t,r[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=r,r?o?r.u=o.u:(r.u=Date.now(),e.addEventListener(t,i?_t:mt,i)):e.removeEventListener(t,i?_t:mt,i);else{if(n)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,r))}}function mt(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(C.event?C.event(e):e)}function _t(e){return this.l[e.type+!0](C.event?C.event(e):e)}function et(e,t,r,o,n,i,a,s,l,c){var d,u,m,p,v,g,h,x,f,k,w,_,b,y,A,R=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),i=[s=t.__e=r.__e]),(d=C.__b)&&d(t);e:if(typeof R=="function")try{if(x=t.props,f=(d=R.contextType)&&o[d.__c],k=d?f?f.props.value:d.__:o,r.__c?h=(u=t.__c=r.__c).__=u.__E:("prototype"in R&&R.prototype.render?t.__c=u=new R(x,k):(t.__c=u=new z(x,k),u.constructor=R,u.render=fn),f&&f.sub(u),u.props=x,u.state||(u.state={}),u.context=k,u.__n=o,m=u.__d=!0,u.__h=[],u._sb=[]),u.__s==null&&(u.__s=u.state),R.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=Q({},u.__s)),Q(u.__s,R.getDerivedStateFromProps(x,u.__s))),p=u.props,v=u.state,u.__v=t,m)R.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(R.getDerivedStateFromProps==null&&x!==p&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(x,k),!u.__e&&(u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(x,u.__s,k)===!1||t.__v===r.__v)){for(t.__v!==r.__v&&(u.props=x,u.state=u.__s,u.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.forEach(function(N){N&&(N.__=t)}),w=0;w<u._sb.length;w++)u.__h.push(u._sb[w]);u._sb=[],u.__h.length&&a.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(x,u.__s,k),u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(p,v,g)})}if(u.context=k,u.props=x,u.__P=e,u.__e=!1,_=C.__r,b=0,"prototype"in R&&R.prototype.render){for(u.state=u.__s,u.__d=!1,_&&_(t),d=u.render(u.props,u.state,u.context),y=0;y<u._sb.length;y++)u.__h.push(u._sb[y]);u._sb=[]}else do u.__d=!1,_&&_(t),d=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++b<25);u.state=u.__s,u.getChildContext!=null&&(o=Q(Q({},o),u.getChildContext())),m||u.getSnapshotBeforeUpdate==null||(g=u.getSnapshotBeforeUpdate(p,v)),cr(e,je(A=d!=null&&d.type===H&&d.key==null?d.props.children:d)?A:[A],t,r,o,n,i,a,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),h&&(u.__E=u.__=null)}catch(N){t.__v=null,l||i!=null?(t.__e=s,t.__u|=l?160:32,i[i.indexOf(s)]=null):(t.__e=r.__e,t.__k=r.__k),C.__e(N,t,r)}else i==null&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=pn(r.__e,t,r,o,n,i,a,l,c);(d=C.diffed)&&d(t)}function dr(e,t,r){t.__d=void 0;for(var o=0;o<r.length;o++)tt(r[o],r[++o],r[++o]);C.__c&&C.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(i){i.call(n)})}catch(i){C.__e(i,n.__v)}})}function pn(e,t,r,o,n,i,a,s,l){var c,d,u,m,p,v,g,h=r.props,x=t.props,f=t.type;if(f==="svg"&&(n=!0),i!=null){for(c=0;c<i.length;c++)if((p=i[c])&&"setAttribute"in p==!!f&&(f?p.localName===f:p.nodeType===3)){e=p,i[c]=null;break}}if(e==null){if(f===null)return document.createTextNode(x);e=n?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f,x.is&&x),i=null,s=!1}if(f===null)h===x||s&&e.data===x||(e.data=x);else{if(i=i&&he.call(e.childNodes),h=r.props||fe,!s&&i!=null)for(h={},c=0;c<e.attributes.length;c++)h[(p=e.attributes[c]).name]=p.value;for(c in h)p=h[c],c=="children"||(c=="dangerouslySetInnerHTML"?u=p:c==="key"||c in x||xe(e,c,null,p,n));for(c in x)p=x[c],c=="children"?m=p:c=="dangerouslySetInnerHTML"?d=p:c=="value"?v=p:c=="checked"?g=p:c==="key"||s&&typeof p!="function"||h[c]===p||xe(e,c,p,h[c],n);if(d)s||u&&(d.__html===u.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(u&&(e.innerHTML=""),cr(e,je(m)?m:[m],t,r,o,n&&f!=="foreignObject",i,a,i?i[0]:r.__k&&ae(r,0),s,l),i!=null)for(c=i.length;c--;)i[c]!=null&&ar(i[c]);s||(c="value",v!==void 0&&(v!==e[c]||f==="progress"&&!v||f==="option"&&v!==h[c])&&xe(e,c,v,h[c],!1),c="checked",g!==void 0&&g!==e[c]&&xe(e,c,g,h[c],!1))}return e}function tt(e,t,r){try{typeof e=="function"?e(t):e.current=t}catch(o){C.__e(o,r)}}function We(e,t,r){var o,n;if(C.unmount&&C.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||tt(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){C.__e(i,t)}o.base=o.__P=null,e.__c=void 0}if(o=e.__k)for(n=0;n<o.length;n++)o[n]&&We(o[n],t,r||typeof e.type!="function");r||e.__e==null||ar(e.__e),e.__=e.__e=e.__d=void 0}function fn(e,t,r){return this.constructor(e,r)}function se(e,t,r){var o,n,i,a;C.__&&C.__(e,t),n=(o=typeof r=="function")?null:r&&r.__k||t.__k,i=[],a=[],et(t,e=(!o&&r||t).__k=q(H,null,[e]),n||fe,fe,t.ownerSVGElement!==void 0,!o&&r?[r]:n?null:t.firstChild?he.call(t.childNodes):null,i,!o&&r?r:n?n.__e:t.firstChild,o,a),dr(i,e,a)}function pr(e,t){se(e,t,pr)}function gn(e,t,r){var o,n,i,a,s=Q({},e.props);for(i in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)i=="key"?o=t[i]:i=="ref"?n=t[i]:s[i]=t[i]===void 0&&a!==void 0?a[i]:t[i];return arguments.length>2&&(s.children=arguments.length>3?he.call(arguments,2):r),pe(e.type,s,o||e.key,n||e.ref,null)}function rt(e,t){var r={__c:t="__cC"+or++,__:e,Consumer:function(o,n){return o.children(n)},Provider:function(o){var n,i;return this.getChildContext||(n=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&n.some(function(s){s.__e=!0,Qe(s)})},this.sub=function(a){n.push(a);var s=a.componentWillUnmount;a.componentWillUnmount=function(){n.splice(n.indexOf(a),1),s&&s.call(a)}}),o.children}};return r.Provider.__=r.Consumer.contextType=r}he=ir.slice,C={__e:function(e,t,r,o){for(var n,i,a;t=t.__;)if((n=t.__c)&&!n.__)try{if((i=n.constructor)&&i.getDerivedStateFromError!=null&&(n.setState(i.getDerivedStateFromError(e)),a=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,o||{}),a=n.__d),a)return n.__E=n}catch(s){e=s}throw e}},rr=0,z.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Q({},this.state),typeof e=="function"&&(e=e(Q({},r),this.props)),e&&Q(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Qe(this))},z.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Qe(this))},z.prototype.render=H,X=[],nr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$e=function(e,t){return e.__v.__b-t.__v.__b},Ie.__r=0,or=0;var mn=0;function S(e,t,r,o,n,i){var a,s,l={};for(s in t)s=="ref"?a=t[s]:l[s]=t[s];var c={type:e,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--mn,__i:-1,__u:0,__source:n,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return C.vnode&&C.vnode(c),c}var Z,j,Te,ht,le=0,fr=[],ke=[],vt=C.__b,yt=C.__r,bt=C.diffed,xt=C.__c,kt=C.unmount;function ee(e,t){C.__h&&C.__h(j,e,le||t),le=0;var r=j.__H||(j.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({__V:ke}),r.__[e]}function K(e){return le=1,nt(_r,e)}function nt(e,t,r){var o=ee(Z++,2);if(o.t=e,!o.__c&&(o.__=[r?r(t):_r(void 0,t),function(s){var l=o.__N?o.__N[0]:o.__[0],c=o.t(l,s);l!==c&&(o.__N=[c,o.__[1]],o.__c.setState({}))}],o.__c=j,!j.u)){var n=function(s,l,c){if(!o.__c.__H)return!0;var d=o.__c.__H.__.filter(function(m){return m.__c});if(d.every(function(m){return!m.__N}))return!i||i.call(this,s,l,c);var u=!1;return d.forEach(function(m){if(m.__N){var p=m.__[0];m.__=m.__N,m.__N=void 0,p!==m.__[0]&&(u=!0)}}),!(!u&&o.__c.props===s)&&(!i||i.call(this,s,l,c))};j.u=!0;var i=j.shouldComponentUpdate,a=j.componentWillUpdate;j.componentWillUpdate=function(s,l,c){if(this.__e){var d=i;i=void 0,n(s,l,c),i=d}a&&a.call(this,s,l,c)},j.shouldComponentUpdate=n}return o.__N||o.__}function M(e,t){var r=ee(Z++,3);!C.__s&&at(r.__H,t)&&(r.__=e,r.i=t,j.__H.__h.push(r))}function ce(e,t){var r=ee(Z++,4);!C.__s&&at(r.__H,t)&&(r.__=e,r.i=t,j.__h.push(r))}function J(e){return le=5,Y(function(){return{current:e}},[])}function gr(e,t,r){le=6,ce(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},r==null?r:r.concat(e))}function Y(e,t){var r=ee(Z++,7);return at(r.__H,t)?(r.__V=e(),r.i=t,r.__h=e,r.__V):r.__}function ge(e,t){return le=8,Y(function(){return e},t)}function ot(e){var t=j.context[e.__c],r=ee(Z++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(j)),t.props.value):e.__}function it(e,t){C.useDebugValue&&C.useDebugValue(t?t(e):e)}function mr(){var e=ee(Z++,11);if(!e.__){for(var t=j.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__}function _n(){for(var e;e=fr.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(we),e.__H.__h.forEach(Ze),e.__H.__h=[]}catch(t){e.__H.__h=[],C.__e(t,e.__v)}}C.__b=function(e){j=null,vt&&vt(e)},C.__r=function(e){yt&&yt(e),Z=0;var t=(j=e.__c).__H;t&&(Te===j?(t.__h=[],j.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.__V=ke,r.__N=r.i=void 0})):(t.__h.forEach(we),t.__h.forEach(Ze),t.__h=[],Z=0)),Te=j},C.diffed=function(e){bt&&bt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(fr.push(t)!==1&&ht===C.requestAnimationFrame||((ht=C.requestAnimationFrame)||hn)(_n)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.__V!==ke&&(r.__=r.__V),r.i=void 0,r.__V=ke})),Te=j=null},C.__c=function(e,t){t.some(function(r){try{r.__h.forEach(we),r.__h=r.__h.filter(function(o){return!o.__||Ze(o)})}catch(o){t.some(function(n){n.__h&&(n.__h=[])}),t=[],C.__e(o,r.__v)}}),xt&&xt(e,t)},C.unmount=function(e){kt&&kt(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(o){try{we(o)}catch(n){t=n}}),r.__H=void 0,t&&C.__e(t,r.__v))};var wt=typeof requestAnimationFrame=="function";function hn(e){var t,r=function(){clearTimeout(o),wt&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(r,100);wt&&(t=requestAnimationFrame(r))}function we(e){var t=j,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),j=t}function Ze(e){var t=j;e.__c=e.__(),j=t}function at(e,t){return!e||e.length!==t.length||t.some(function(r,o){return r!==e[o]})}function _r(e,t){return typeof t=="function"?t(e):t}function hr(e,t){for(var r in t)e[r]=t[r];return e}function Ge(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var o in t)if(o!=="__source"&&e[o]!==t[o])return!0;return!1}function Re(e){this.props=e}function vr(e,t){function r(n){var i=this.props.ref,a=i==n.ref;return!a&&i&&(i.call?i(null):i.current=null),t?!t(this.props,n)||!a:Ge(this.props,n)}function o(n){return this.shouldComponentUpdate=r,q(e,n)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.prototype.isReactComponent=!0,o.__f=!0,o}(Re.prototype=new z).isPureReactComponent=!0,Re.prototype.shouldComponentUpdate=function(e,t){return Ge(this.props,e)||Ge(this.state,t)};var Ct=C.__b;C.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ct&&Ct(e)};var vn=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function st(e){function t(r){var o=hr({},r);return delete o.ref,e(o,r.ref||null)}return t.$$typeof=vn,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var St=function(e,t){return e==null?null:W(W(e).map(t))},yr={map:St,forEach:St,count:function(e){return e?W(e).length:0},only:function(e){var t=W(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:W},yn=C.__e;C.__e=function(e,t,r,o){if(e.then){for(var n,i=t;i=i.__;)if((n=i.__c)&&n.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),n.__c(e,t)}yn(e,t,r,o)};var It=C.unmount;function br(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),e.__c.__H=null),(e=hr({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(o){return br(o,t,r)})),e}function xr(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(o){return xr(o,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function ie(){this.__u=0,this.t=null,this.__b=null}function kr(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Le(e){var t,r,o;function n(i){if(t||(t=e()).then(function(a){r=a.default||a},function(a){o=a}),o)throw o;if(!r)throw t;return q(r,i)}return n.displayName="Lazy",n.__f=!0,n}function ne(){this.u=null,this.o=null}C.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),It&&It(e)},(ie.prototype=new z).__c=function(e,t){var r=t.__c,o=this;o.t==null&&(o.t=[]),o.t.push(r);var n=kr(o.__v),i=!1,a=function(){i||(i=!0,r.__R=null,n?n(s):s())};r.__R=a;var s=function(){if(!--o.__u){if(o.state.__a){var l=o.state.__a;o.__v.__k[0]=xr(l,l.__c.__P,l.__c.__O)}var c;for(o.setState({__a:o.__b=null});c=o.t.pop();)c.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(a,a)},ie.prototype.componentWillUnmount=function(){this.t=[]},ie.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=br(this.__b,r,o.__O=o.__P)}this.__b=null}var n=t.__a&&q(H,null,e.fallback);return n&&(n.__u&=-33),[q(H,null,t.__a?null:e.children),n]};var Rt=function(e,t,r){if(++r[1]===r[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(r=e.u;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.u=r=r[2]}};function bn(e){return this.getChildContext=function(){return e.context},e.children}function xn(e){var t=this,r=e.i;t.componentWillUnmount=function(){se(null,t.l),t.l=null,t.i=null},t.i&&t.i!==r&&t.componentWillUnmount(),t.l||(t.i=r,t.l={nodeType:1,parentNode:r,childNodes:[],appendChild:function(o){this.childNodes.push(o),t.i.appendChild(o)},insertBefore:function(o,n){this.childNodes.push(o),t.i.appendChild(o)},removeChild:function(o){this.childNodes.splice(this.childNodes.indexOf(o)>>>1,1),t.i.removeChild(o)}}),se(q(bn,{context:t.context},e.__v),t.l)}function wr(e,t){var r=q(xn,{__v:e,i:t});return r.containerInfo=t,r}(ne.prototype=new z).__a=function(e){var t=this,r=kr(t.__v),o=t.o.get(e);return o[0]++,function(n){var i=function(){t.props.revealOrder?(o.push(n),Rt(t,e,o)):n()};r?r(i):i()}},ne.prototype.render=function(e){this.u=null,this.o=new Map;var t=W(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.o.set(t[r],this.u=[1,0,this.u]);return e.children},ne.prototype.componentDidUpdate=ne.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,r){Rt(e,r,t)})};var Cr=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,kn=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,wn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Cn=/[A-Z0-9]/g,Sn=typeof document<"u",In=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Sr(e,t,r){return t.__k==null&&(t.textContent=""),se(e,t),typeof r=="function"&&r(),e?e.__c:null}function Ir(e,t,r){return pr(e,t),typeof r=="function"&&r(),e?e.__c:null}z.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(z.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var At=C.event;function Rn(){}function An(){return this.cancelBubble}function En(){return this.defaultPrevented}C.event=function(e){return At&&(e=At(e)),e.persist=Rn,e.isPropagationStopped=An,e.isDefaultPrevented=En,e.nativeEvent=e};var lt,jn={enumerable:!1,configurable:!0,get:function(){return this.class}},Et=C.vnode;C.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,o=t.type,n={};for(var i in r){var a=r[i];if(!(i==="value"&&"defaultValue"in r&&a==null||Sn&&i==="children"&&o==="noscript"||i==="class"||i==="className")){var s=i.toLowerCase();i==="defaultValue"&&"value"in r&&r.value==null?i="value":i==="download"&&a===!0?a="":s==="ondoubleclick"?i="ondblclick":s!=="onchange"||o!=="input"&&o!=="textarea"||In(r.type)?s==="onfocus"?i="onfocusin":s==="onblur"?i="onfocusout":wn.test(i)?i=s:o.indexOf("-")===-1&&kn.test(i)?i=i.replace(Cn,"-$&").toLowerCase():a===null&&(a=void 0):s=i="oninput",s==="oninput"&&n[i=s]&&(i="oninputCapture"),n[i]=a}}o=="select"&&n.multiple&&Array.isArray(n.value)&&(n.value=W(r.children).forEach(function(l){l.props.selected=n.value.indexOf(l.props.value)!=-1})),o=="select"&&n.defaultValue!=null&&(n.value=W(r.children).forEach(function(l){l.props.selected=n.multiple?n.defaultValue.indexOf(l.props.value)!=-1:n.defaultValue==l.props.value})),r.class&&!r.className?(n.class=r.class,Object.defineProperty(n,"className",jn)):(r.className&&!r.class||r.class&&r.className)&&(n.class=n.className=r.className),t.props=n}(e),e.$$typeof=Cr,Et&&Et(e)};var jt=C.__r;C.__r=function(e){jt&&jt(e),lt=e.__c};var Lt=C.diffed;C.diffed=function(e){Lt&&Lt(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value),lt=null};var Rr={ReactCurrentDispatcher:{current:{readContext:function(e){return lt.__n[e.__c].props.value}}}};function Ar(e){return q.bind(null,e)}function ve(e){return!!e&&e.$$typeof===Cr}function Er(e){return ve(e)&&e.type===H}function jr(e){return ve(e)?gn.apply(null,arguments):e}function Ae(e){return!!e.__k&&(se(null,e),!0)}function Lr(e){return e&&(e.base||e.nodeType===1&&e)||null}var Nr=function(e,t){return e(t)},Pr=function(e,t){return e(t)},Tr=H;function ct(e){e()}function Ur(e){return e}function Vr(){return[!1,ct]}var Or=ce,qr=ve;function Mr(e,t){var r=t(),o=K({h:{__:r,v:t}}),n=o[0].h,i=o[1];return ce(function(){n.__=r,n.v=t,Ue(n)&&i({h:n})},[e,r,t]),M(function(){return Ue(n)&&i({h:n}),e(function(){Ue(n)&&i({h:n})})},[e]),r}function Ue(e){var t,r,o=e.v,n=e.__;try{var i=o();return!((t=n)===(r=i)&&(t!==0||1/t==1/r)||t!=t&&r!=r)}catch{return!0}}var Hr={useState:K,useId:mr,useReducer:nt,useEffect:M,useLayoutEffect:ce,useInsertionEffect:Or,useTransition:Vr,useDeferredValue:Ur,useSyncExternalStore:Mr,startTransition:ct,useRef:J,useImperativeHandle:gr,useMemo:Y,useCallback:ge,useContext:ot,useDebugValue:it,version:"17.0.2",Children:yr,render:Sr,hydrate:Ir,unmountComponentAtNode:Ae,createPortal:wr,createElement:q,createContext:rt,createFactory:Ar,cloneElement:jr,createRef:sr,Fragment:H,isValidElement:ve,isElement:qr,isFragment:Er,findDOMNode:Lr,Component:z,PureComponent:Re,memo:vr,forwardRef:st,flushSync:Pr,unstable_batchedUpdates:Nr,StrictMode:Tr,Suspense:ie,SuspenseList:ne,lazy:Le,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Rr};const Ln=Object.freeze(Object.defineProperty({__proto__:null,Children:yr,Component:z,Fragment:H,PureComponent:Re,StrictMode:Tr,Suspense:ie,SuspenseList:ne,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Rr,cloneElement:jr,createContext:rt,createElement:q,createFactory:Ar,createPortal:wr,createRef:sr,default:Hr,findDOMNode:Lr,flushSync:Pr,forwardRef:st,hydrate:Ir,isElement:qr,isFragment:Er,isValidElement:ve,lazy:Le,memo:vr,render:Sr,startTransition:ct,unmountComponentAtNode:Ae,unstable_batchedUpdates:Nr,useCallback:ge,useContext:ot,useDebugValue:it,useDeferredValue:Ur,useEffect:M,useErrorBoundary:function(e){var t=ee(Z++,10),r=K();return t.__=e,j.componentDidCatch||(j.componentDidCatch=function(o,n){t.__&&t.__(o,n),r[1](o)}),[r[0],function(){r[1](void 0)}]},useId:mr,useImperativeHandle:gr,useInsertionEffect:Or,useLayoutEffect:ce,useMemo:Y,useReducer:nt,useRef:J,useState:K,useSyncExternalStore:Mr,useTransition:Vr,version:"17.0.2"},Symbol.toStringTag,{value:"Module"})),Nt=e=>{let t;const r=new Set,o=(a,s)=>{const l=typeof a=="function"?a(t):a;if(!Object.is(l,t)){const c=t;t=s??typeof l!="object"?l:Object.assign({},t,l),r.forEach(d=>d(t,c))}},n=()=>t,i={setState:o,getState:n,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>r.clear()};return t=e(o,n,i),i};function Nn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Pn(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function o(){return this instanceof o?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}),r}var Pt={exports:{}},Ve={};const Fr=Pn(Ln);var Tt,Ut,Vt,Ot,qt={exports:{}},Oe={};function Tn(){return Ut||(Ut=1,qt.exports=function(){if(Tt)return Oe;Tt=1;var e=Fr,t=typeof Object.is=="function"?Object.is:function(l,c){return l===c&&(l!==0||1/l==1/c)||l!=l&&c!=c},r=e.useState,o=e.useEffect,n=e.useLayoutEffect,i=e.useDebugValue;function a(l){var c=l.getSnapshot;l=l.value;try{var d=c();return!t(l,d)}catch{return!0}}var s=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?function(l,c){return c()}:function(l,c){var d=c(),u=r({inst:{value:d,getSnapshot:c}}),m=u[0].inst,p=u[1];return n(function(){m.value=d,m.getSnapshot=c,a(m)&&p({inst:m})},[l,d,c]),o(function(){return a(m)&&p({inst:m}),l(function(){a(m)&&p({inst:m})})},[l]),i(d),d};return Oe.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:s,Oe}()),qt.exports}var Un=(Ot||(Ot=1,Pt.exports=function(){if(Vt)return Ve;Vt=1;var e=Fr,t=Tn(),r=typeof Object.is=="function"?Object.is:function(l,c){return l===c&&(l!==0||1/l==1/c)||l!=l&&c!=c},o=t.useSyncExternalStore,n=e.useRef,i=e.useEffect,a=e.useMemo,s=e.useDebugValue;return Ve.useSyncExternalStoreWithSelector=function(l,c,d,u,m){var p=n(null);if(p.current===null){var v={hasValue:!1,value:null};p.current=v}else v=p.current;p=a(function(){function h(_){if(!k){if(k=!0,x=_,_=u(_),m!==void 0&&v.hasValue){var b=v.value;if(m(b,_))return f=b}return f=_}if(b=f,r(x,_))return b;var y=u(_);return m!==void 0&&m(b,y)?b:(x=_,f=y)}var x,f,k=!1,w=d===void 0?null:d;return[function(){return h(c())},w===null?void 0:function(){return h(w())}]},[c,d,u,m]);var g=o(l,p[0],p[1]);return i(function(){v.hasValue=!0,v.value=g},[g]),s(g),g},Ve}()),Pt.exports);const Vn=Nn(Un),{useSyncExternalStoreWithSelector:On}=Vn,Mt=e=>{const t=typeof e=="function"?(o=>o?Nt(o):Nt)(e):e,r=(o,n)=>function(i,a=i.getState,s){const l=On(i.subscribe,i.getState,i.getServerState||i.getState,a,s);return it(l),l}(t,o,n);return Object.assign(r,t),r},Dr=e=>e?Mt(e):Mt;var zr=(e=>(e.RIGHT="right",e.LEFT="left",e))(zr||{});const qe=e=>e!=null&&typeof e=="object"&&typeof Reflect.get(e,"taskStatus")=="string",Ht=e=>e!=null&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(t=>t===null||typeof t=="string"),Ft=e=>e!=null&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(t=>t===null||typeof t=="number"),Dt=e=>Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.every(r=>{if(typeof r!="object"||r===null)return!1;const o=Reflect.get(r,"selected");return o==="left"||o==="right"||o===null})),Ke=(e,t)=>{const{allowUndefined:r=!0,rejectBooleanRecord:o=!1}=t??{};if(e===void 0)return r;if(e===null||typeof e=="string"||typeof e=="number"||Array.isArray(e))return!0;if(typeof e=="object"&&e!==null){if(o){const n=Object.values(e);if(n.length>0&&n.every(i=>typeof i=="boolean"))return!1}return!0}return!1},Je=(e,t)=>{var r;if(t===null)return null;if(e.type==="texturlprompt")return(o=>o===void 0||typeof o=="object"&&o!==null&&"skipped"in o)(t)?t:void 0;if(t===void 0)return null;if(e.type==="consentlegal")return typeof t=="object"&&"submitted"in t&&t.submitted===!0?t:null;if(e.type==="multipleselect"){const o=(r=e.props)==null?void 0:r.options;if(Array.isArray(o)&&(n=>typeof n=="object"&&n!==null&&!Array.isArray(n)&&Object.values(n).every(i=>typeof i=="boolean"))(t)){const n=t;return o.reduce((i,a)=>(n[String(a.id)]&&i.push(a.value),i),[])}}if(e.type==="multiplechoice"){if(typeof t=="object"&&t!==null&&!Array.isArray(t)){if(Object.keys(t).length===0)return null;const o=Object.values(t).find(n=>n!==!1&&n!==void 0);if(o!==void 0)return o}return Ke(t,{allowUndefined:!1,rejectBooleanRecord:!0})?t:null}return Ke(t,{allowUndefined:!1,rejectBooleanRecord:!0})?t:null},qn=/<piped-value\b([^>]*)>.*?<\/piped-value>/gis,zt=["questionHtml","captionHtml","footerHtml","richTextBody"],Ye=e=>!!e.props&&typeof e.props=="object"&&"properties"in e.props,Me=e=>!!e.props&&typeof e.props=="object"&&"options"in e.props&&Array.isArray(e.props.options),Bt=e=>["string","number"].includes(typeof e),$t=e=>e.length===0?"":e.length===1?e[0]:e.join(", "),Mn=e=>{var r,o;const t=(n=>n!=null&&typeof n=="object"&&"value"in n)(e)?e.value:void 0;if(t!=null){if(e.type==="multipleselect"&&Me(e)&&(n=>!!n&&typeof n=="object"&&!Array.isArray(n))(t)){const n=e.secondaryValue??null,i=e.props.options.filter(a=>t[String(a.id)]===!0).map(a=>{var s;return a.label+((s=n==null?void 0:n[String(a.id)])!=null&&s.userText?`: ${n[String(a.id)].userText}`:"")});return i.length?$t(i):"No options selected"}if(e.type==="multiplechoice"&&typeof t=="object"&&t!==null){const n=Object.keys(t);if(n.length===0)return"No options selected";const i=e.secondaryValue??null,a=n[0];if(a){const s=e.props.options.find(l=>String(l.id)===a);return(s==null?void 0:s.label)+((r=i==null?void 0:i[a])!=null&&r.userText?`: ${(o=i==null?void 0:i[a])==null?void 0:o.userText}`:"")}}if(e.type==="matrix"&&Me(e)&&(n=>{if(!Ye(n))return!1;const i=n.props.properties;return!!i&&typeof i=="object"&&"matrixColumn"in i})(e)){const n=e.props.options,i=e.props.properties.matrixColumn,a=[];for(const[s,l]of Object.entries(t)){const c=n.find(v=>String(v.id)===s),d=(c==null?void 0:c.label)??s,u=Bt(l)?String(l):JSON.stringify(l),m=i.find(v=>v.value===u),p=(m==null?void 0:m.label)??u;a.push(`${d}: ${p}`)}return a.join("; ")}if(e.type==="rankorder"&&Me(e)){const n=e.props.options.reduce((a,s)=>(a[String(s.id)]=s.label,a),{}),i=[];for(const[a,s]of Object.entries(t)){const l=n[a];l&&(i[s-1]=l)}return $t(i)}if(Bt(t)){const n=String(t).replaceAll(/[\u200B-\u200D\uFEFF]/g,"").trim();return n===""?void 0:n}try{return JSON.stringify(t)}catch{return String(t)}}},Qt=(e,t)=>{const r=new RegExp(`${t}="([^"]*)"`,"i").exec(e);return(r==null?void 0:r[1])??null},Hn=(e,t)=>{if(e==null)return e;let r=!1;const o=e.replace(qn,(n,i)=>{r=!0;const a=Qt(i,"answer-id"),s=Qt(i,"fallback-text")??"";if(!a)return s;const l=a.startsWith("attr-")?a:Number(a);if(Object.hasOwn(t,l)){const c=t[l];return String(c)}return s});return r?o:e},Xe=(e,t)=>{const r={};if(t)for(const[o,n]of Object.entries(t))typeof n=="string"?r[`attr-${o}`]=n:n!=null&&(r[`attr-${o}`]=JSON.stringify(n));for(const o of e){const n=Mn(o);n!==void 0&&(r[o.name]=n)}return r},Fn=(e,t,r)=>{switch(t){case"videovoice":return!!(e!=null&&e.value);case"open":return!!r;case"multipleselect":return!!(r&&Object.keys(r).length);case"recordedtask":return r!==null&&typeof r=="object"&&"taskStatus"in r&&r.taskStatus==="completed";case"texturlprompt":return!e.value;case"consentlegal":case"nps":case"likert":return r!==null;case"multiplechoice":return r!==void 0;case"matrix":return!!(r&&Object.values(r).every(o=>o!==null));default:return!0}},Br=(e,t)=>{if(t==="matrix"&&e&&typeof e=="object"){const r=Object.keys(e).length,o=Object.values(e).filter(n=>n!==null).length;return o>0&&o<r}return!1},Ee=e=>e==null?"":typeof e=="object"?JSON.stringify(e):typeof e=="string"?e:String(e),oe={eq:(e,t)=>Number(e)===Number(t),neq:(e,t)=>!oe.eq(e,t),gt:(e,t)=>Number(e)>Number(t),gte:(e,t)=>Number(e)>=Number(t),lt:(e,t)=>Number(e)<Number(t),lte:(e,t)=>Number(e)<=Number(t),list_exact(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;const r=(o,n)=>String(o).localeCompare(String(n));return e.slice().sort(r).join(",")===t.slice().sort(r).join(",")},list_all:(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&!t.some(r=>!e.includes(r)),list_alo(e,t){if(!Array.isArray(t))return!1;const r=Array.isArray(e)?e:[e],o=new Set(r);return t.some(n=>o.has(n))},list_dni(e,t){if(!Array.isArray(t))return!1;const r=Array.isArray(e)?e:[e],o=new Set(r);return t.every(n=>!o.has(n))},contains(e,t){const r=Ee(e).toLowerCase(),o=Ee(t).toLowerCase();return r.includes(o)},notcontains:(e,t)=>!oe.contains(e,t)},me={eq:(e,t)=>e==t,neq:(e,t)=>!me.eq(e,t),gt:(e,t)=>Number(e)>Number(t),gte:(e,t)=>Number(e)>=Number(t),lt:(e,t)=>Number(e)<Number(t),lte:(e,t)=>Number(e)<=Number(t),list_exact(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;const r=(o,n)=>String(o).localeCompare(String(n));return e.slice().sort(r).join(",")===t.slice().sort(r).join(",")},list_all:(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&!t.some(r=>!e.includes(r)),list_alo(e,t){if(!Array.isArray(t))return!1;const r=Array.isArray(e)?e:[e],o=new Set(r);return t.some(n=>o.has(n))},list_dni(e,t){if(!Array.isArray(t))return!1;const r=Array.isArray(e)?e:[e],o=new Set(r);return t.every(n=>!o.has(n))},contains(e,t){const r=String(e??"").toLowerCase(),o=String(t??"").toLowerCase();return r.includes(o)},notcontains:(e,t)=>!me.contains(e,t)},Dn=e=>e in me,$r=1,zn=2,Bn=e=>{var o,n,i;switch(e.type){case"multipleselect":return e&&e.props&&e.props.options?e.props.options.length>13?e.props.options.map(a=>[a.value]):(t=e.props.options.map(a=>a.value),r=!e.props.properties.required,t.reduce((a,s)=>a.concat(a.map(l=>[...l,s])),[[]]).filter(a=>r||a.length>0)):null;case"multiplechoice":{if(!e||!e.props||!e.props.options)return null;const a=e.props.options.map(s=>s.value);return e.props.properties.required||a.push(void 0),a}case"matrix":{if(!((o=e==null?void 0:e.props)!=null&&o.options))return null;const a=e.props.properties.matrixColumn,s=e.props.options,l=s.reduce((d,u)=>(d[u.id]=null,d),{}),c=[{...l,[s[0].id]:a[0].value},s.reduce((d,u)=>(d[u.id]=a[0].value,d),{})];return e.props.properties.required||c.push(l),c}case"likert":{const a=Number((i=(n=e.props)==null?void 0:n.properties)==null?void 0:i.range)||5;return[...Array.from(new Array(a).keys()).map(l=>l+1),...e.props.properties.required?[]:[null]]}case"nps":return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case"videovoice":case"open":return["1",...e.props.properties.required?[]:[""]];case"recordedtask":{const a=[{taskStatus:"completed"},{taskStatus:"given.up"}];return e.props.properties.required||a.push({taskStatus:"abandoned"}),a}case"texturlprompt":return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case"consentlegal":return[1,...e.props.properties.required?[]:[null]];default:return[1]}var t,r},$n=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,Qn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&"comparator"in e&&"questionIndex"in e,Qr=(e,t)=>{const r=[];for(const o of e)Array.isArray(o)?r.push(...Qr(o,t)):Qn(o)&&o.questionIndex===t&&r.push(o);return r},Wn=(e,t=[])=>t.reduce((r,o)=>{const{group:n,target:i}=o;if(!(n!=null&&n.length))return[...r];const a=Qr(n,e).map(s=>{const{comparator:l,value:c}=s;return{comparator:l,target:i,value:c}});return[...r,...a]},[]),Wr=(e,t,r)=>r>0?t?e.length-3:e.length-2:t?e.length-2:e.length-1,Zr=({cards:e,index:t,hasEndCard:r,allResponses:o,uploadProgress:n={},surveyVisitorAttributes:i={}})=>{var u,m,p;if(t>=e.length||t<0)return null;const a=e[t];let s=t+1;const l=a.props.routingOptions||[];for(const v of l){if(!Gr(v))continue;const{group:g,target:h}=v;if(Yr({group:g,allResponses:o,cards:e,surveyVisitorAttributes:i})){s=h===-1&&r?e.length-1:h;break}}const c=e.findIndex(v=>v.type==="uploading"),d=Wr(e,r,c);for(;s!==null&&s!==-1&&s<=d&&((m=(u=e[s])==null?void 0:u.props)!=null&&m.displayLogic)&&e[s].props.displayLogic.length>0;){const v=e[s].props.displayLogic||[];if(ut({displayLogic:v,allResponses:o,cards:e,surveyVisitorAttributes:i}))break;s++}if(s!==-1&&((p=e==null?void 0:e[s])!=null&&p.parentId)){const v=e.findIndex(g=>{var h;return g.name===((h=e==null?void 0:e[s])==null?void 0:h.parentId)});if(v>-1){const g=e[v],h=o[v],x=_e({comparator:"answered",type:g.type,response:h}),f=g.type==="matrix"&&_e({comparator:"partial",type:g.type,response:h});x||f||s++}}return t>=d||s===-1||s!==null&&s>d?c>0&&Object.values(n).some(g=>g.isSubmitted&&!g.isComplete)?c:r?e.length-1:null:s===-1?null:s},Gr=e=>typeof e=="object"&&e!==null&&"group"in e,Kr=e=>e===$r||e===zn,Wt=({segment:e,allResponses:t,cards:r,surveyVisitorAttributes:o})=>Array.isArray(e)?Jr({segments:e,allResponses:t,cards:r,surveyVisitorAttributes:o}):!Kr(e)&&!!(n=>typeof n=="object"&&n!==null&&!Array.isArray(n)&&"comparator"in n)(e)&&(({rule:n,allResponses:i,cards:a,surveyVisitorAttributes:s})=>{if(n.questionIndex===void 0||typeof n.questionIndex=="number"&&n.questionIndex>=i.length)return!1;const l=(({rule:c,allResponses:d,cards:u,surveyVisitorAttributes:m})=>{if(c.questionIndex===void 0)return null;if(typeof(p=c.questionIndex)=="string"&&p.startsWith("attr-")){const g=(h=>h.slice(5))(c.questionIndex);return g in m?{response:m[g],type:"AttributeCheck"}:null}var p;const v=c.questionIndex;return{response:d[v],type:u[v].type}})({rule:n,allResponses:i,cards:a,surveyVisitorAttributes:s});return l!==null&&!!_e({comparator:n.comparator,response:l.response,type:l.type,value:n.value})})({rule:e,allResponses:t,cards:r,surveyVisitorAttributes:o}),Jr=({segments:e,allResponses:t,cards:r,surveyVisitorAttributes:o})=>{if(!e||e.length===0)return!1;let n=Wt({segment:e[0],allResponses:t,cards:r,surveyVisitorAttributes:o}),i=1;for(;i<e.length;){const a=e[i];if(!Kr(a)||(i+=1,i>=e.length))return!1;const s=Wt({segment:e[i],allResponses:t,cards:r,surveyVisitorAttributes:o});i+=1,n=a===$r?n&&s:n||s}return n},ut=({displayLogic:e,allResponses:t,cards:r,surveyVisitorAttributes:o})=>e.some(n=>!!Gr(n)&&Yr({group:n.group,allResponses:t,cards:r,surveyVisitorAttributes:o})),Yr=({group:e,allResponses:t,cards:r,surveyVisitorAttributes:o})=>Jr({segments:e,allResponses:t,cards:r,surveyVisitorAttributes:o}),_e=({comparator:e,response:t,type:r,value:o})=>{if(r==="AttributeCheck")return((i,a,s)=>{const l=Ee(a),c=Ee(s),d=Number(a),u=Number(s),m=!Number.isNaN(d)&&l===String(d),p=!Number.isNaN(u)&&c===String(u),v=m&&p;switch(i){case"eq":return v?d===u:l.toLowerCase()===c.toLowerCase();case"neq":return v?d!==u:l.toLowerCase()!==c.toLowerCase();case"contains":case"notcontains":return oe[i](l,c);case"gt":case"gte":case"lt":case"lte":return v?oe[i](d,u):oe[i](l.localeCompare(c),0);case"list_exact":case"list_all":case"list_alo":case"list_dni":{const g=Array.isArray(a)?a:[a],h=Array.isArray(s)?s:[s];return oe[i](g,h)}default:return!1}})(e,t,o);if(!Ke(t))return!1;const n=t;if(e==="answered")switch(r){case"texturlprompt":return n===void 0;case"consentlegal":return n&&(i=>i===null||i!==void 0&&typeof i=="object"&&"submitted"in i&&typeof i.submitted=="boolean")(n)&&n.submitted===!0;case"recordedtask":return qe(n)&&n.taskStatus==="completed";case"likert":case"nps":return Number.isInteger(n);case"rankorder":return Ft(n)&&Object.values(n).every(i=>i!==null);case"matrix":return Ht(n)&&Object.values(n).every(i=>i!==null);case"maxdiff":return Dt(n)&&n.every(i=>{if(!Array.isArray(i))return!1;const a=i.some(l=>l.selected==="left"),s=i.some(l=>l.selected==="right");return a&&s});case"multiplechoice":return!!n;case"multipleselect":return n&&Array.isArray(n)&&(n.length??0)>0;case"open":case"aidynamicstandalone":return typeof n=="string"&&!!n;case"videovoice":return(i=>i!=null&&typeof i=="object"&&"mediaRecordingUid"in i&&typeof i.mediaRecordingUid=="string")(n)&&!!n.mediaRecordingUid;default:return!1}if(e==="given_up")return r!=="recordedtask"||qe(n)&&n.taskStatus==="given.up";if(e==="partial")return Br(n,r);if(e==="skipped")switch(r){case"texturlprompt":return(i=>i!==null&&(i===void 0||typeof i=="object"))(n)&&!!(typeof n=="object"&&n!==null&&"skipped"in n&&n.skipped);case"consentlegal":case"likert":case"nps":case"videovoice":return n===null;case"recordedtask":return qe(n)&&n.taskStatus==="abandoned";case"open":case"aidynamicstandalone":return n===null||typeof n=="string"&&n.length===0;case"multiplechoice":return n==null;case"multipleselect":return n===null||Array.isArray(n)&&n.length===0;case"matrix":return n===null||Ht(n)&&Object.values(n).every(i=>i===null);case"maxdiff":return n===null||!Dt(n)||n.some(i=>{if(!Array.isArray(i))return!0;const a=i.some(l=>l.selected==="left"),s=i.some(l=>l.selected==="right");return!(a&&s)});case"rankorder":return n===null||Ft(n)&&Object.values(n).includes(null);default:return!1}return o!==void 0&&me[e](n,o)};var Xr=(e=>(e.CONTINUE="CONTINUE",e.EXTERNAL="EXTERNAL",e.NO_BUTTON="NO_BUTTON",e))(Xr||{}),G=(e=>(e.failure="failure",e.success="success",e.inFlight="inFlight",e))(G||{}),en=(e=>(e.Unlimited="Unlimited",e.Maximum="Maximum",e.Range="Range",e))(en||{});const Zn=e=>{var t,r,o,n,i,a,s,l,c;switch(e.type){case"rankorder":case"multipleselect":case"multiplechoice":return(r=(t=e==null?void 0:e.props)==null?void 0:t.options)==null?void 0:r.map(d=>d.label);case"nps":return"1-10";case"likert":return`1-${((n=(o=e==null?void 0:e.props)==null?void 0:o.properties)==null?void 0:n.range)??5}`;case"matrix":return{matrixColumns:(s=(a=(i=e==null?void 0:e.props)==null?void 0:i.properties)==null?void 0:a.matrixColumn)==null?void 0:s.map(d=>d.label),matrixRows:(c=(l=e==null?void 0:e.props)==null?void 0:l.options)==null?void 0:c.map(d=>d.label)};default:return}},Gn=new Set(["rankorder","multipleselect","multiplechoice","matrix","likert","nps","open","aidynamicfollowup","aidynamicstandalone"]),Zt=({cards:e,combinedReadableRawResponses:t,targetQuestionId:r,generateQuestionType:o})=>{let n=1,i=1;const a=e.reduce((s,l)=>{if(l.name>0&&Gn.has(l.type)){if(r===l.name&&(i=n,o==="aidynamicstandalone"))return n++,s;if((l.type==="aidynamicfollowup"||l.type==="aidynamicstandalone")&&l.props.loading!==G.success)return s;const c="properties"in l.props&&l.props.properties&&"captionText"in l.props.properties?l.props.properties.captionText:void 0,d=(u=>u.type!=="uploading"&&u.type!=="thanks")(l)?{order:n++,question:l.props.message,questionDescription:c,questionType:l.type,response:t==null?void 0:t[l.name],options:Zn(l)}:{order:n++,questionType:l.type,response:t==null?void 0:t[l.name]};s.push(d)}return s},[]);return{targetQuestionOrder:i,questionsResponses:a}},Gt=e=>{var t;return"props"in e&&"loading"in e.props&&((t=e==null?void 0:e.props)==null?void 0:t.loading)!==void 0},He=(e,t,r)=>{let o=!1;const n=e.map(i=>i&&i.parentId===t?(o=!0,r(i)):i);return o?n:e},Fe=(e,t,r)=>{let o=!1;const n=e.map(i=>i&&i.name===t?(o=!0,r(i)):i);return o?n:e},Kt=e=>{const{props:t}=e;return t&&"message"in t&&"properties"in t?{...e,props:{...t,loading:G.inFlight}}:e},Jt=({isPreview:e,apiURL:t,envId:r,userId:o,headers:n})=>e?{url:`${t}/sdk/1/environments/${r}/dynamic-question-preview`,visitorIdHeader:"0"}:{url:`${t}/sdk/1/environments/${r}/visitors/${o}/dynamic-question`,visitorIdHeader:n["x-ul-visitor-id"]},De=new Set(["thanks","uploading"]),B=Dr()((e,t)=>({providerPersona:void 0,showProviderPersona:!1,addResponseGroupMeta:void 0,allResponses:[],allResponsesRaw:{},answers:void 0,apiURL:"",avatars:{agentAvatar:{"1x":"","2x":""},respondentAvatar:{"1x":"","2x":""}},border:"#000000",cards:[],cardIndexByName:{},close:async(r=V.APP_ID)=>{const o=t(),{fadeout:n,remove:i,trackHistory:a,studyType:s}=o;await n(r),ze(o)||a({event:"closed"}),E.breadcrumbsLogger.info("SurveyClosing",{surveyId:o.surveyId}),V.ConflictingWidgets.enable(),i({initiator:E.DismissReason.Closed,studyType:s})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async r=>{const{eventEmitFn:o,fadeout:n,remove:i,studyType:a,surveyId:s}=t();o("survey.complete",s),await n(r),V.ConflictingWidgets.enable(),i({initiator:E.DismissReason.Complete,studyType:a})},enableCspTrustedTypes:!1,endCard:{headline:""},envId:"",eventEmitFn:E.eventEmitter.emit.bind(E.eventEmitter),fadeout:async r=>{const{eventEmitFn:o,headers:n,viewDocument:i}=t();return E.shouldDirectEmbed(n)?Promise.resolve():(o(E.SprigEvent.SurveyFadingOut),new Promise(a=>{const s=i.getElementById(r);s?(s.addEventListener("transitionend",()=>{a()}),s.classList.remove("ul-app--visible")):a()}))},forceBrandedLogo:!1,frame:document.createElement("iframe"),handleClickEmbedButton:r=>{const{cards:o,eventEmitFn:n,index:i}=t();n(r,{qid:o[i].name,props:o[i].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:r,isComplete:o,progressPct:n,isSubmitted:i})=>{var p,v,g;const{cards:a,destroy:s,index:l,uploadProgress:c}=t(),d=o||((p=c[r])==null?void 0:p.isComplete),u={...c,[r]:{progressPct:d?100:n||((v=c[r])==null?void 0:v.progressPct),isComplete:d,isSubmitted:i||((g=c[r])==null?void 0:g.isSubmitted)}};if(e({uploadProgress:u}),a[l].type!=="uploading")return;const m=Object.entries(c).every(([h,x])=>!x.isSubmitted||x.isComplete||r==h&&o);if(m&&l>=a.length-1)return s(V.APP_ID);e({index:m?l+1:l,uploadingCardViewed:!0})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":"web","x-ul-environment-id":"","x-ul-installation-method":"web-snippet","x-ul-sdk-version":"","x-ul-visitor-id":""},index:0,isConversationalUI:!1,isPreview:!1,layout:"default",marketingUrl:"https://sprig.com",meta:{ch:0,cw:0,l:"",mode:null,p:"",sh:0,sw:0},mode:void 0,next:r=>{const{allResponses:o,cards:n,eventEmitFn:i,index:a,responseGroupUid:s,submit:l,trackHistory:c,uploadProgress:d,viewedCardCount:u}=t(),m=Array.isArray(r.data)?r.data:[r.data],p=Date.now(),v=[...n],g={response:[],responseGroupUid:s,questionIndex:a};let h=null;const x=o.slice(0);let f=a;m.forEach((_,b)=>{const y=Math.floor(_.questionId),A=v.findIndex(L=>L.name===y),R=A>=0?v[A]:v[a+b],N={value:_.value,questionId:y,answeredAt:p,..._.secondaryValue!==void 0&&{secondaryValue:_.secondaryValue},..._.questionText!==void 0&&{questionText:_.questionText}},P=N.value;(L=>L&&!De.has(L.type))(R)&&(R.value=P,R.secondaryValue=N.secondaryValue||null),g.response.push(N);const T=A>=0?A:a+b;x[T]=Je(R,P),T>f&&(f=T)}),h=Zr({cards:v,index:f,hasEndCard:!!r.endCard,uploadProgress:d,allResponses:x,surveyVisitorAttributes:t().surveyVisitorAttributes}),e({allResponses:x}),(h===null||De.has(v[h].type))&&(g.completedAt=p);const k=l(g);if(h===null)return void r.completeSurvey();h&&!De.has(v[h].type)&&k.finally(()=>{c({event:"seen",index:h})});const w=v[h];v[h]&&i&&i("survey.question",{qid:w.name,props:w.props}),e({cards:v,hasViewedEmbed:!1,index:h,viewedCardCount:u+1})},pendingRemoveIframeReason:null,previewKey:null,recorder:()=>{},recorderEventEmitter:E.eventEmitter,resolveTrackedPromise:()=>{const{removeIframeIfReady:r}=t();e(o=>({unresolvedRequestCount:o.unresolvedRequestCount-1})),r()},responseGroupUid:"",remove:({initiator:r,studyType:o})=>{const{eventEmitFn:n,removeIframeIfReady:i,surveyId:a}=t();e({pendingRemoveIframeReason:r,studyType:o}),n(E.SprigEvent.SurveyCloseRequested,{name:E.SprigEvent.SurveyCloseRequested,initiator:r,studyType:o,"survey.id":a}),i()},removeIframeIfReady:()=>{const{eventEmitFn:r,pendingRemoveIframeReason:o,unresolvedRequestCount:n,studyType:i,surveyId:a}=t();o&&n===0&&(r(E.SprigEvent.SurveyWillClose,{name:E.SprigEvent.SurveyWillClose,initiator:o,studyType:i,"survey.id":a}),e({pendingRemoveIframeReason:null,studyType:i}))},seen:async()=>{const{trackHistory:r}=t();return r({event:"seen",isNew:!0})},createDynamicStandaloneQuestion:async({questionId:r})=>{var m,p,v;let o=!1;if(e(g=>{const h=g.cards.find(x=>(x==null?void 0:x.name)===r);return!(h!=null&&h.name)||Gt(h)?g:(o=!0,{cards:Fe(g.cards,r,Kt)})}),!o)return;const n=t(),{targetQuestionOrder:i,questionsResponses:a}=Zt({cards:n.cards,combinedReadableRawResponses:n.allResponsesRaw,targetQuestionId:r,generateQuestionType:"aidynamicstandalone"}),s={surveyId:n.surveyId,responseGroupUid:n.responseGroupUid,standaloneQuestionOrder:i,questionsResponses:a,standaloneQuestionId:r,customMetadata:n.customMetadata,meta:n.meta,previewKey:n.previewKey,isPreview:n.isPreview};let l=!1;const c=()=>{if(l)return;l=!0;const g=t(),h=g.cards.find(({name:x})=>x===r);if(e(x=>({cards:Fe(x.cards,r,f=>{const{props:k}=f;return k&&"message"in k&&"properties"in k?{...f,value:"",props:{...k,loading:G.failure,properties:{...k.properties,required:!1}}}:f})})),E.isLongFormSurvey(g.studyType)&&(h!=null&&h.groupId)){const x=g.cards.reduce((w,_)=>((_==null?void 0:_.groupId)===h.groupId&&w.push(_),w),[]),f=x.findIndex(w=>w.name===h.name),k=f+1;if(k<x.length){const w=x[k].name;g.setFocusedQuestionId(w)}else{const w=x[f-1].name;g.setFocusedQuestionId(w)}}else g.next({data:{value:"",questionId:h.name,type:h.type},completeSurvey:()=>g.destroy(V.APP_ID),endCard:g.endCard})},d=new AbortController,u=setTimeout(()=>{d.abort(),c();const g=new Error("Timeout reached—question skipped");n.trackPromise(re(n,"aidynamicstandalone",g))},3e3);try{const{url:g,visitorIdHeader:h}=Jt(n),x=await n.trackPromise(E.sprigFetch(g,{body:JSON.stringify(s),headers:{...n.headers,"x-ul-visitor-id":h},method:"POST",signal:d.signal}));if(!x.ok||!((v=(p=(m=x==null?void 0:x.json)==null?void 0:m.props)==null?void 0:p.message)!=null&&v.length))return c(),void await n.trackPromise(re(n,"dynamicQuestion",x.error));if(l)return;l=!0,e(f=>({cards:Fe(f.cards,r,k=>{const w=k.props;return w&&"message"in w&&"properties"in w?{...k,props:{...w,loading:G.success,message:x.json.props.message}}:k})}))}finally{clearTimeout(u)}},createDynamicFollowupQuestion:async({parentQuestionId:r,parentResponseConfig:o})=>{var g,h,x;let n=!1;e(f=>{const k=f.cards.find(w=>(w==null?void 0:w.parentId)===r);return!(k!=null&&k.name)||Gt(k)?f:(n=!0,{cards:He(f.cards,r,Kt)})});const i=t(),a