UNPKG

@sprig-technologies/sprig-browser

Version:

npm package for the sprig web sdk

1 lines • 114 kB
"use strict";const P=require("./core-DSREyRo8.cjs"),E=require("./metricsReporter-CIbUupJP.cjs");var he,C,rr,X,ft,nr,$e,or,fe={},ir=[],cn=/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 sr(e){var t=e.parentNode;t&&t.removeChild(e)}function q(e,t,r){var o,n,i,s={};for(i in t)i=="key"?o=t[i]:i=="ref"?n=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?he.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return pe(e,s,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 ar(){return{current:null}}function H(e){return e.children}function z(e,t){this.props=e,this.context=t}function se(e,t){if(t==null)return e.__?se(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"?se(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,s,a,l;for(X.sort($e);e=X.shift();)e.__d&&(t=X.length,o=void 0,i=(n=(r=e).__v).__e,a=[],l=[],(s=r.__P)&&((o=Q({},n)).__v=n.__v+1,C.vnode&&C.vnode(o),et(s,o,n,r.__n,s.ownerSVGElement!==void 0,32&n.__u?[i]:null,a,i??se(n),!!(32&n.__u),l),o.__.__k[o.__i]=o,dr(a,o,l),o.__e!=i&&lr(o)),X.length>t&&X.sort($e));Ie.__r=0}function ur(e,t,r,o,n,i,s,a,l,u,d){var c,_,p,y,m,h=o&&o.__k||ir,x=t.length;for(r.__d=l,function(f,k,w){var g,v,b,A,R,N=k.length,T=w.length,U=T,L=0;for(f.__k=[],g=0;g<N;g++)(v=f.__k[g]=(v=k[g])==null||typeof v=="boolean"||typeof v=="function"?null:typeof v=="string"||typeof v=="number"||typeof v=="bigint"||v.constructor==String?pe(null,v,null,null,v):je(v)?pe(H,{children:v},null,null,null):v.constructor===void 0&&v.__b>0?pe(v.type,v.props,v.key,v.ref?v.ref:null,v.__v):v)!=null?(v.__=f,v.__b=f.__b+1,R=dn(v,w,A=g+L,U),v.__i=R,b=null,R!==-1&&(U--,(b=w[R])&&(b.__u|=131072)),b==null||b.__v===null?(R==-1&&L--,typeof v.type!="function"&&(v.__u|=65536)):R!==A&&(R===A+1?L++:R>A?U>N-A?L+=R-A:L--:L=R<A&&R==A-1?R-A:0,R!==g+L&&(v.__u|=65536))):(b=w[g])&&b.key==null&&b.__e&&(b.__e==f.__d&&(f.__d=se(b)),We(b,b,!1),w[g]=null,U--);if(U)for(g=0;g<T;g++)(b=w[g])!=null&&!(131072&b.__u)&&(b.__e==f.__d&&(f.__d=se(b)),We(b,b))}(r,t,h),l=r.__d,c=0;c<x;c++)(p=r.__k[c])!=null&&typeof p!="boolean"&&typeof p!="function"&&(_=p.__i===-1?fe:h[p.__i]||fe,p.__i=c,et(e,p,_,n,i,s,a,l,u,d),y=p.__e,p.ref&&_.ref!=p.ref&&(_.ref&&tt(_.ref,null,p),d.push(p.ref,p.__c||y,p)),m==null&&y!=null&&(m=y),65536&p.__u||_.__k===p.__k?l=cr(p,l,e):typeof p.type=="function"&&p.__d!==void 0?l=p.__d:y&&(l=y.nextSibling),p.__d=void 0,p.__u&=-196609);r.__d=l,r.__e=m}function cr(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=cr(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,s=r-1,a=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(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&n==l.key&&i===l.type)return s;s--}if(a<t.length){if((l=t[a])&&!(131072&l.__u)&&n==l.key&&i===l.type)return a;a++}}return-1}function mt(e,t,r){t[0]==="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||cn.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||mt(e.style,t,"");if(r)for(t in r)o&&r[t]===o[t]||mt(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?gt:_t,i)):e.removeEventListener(t,i?gt:_t,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 _t(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 gt(e){return this.l[e.type+!0](C.event?C.event(e):e)}function et(e,t,r,o,n,i,s,a,l,u){var d,c,_,p,y,m,h,x,f,k,w,g,v,b,A,R=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),i=[a=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=(c=t.__c=r.__c).__=c.__E:("prototype"in R&&R.prototype.render?t.__c=c=new R(x,k):(t.__c=c=new z(x,k),c.constructor=R,c.render=fn),f&&f.sub(c),c.props=x,c.state||(c.state={}),c.context=k,c.__n=o,_=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),R.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=Q({},c.__s)),Q(c.__s,R.getDerivedStateFromProps(x,c.__s))),p=c.props,y=c.state,c.__v=t,_)R.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(R.getDerivedStateFromProps==null&&x!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(x,k),!c.__e&&(c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(x,c.__s,k)===!1||t.__v===r.__v)){for(t.__v!==r.__v&&(c.props=x,c.state=c.__s,c.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.forEach(function(N){N&&(N.__=t)}),w=0;w<c._sb.length;w++)c.__h.push(c._sb[w]);c._sb=[],c.__h.length&&s.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(x,c.__s,k),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,y,m)})}if(c.context=k,c.props=x,c.__P=e,c.__e=!1,g=C.__r,v=0,"prototype"in R&&R.prototype.render){for(c.state=c.__s,c.__d=!1,g&&g(t),d=c.render(c.props,c.state,c.context),b=0;b<c._sb.length;b++)c.__h.push(c._sb[b]);c._sb=[]}else do c.__d=!1,g&&g(t),d=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++v<25);c.state=c.__s,c.getChildContext!=null&&(o=Q(Q({},o),c.getChildContext())),_||c.getSnapshotBeforeUpdate==null||(m=c.getSnapshotBeforeUpdate(p,y)),ur(e,je(A=d!=null&&d.type===H&&d.key==null?d.props.children:d)?A:[A],t,r,o,n,i,s,a,l,u),c.base=t.__e,t.__u&=-161,c.__h.length&&s.push(c),h&&(c.__E=c.__=null)}catch(N){t.__v=null,l||i!=null?(t.__e=a,t.__u|=l?160:32,i[i.indexOf(a)]=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,s,l,u);(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,s,a,l){var u,d,c,_,p,y,m,h=r.props,x=t.props,f=t.type;if(f==="svg"&&(n=!0),i!=null){for(u=0;u<i.length;u++)if((p=i[u])&&"setAttribute"in p==!!f&&(f?p.localName===f:p.nodeType===3)){e=p,i[u]=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,a=!1}if(f===null)h===x||a&&e.data===x||(e.data=x);else{if(i=i&&he.call(e.childNodes),h=r.props||fe,!a&&i!=null)for(h={},u=0;u<e.attributes.length;u++)h[(p=e.attributes[u]).name]=p.value;for(u in h)p=h[u],u=="children"||(u=="dangerouslySetInnerHTML"?c=p:u==="key"||u in x||xe(e,u,null,p,n));for(u in x)p=x[u],u=="children"?_=p:u=="dangerouslySetInnerHTML"?d=p:u=="value"?y=p:u=="checked"?m=p:u==="key"||a&&typeof p!="function"||h[u]===p||xe(e,u,p,h[u],n);if(d)a||c&&(d.__html===c.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(c&&(e.innerHTML=""),ur(e,je(_)?_:[_],t,r,o,n&&f!=="foreignObject",i,s,i?i[0]:r.__k&&se(r,0),a,l),i!=null)for(u=i.length;u--;)i[u]!=null&&sr(i[u]);a||(u="value",y!==void 0&&(y!==e[u]||f==="progress"&&!y||f==="option"&&y!==h[u])&&xe(e,u,y,h[u],!1),u="checked",m!==void 0&&m!==e[u]&&xe(e,u,m,h[u],!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||sr(e.__e),e.__=e.__e=e.__d=void 0}function fn(e,t,r){return this.constructor(e,r)}function ae(e,t,r){var o,n,i,s;C.__&&C.__(e,t),n=(o=typeof r=="function")?null:r&&r.__k||t.__k,i=[],s=[],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,s),dr(i,e,s)}function pr(e,t){ae(e,t,pr)}function mn(e,t,r){var o,n,i,s,a=Q({},e.props);for(i in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)i=="key"?o=t[i]:i=="ref"?n=t[i]:a[i]=t[i]===void 0&&s!==void 0?s[i]:t[i];return arguments.length>2&&(a.children=arguments.length>3?he.call(arguments,2):r),pe(e.type,a,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(s){this.props.value!==s.value&&n.some(function(a){a.__e=!0,Qe(a)})},this.sub=function(s){n.push(s);var a=s.componentWillUnmount;s.componentWillUnmount=function(){n.splice(n.indexOf(s),1),a&&a.call(s)}}),o.children}};return r.Provider.__=r.Consumer.contextType=r}he=ir.slice,C={__e:function(e,t,r,o){for(var n,i,s;t=t.__;)if((n=t.__c)&&!n.__)try{if((i=n.constructor)&&i.getDerivedStateFromError!=null&&(n.setState(i.getDerivedStateFromError(e)),s=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,o||{}),s=n.__d),s)return n.__E=n}catch(a){e=a}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 _n=0;function S(e,t,r,o,n,i){var s,a,l={};for(a in t)a=="ref"?s=t[a]:l[a]=t[a];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--_n,__i:-1,__u:0,__source:n,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(a in s)l[a]===void 0&&(l[a]=s[a]);return C.vnode&&C.vnode(u),u}var Z,j,Ue,ht,le=0,fr=[],ke=[],yt=C.__b,bt=C.__r,vt=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(gr,e)}function nt(e,t,r){var o=ee(Z++,2);if(o.t=e,!o.__c&&(o.__=[r?r(t):gr(void 0,t),function(a){var l=o.__N?o.__N[0]:o.__[0],u=o.t(l,a);l!==u&&(o.__N=[u,o.__[1]],o.__c.setState({}))}],o.__c=j,!j.u)){var n=function(a,l,u){if(!o.__c.__H)return!0;var d=o.__c.__H.__.filter(function(_){return _.__c});if(d.every(function(_){return!_.__N}))return!i||i.call(this,a,l,u);var c=!1;return d.forEach(function(_){if(_.__N){var p=_.__[0];_.__=_.__N,_.__N=void 0,p!==_.__[0]&&(c=!0)}}),!(!c&&o.__c.props===a)&&(!i||i.call(this,a,l,u))};j.u=!0;var i=j.shouldComponentUpdate,s=j.componentWillUpdate;j.componentWillUpdate=function(a,l,u){if(this.__e){var d=i;i=void 0,n(a,l,u),i=d}s&&s.call(this,a,l,u)},j.shouldComponentUpdate=n}return o.__N||o.__}function M(e,t){var r=ee(Z++,3);!C.__s&&st(r.__H,t)&&(r.__=e,r.i=t,j.__H.__h.push(r))}function ue(e,t){var r=ee(Z++,4);!C.__s&&st(r.__H,t)&&(r.__=e,r.i=t,j.__h.push(r))}function J(e){return le=5,Y(function(){return{current:e}},[])}function mr(e,t,r){le=6,ue(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 st(r.__H,t)?(r.__V=e(),r.i=t,r.__h=e,r.__V):r.__}function me(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 _r(){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 gn(){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,yt&&yt(e)},C.__r=function(e){bt&&bt(e),Z=0;var t=(j=e.__c).__H;t&&(Ue===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)),Ue=j},C.diffed=function(e){vt&&vt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(fr.push(t)!==1&&ht===C.requestAnimationFrame||((ht=C.requestAnimationFrame)||hn)(gn)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.__V!==ke&&(r.__=r.__V),r.i=void 0,r.__V=ke})),Ue=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 st(e,t){return!e||e.length!==t.length||t.some(function(r,o){return r!==e[o]})}function gr(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 yr(e,t){function r(n){var i=this.props.ref,s=i==n.ref;return!s&&i&&(i.call?i(null):i.current=null),t?!t(this.props,n)||!s: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 yn=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function at(e){function t(r){var o=hr({},r);return delete o.ref,e(o,r.ref||null)}return t.$$typeof=yn,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))},br={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},bn=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)}bn(e,t,r,o)};var It=C.unmount;function vr(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 vr(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(s){r=s.default||s},function(s){o=s}),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,s=function(){i||(i=!0,r.__R=null,n?n(a):a())};r.__R=s;var a=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 u;for(o.setState({__a:o.__b=null});u=o.t.pop();)u.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},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]=vr(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 vn(e){return this.getChildContext=function(){return e.context},e.children}function xn(e){var t=this,r=e.i;t.componentWillUnmount=function(){ae(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)}}),ae(q(vn,{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=""),ae(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 s=r[i];if(!(i==="value"&&"defaultValue"in r&&s==null||Sn&&i==="children"&&o==="noscript"||i==="class"||i==="className")){var a=i.toLowerCase();i==="defaultValue"&&"value"in r&&r.value==null?i="value":i==="download"&&s===!0?s="":a==="ondoubleclick"?i="ondblclick":a!=="onchange"||o!=="input"&&o!=="textarea"||In(r.type)?a==="onfocus"?i="onfocusin":a==="onblur"?i="onfocusout":wn.test(i)?i=a:o.indexOf("-")===-1&&kn.test(i)?i=i.replace(Cn,"-$&").toLowerCase():s===null&&(s=void 0):a=i="oninput",a==="oninput"&&n[i=a]&&(i="oninputCapture"),n[i]=s}}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 ye(e){return!!e&&e.$$typeof===Cr}function Er(e){return ye(e)&&e.type===H}function jr(e){return ye(e)?mn.apply(null,arguments):e}function Ae(e){return!!e.__k&&(ae(null,e),!0)}function Lr(e){return e&&(e.base||e.nodeType===1&&e)||null}var Nr=function(e,t){return e(t)},Tr=function(e,t){return e(t)},Ur=H;function ut(e){e()}function Or(e){return e}function Pr(){return[!1,ut]}var Vr=ue,qr=ye;function Mr(e,t){var r=t(),o=K({h:{__:r,v:t}}),n=o[0].h,i=o[1];return ue(function(){n.__=r,n.v=t,Oe(n)&&i({h:n})},[e,r,t]),M(function(){return Oe(n)&&i({h:n}),e(function(){Oe(n)&&i({h:n})})},[e]),r}function Oe(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:_r,useReducer:nt,useEffect:M,useLayoutEffect:ue,useInsertionEffect:Vr,useTransition:Pr,useDeferredValue:Or,useSyncExternalStore:Mr,startTransition:ut,useRef:J,useImperativeHandle:mr,useMemo:Y,useCallback:me,useContext:ot,useDebugValue:it,version:"17.0.2",Children:br,render:Sr,hydrate:Ir,unmountComponentAtNode:Ae,createPortal:wr,createElement:q,createContext:rt,createFactory:Ar,cloneElement:jr,createRef:ar,Fragment:H,isValidElement:ye,isElement:qr,isFragment:Er,findDOMNode:Lr,Component:z,PureComponent:Re,memo:yr,forwardRef:at,flushSync:Tr,unstable_batchedUpdates:Nr,StrictMode:Ur,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:br,Component:z,Fragment:H,PureComponent:Re,StrictMode:Ur,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:ar,default:Hr,findDOMNode:Lr,flushSync:Tr,forwardRef:at,hydrate:Ir,isElement:qr,isFragment:Er,isValidElement:ye,lazy:Le,memo:yr,render:Sr,startTransition:ut,unmountComponentAtNode:Ae,unstable_batchedUpdates:Nr,useCallback:me,useContext:ot,useDebugValue:it,useDeferredValue:Or,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:_r,useImperativeHandle:mr,useInsertionEffect:Vr,useLayoutEffect:ue,useMemo:Y,useReducer:nt,useRef:J,useState:K,useSyncExternalStore:Mr,useTransition:Pr,version:"17.0.2"},Symbol.toStringTag,{value:"Module"})),Nt=e=>{let t;const r=new Set,o=(s,a)=>{const l=typeof s=="function"?s(t):s;if(!Object.is(l,t)){const u=t;t=a??typeof l!="object"?l:Object.assign({},t,l),r.forEach(d=>d(t,u))}},n=()=>t,i={setState:o,getState:n,subscribe:s=>(r.add(s),()=>r.delete(s)),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 Tn(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 Tt={exports:{}},Pe={};const Fr=Tn(Ln);var Ut,Ot,Pt,Vt,qt={exports:{}},Ve={};function Un(){return Ot||(Ot=1,qt.exports=function(){if(Ut)return Ve;Ut=1;var e=Fr,t=typeof Object.is=="function"?Object.is:function(l,u){return l===u&&(l!==0||1/l==1/u)||l!=l&&u!=u},r=e.useState,o=e.useEffect,n=e.useLayoutEffect,i=e.useDebugValue;function s(l){var u=l.getSnapshot;l=l.value;try{var d=u();return!t(l,d)}catch{return!0}}var a=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?function(l,u){return u()}:function(l,u){var d=u(),c=r({inst:{value:d,getSnapshot:u}}),_=c[0].inst,p=c[1];return n(function(){_.value=d,_.getSnapshot=u,s(_)&&p({inst:_})},[l,d,u]),o(function(){return s(_)&&p({inst:_}),l(function(){s(_)&&p({inst:_})})},[l]),i(d),d};return Ve.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:a,Ve}()),qt.exports}var On=(Vt||(Vt=1,Tt.exports=function(){if(Pt)return Pe;Pt=1;var e=Fr,t=Un(),r=typeof Object.is=="function"?Object.is:function(l,u){return l===u&&(l!==0||1/l==1/u)||l!=l&&u!=u},o=t.useSyncExternalStore,n=e.useRef,i=e.useEffect,s=e.useMemo,a=e.useDebugValue;return Pe.useSyncExternalStoreWithSelector=function(l,u,d,c,_){var p=n(null);if(p.current===null){var y={hasValue:!1,value:null};p.current=y}else y=p.current;p=s(function(){function h(g){if(!k){if(k=!0,x=g,g=c(g),_!==void 0&&y.hasValue){var v=y.value;if(_(v,g))return f=v}return f=g}if(v=f,r(x,g))return v;var b=c(g);return _!==void 0&&_(v,b)?v:(x=g,f=b)}var x,f,k=!1,w=d===void 0?null:d;return[function(){return h(u())},w===null?void 0:function(){return h(w())}]},[u,d,c,_]);var m=o(l,p[0],p[1]);return i(function(){y.hasValue=!0,y.value=m},[m]),a(m),m},Pe}()),Tt.exports);const Pn=Nn(On),{useSyncExternalStoreWithSelector:Vn}=Pn,Mt=e=>{const t=typeof e=="function"?(o=>o?Nt(o):Nt)(e):e,r=(o,n)=>function(i,s=i.getState,a){const l=Vn(i.subscribe,i.getState,i.getServerState||i.getState,s,a);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,s)=>(n[String(s.id)]&&i.push(s.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(s=>t[String(s.id)]===!0).map(s=>{var a;return s.label+((a=n==null?void 0:n[String(s.id)])!=null&&a.userText?`: ${n[String(s.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,s=n[0];if(s){const a=e.props.options.find(l=>String(l.id)===s);return(a==null?void 0:a.label)+((r=i==null?void 0:i[s])!=null&&r.userText?`: ${(o=i==null?void 0:i[s])==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,s=[];for(const[a,l]of Object.entries(t)){const u=n.find(y=>String(y.id)===a),d=(u==null?void 0:u.label)??a,c=Bt(l)?String(l):JSON.stringify(l),_=i.find(y=>y.value===c),p=(_==null?void 0:_.label)??c;s.push(`${d}: ${p}`)}return s.join("; ")}if(e.type==="rankorder"&&Me(e)){const n=e.props.options.reduce((s,a)=>(s[String(a.id)]=a.label,s),{}),i=[];for(const[s,a]of Object.entries(t)){const l=n[s];l&&(i[a-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 s=Qt(i,"answer-id"),a=Qt(i,"fallback-text")??"";if(!s)return a;const l=s.startsWith("attr-")?s:Number(s);if(Object.hasOwn(t,l)){const u=t[l];return String(u)}return a});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)},_e={eq:(e,t)=>e==t,neq:(e,t)=>!_e.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)=>!_e.contains(e,t)},Dn=e=>e in _e,$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(s=>[s.value]):(t=e.props.options.map(s=>s.value),r=!e.props.properties.required,t.reduce((s,a)=>s.concat(s.map(l=>[...l,a])),[[]]).filter(s=>r||s.length>0)):null;case"multiplechoice":{if(!e||!e.props||!e.props.options)return null;const s=e.props.options.map(a=>a.value);return e.props.properties.required||s.push(void 0),s}case"matrix":{if(!((o=e==null?void 0:e.props)!=null&&o.options))return null;const s=e.props.properties.matrixColumn,a=e.props.options,l=a.reduce((d,c)=>(d[c.id]=null,d),{}),u=[{...l,[a[0].id]:s[0].value},a.reduce((d,c)=>(d[c.id]=s[0].value,d),{})];return e.props.properties.required||u.push(l),u}case"likert":{const s=Number((i=(n=e.props)==null?void 0:n.properties)==null?void 0:i.range)||5;return[...Array.from(new Array(s).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 s=[{taskStatus:"completed"},{taskStatus:"given.up"}];return e.props.properties.required||s.push({taskStatus:"abandoned"}),s}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 s=Qr(n,e).map(a=>{const{comparator:l,value:u}=a;return{comparator:l,target:i,value:u}});return[...r,...s]},[]),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 c,_,p;if(t>=e.length||t<0)return null;const s=e[t];let a=t+1;const l=s.props.routingOptions||[];for(const y of l){if(!Gr(y))continue;const{group:m,target:h}=y;if(Yr({group:m,allResponses:o,cards:e,surveyVisitorAttributes:i})){a=h===-1&&r?e.length-1:h;break}}const u=e.findIndex(y=>y.type==="uploading"),d=Wr(e,r,u);for(;a!==null&&a!==-1&&a<=d&&((_=(c=e[a])==null?void 0:c.props)!=null&&_.displayLogic)&&e[a].props.displayLogic.length>0;){const y=e[a].props.displayLogic||[];if(ct({displayLogic:y,allResponses:o,cards:e,surveyVisitorAttributes:i}))break;a++}if(a!==-1&&((p=e==null?void 0:e[a])!=null&&p.parentId)){const y=e.findIndex(m=>{var h;return m.name===((h=e==null?void 0:e[a])==null?void 0:h.parentId)});if(y>-1){const m=e[y],h=o[y],x=ge({comparator:"answered",type:m.type,response:h}),f=m.type==="matrix"&&ge({comparator:"partial",type:m.type,response:h});x||f||a++}}return t>=d||a===-1||a!==null&&a>d?u>0&&Object.values(n).some(m=>m.isSubmitted&&!m.isComplete)?u:r?e.length-1:null:a===-1?null:a},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:s,surveyVisitorAttributes:a})=>{if(n.questionIndex===void 0||typeof n.questionIndex=="number"&&n.questionIndex>=i.length)return!1;const l=(({rule:u,allResponses:d,cards:c,surveyVisitorAttributes:_})=>{if(u.questionIndex===void 0)return null;if(typeof(p=u.questionIndex)=="string"&&p.startsWith("attr-")){const m=(h=>h.slice(5))(u.questionIndex);return m in _?{response:_[m],type:"AttributeCheck"}:null}var p;const y=u.questionIndex;return{response:d[y],type:c[y].type}})({rule:n,allResponses:i,cards:s,surveyVisitorAttributes:a});return l!==null&&!!ge({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 s=e[i];if(!Kr(s)||(i+=1,i>=e.length))return!1;const a=Wt({segment:e[i],allResponses:t,cards:r,surveyVisitorAttributes:o});i+=1,n=s===$r?n&&a:n||a}return n},ct=({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}),ge=({comparator:e,response:t,type:r,value:o})=>{if(r==="AttributeCheck")return((i,s,a)=>{const l=Ee(s),u=Ee(a),d=Number(s),c=Number(a),_=!Number.isNaN(d)&&l===String(d),p=!Number.isNaN(c)&&u===String(c),y=_&&p;switch(i){case"eq":return y?d===c:l.toLowerCase()===u.toLowerCase();case"neq":return y?d!==c:l.toLowerCase()!==u.toLowerCase();case"contains":case"notcontains":return oe[i](l,u);case"gt":case"gte":case"lt":case"lte":return y?oe[i](d,c):oe[i](l.localeCompare(u),0);case"list_exact":case"list_all":case"list_alo":case"list_dni":{const m=Array.isArray(s)?s:[s],h=Array.isArray(a)?a:[a];return oe[i](m,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 s=i.some(l=>l.selected==="left"),a=i.some(l=>l.selected==="right");return s&&a});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 s=i.some(l=>l.selected==="left"),a=i.some(l=>l.selected==="right");return!(s&&a)});case"rankorder":return n===null||Ft(n)&&Object.values(n).includes(null);default:return!1}return o!==void 0&&_e[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,s,a,l,u;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:(a=(s=(i=e==null?void 0:e.props)==null?void 0:i.properties)==null?void 0:s.matrixColumn)==null?void 0:a.map(d=>d.label),matrixRows:(u=(l=e==null?void 0:e.props)==null?void 0:l.options)==null?void 0:u.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 s=e.reduce((a,l)=>{if(l.name>0&&Gn.has(l.type)){if(r===l.name&&(i=n,o==="aidynamicstandalone"))return n++,a;if((l.type==="aidynamicfollowup"||l.type==="aidynamicstandalone")&&l.props.loading!==G.success)return a;const u="properties"in l.props&&l.props.properties&&"captionText"in l.props.properties?l.props.properties.captionText:void 0,d=(c=>c.type!=="uploading"&&c.type!=="thanks")(l)?{order:n++,question:l.props.message,questionDescription:u,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]};a.push(d)}return a},[]);return{targetQuestionOrder:i,questionsResponses:s}},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)=>({addResponseGroupMeta:void 0,allResponses:[],allResponsesRaw:{},answers:void 0,apiURL:"",avatars:{agentAvatar:{"1x":"","2x":""},respondentAvatar:{"1x":"","2x":""}},border:"#000000",cards:[],cardIndexByName:{},close:async(r=P.APP_ID)=>{const o=t(),{fadeout:n,remove:i,trackHistory:s,studyType:a}=o;await n(r),ze(o)||s({event:"closed"}),E.breadcrumbsLogger.info("SurveyClosing",{surveyId:o.surveyId}),P.ConflictingWidgets.enable(),i({initiator:E.DismissReason.Closed,studyType:a})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async r=>{const{eventEmitFn:o,fadeout:n,remove:i,studyType:s,surveyId:a}=t();o("survey.complete",a),await n(r),P.ConflictingWidgets.enable(),i({initiator:E.DismissReason.Complete,studyType:s})},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(s=>{const a=i.getElementById(r);a?(a.addEventListener("transitionend",()=>{s()}),a.classList.remove("ul-app--visible")):s()}))},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,y,m;const{cards:s,destroy:a,index:l,uploadProgress:u}=t(),d=o||((p=u[r])==null?void 0:p.isComplete),c={...u,[r]:{progressPct:d?100:n||((y=u[r])==null?void 0:y.progressPct),isComplete:d,isSubmitted:i||((m=u[r])==null?void 0:m.isSubmitted)}};if(e({uploadProgress:c}),s[l].type!=="uploading")return;const _=Object.entries(u).every(([h,x])=>!x.isSubmitted||x.isComplete||r==h&&o);if(_&&l>=s.length-1)return a(P.APP_ID);e({index:_?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:s,responseGroupUid:a,submit:l,trackHistory:u,uploadProgress:d,viewedCardCount:c}=t(),_=Array.isArray(r.data)?r.data:[r.data],p=Date.now(),y=[...n],m={response:[],responseGroupUid:a,questionIndex:s};let h=null;const x=o.slice(0);let f=s;_.forEach((g,v)=>{const b=Math.floor(g.questionId),A=y.findIndex(L=>L.name===b),R=A>=0?y[A]:y[s+v],N={value:g.value,questionId:b,answeredAt:p,...g.secondaryValue!==void 0&&{secondaryValue:g.secondaryValue},...g.questionText!==void 0&&{questionText:g.questionText}},T=N.value;(L=>L&&!De.has(L.type))(R)&&(R.value=T,R.secondaryValue=N.secondaryValue||null),m.response.push(N);const U=A>=0?A:s+v;x[U]=Je(R,T),U>f&&(f=U)}),h=Zr({cards:y,index:f,hasEndCard:!!r.endCard,uploadProgress:d,allResponses:x,surveyVisitorAttributes:t().surveyVisitorAttributes}),e({allResponses:x}),(h===null||De.has(y[h].type))&&(m.completedAt=p);const k=l(m);if(h===null)return void r.completeSurvey();h&&!De.has(y[h].type)&&k.finally(()=>{u({event:"seen",index:h})});const w=y[h];y[h]&&i&&i("survey.question",{qid:w.name,props:w.props}),e({cards:y,hasViewedEmbed:!1,index:h,viewedCardCount:c+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:s}=t();e({pendingRemoveIframeReason:r,studyType:o}),n(E.SprigEvent.SurveyCloseRequested,{name:E.SprigEvent.SurveyCloseRequested,initiator:r,studyType:o,"survey.id":s}),i()},removeIframeIfReady:()=>{const{eventEmitFn:r,pendingRemoveIframeReason:o,unresolvedRequestCount:n,studyType:i,surveyId:s}=t();o&&n===0&&(r(E.SprigEvent.SurveyWillClose,{name:E.SprigEvent.SurveyWillClose,initiator:o,studyType:i,"survey.id":s}),e({pendingRemoveIframeReason:null,studyType:i}))},seen:async()=>{const{trackHistory:r}=t();return r({event:"seen",isNew:!0})},createDynamicStandaloneQuestion:async({questionId:r})=>{var _,p,y;let o=!1;if(e(m=>{const h=m.cards.find(x=>(x==null?void 0:x.name)===r);return!(h!=null&&h.name)||Gt(h)?m:(o=!0,{cards:Fe(m.cards,r,Kt)})}),!o)return;const n=t(),{targetQuestionOrder:i,questionsResponses:s}=Zt({cards:n.cards,combinedReadableRawResponses:n.allResponsesRaw,targetQuestionId:r,generateQuestionType:"aidynamicstandalone"}),a={surveyId:n.surveyId,responseGroupUid:n.responseGroupUid,standaloneQuestionOrder:i,questionsResponses:s,standaloneQuestionId:r,customMetadata:n.customMetadata,meta:n.meta,previewKey:n.previewKey,isPreview:n.isPreview};let l=!1;const u=()=>{if(l)return;l=!0;const m=t(),h=m.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(m.studyType)&&(h!=null&&h.groupId)){const x=m.cards.reduce((w,g)=>((g==null?void 0:g.groupId)===h.groupId&&w.push(g),w),[]),f=x.findIndex(w=>w.name===h.name),k=f+1;if(k<x.length){const w=x[k].name;m.setFocusedQuestionId(w)}else{const w=x[f-1].name;m.setFocusedQuestionId(w)}}else m.next({data:{value:"",questionId:h.name,type:h.type},completeSurvey:()=>m.destroy(P.APP_ID),endCard:m.endCard})},d=new AbortController,c=setTimeout(()=>{d.abort(),u();const m=new Error("Timeout reached—question skipped");n.trackPromise(re(n,"aidynamicstandalone",m))},3e3);try{const{url:m,visitorIdHeader:h}=Jt(n),x=await n.trackPromise(E.sprigFetch(m,{body:JSON.stringify(a),headers:{...n.headers,"x-ul-visitor-id":h},method:"POST",signal:d.signal}));if(!x.ok||!((y=(p=(_=x==null?void 0:x.json)==null?void 0:_.props)==null?void 0:p.message)!=null&&y.length))return u(),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(c)}},createDynamicFollowupQuestion:async({parentQuestionId:r,parentResponseConfig:o})=>{var m,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(),s={...i.allResponsesRaw,...o||{}},{targetQuesti