@roqua/quby-frontend 0.9.6 → 0.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9095,7 +9095,7 @@ class zh {
9095
9095
  case "select":
9096
9096
  case "radio":
9097
9097
  case "scale":
9098
- this.questionnaire.getOptionNumberValue(e, this.values[e]);
9098
+ return this.questionnaire.getOptionNumberValue(e, this.values[e]);
9099
9099
  }
9100
9100
  return null;
9101
9101
  }
@@ -36,7 +36,7 @@ __p += '`),Wt&&(me+=`' +
36
36
  function print() { __p += __j.call(arguments, '') }
37
37
  `:`;
38
38
  `)+me+`return __p
39
- }`;var Ot=_g(function(){return Pt(O,Xe+"return "+me).apply(n,j)});if(Ot.source=me,Nf(Ot))throw Ot;return Ot}function IS(t){return an(t).toLowerCase()}function AS(t){return an(t).toUpperCase()}function OS(t,i,u){if(t=an(t),t&&(u||i===n))return xe(t);if(!t||!(i=yr(i)))return t;var m=Rr(t),E=Rr(i),O=Jt(m,E),j=Qn(m,E)+1;return di(m,O,j).join("")}function MS(t,i,u){if(t=an(t),t&&(u||i===n))return t.slice(0,Bl(t)+1);if(!t||!(i=yr(i)))return t;var m=Rr(t),E=Qn(m,Rr(i))+1;return di(m,0,E).join("")}function FS(t,i,u){if(t=an(t),t&&(u||i===n))return t.replace(rn,"");if(!t||!(i=yr(i)))return t;var m=Rr(t),E=Jt(m,Rr(i));return di(m,E).join("")}function PS(t,i){var u=Mt,m=ve;if(An(i)){var E="separator"in i?i.separator:E;u="length"in i?Tt(i.length):u,m="omission"in i?yr(i.omission):m}t=an(t);var O=t.length;if(xo(t)){var j=Rr(t);O=j.length}if(u>=O)return t;var $=u-_o(m);if($<1)return m;var J=j?di(j,0,$).join(""):t.slice(0,$);if(E===n)return J+m;if(j&&($+=J.length-$),jf(E)){if(t.slice($).search(E)){var ce,de=J;for(E.global||(E=ha(E.source,an(kt.exec(E))+"g")),E.lastIndex=0;ce=E.exec(de);)var me=ce.index;J=J.slice(0,me===n?$:me)}}else if(t.indexOf(yr(E),$)!=$){var De=J.lastIndexOf(E);De>-1&&(J=J.slice(0,De))}return J+m}function DS(t){return t=an(t),t&&hr.test(t)?t.replace(Mn,Ru):t}var LS=B(function(t,i,u){return t+(u?" ":"")+i.toUpperCase()}),Wf=M("toUpperCase");function Sg(t,i,u){return t=an(t),i=u?n:i,i===n?yc(t)?_c(t):bo(t):t.match(i)||[]}var _g=bt(function(t,i){try{return Cn(t,n,i)}catch(u){return Nf(u)?u:new ot(u)}}),BS=Cs(function(t,i){return Vn(i,function(u){u=Uo(u),$n(t,u,Lf(t[u],t))}),t});function NS(t){var i=t==null?0:t.length,u=st();return t=i?qt(t,function(m){if(typeof m[1]!="function")throw new vr(v);return[u(m[0]),m[1]]}):[],bt(function(m){for(var E=-1;++E<i;){var O=t[E];if(Cn(O[0],this,m))return Cn(O[1],this,m)}})}function jS(t){return Ql(lr(t,L))}function Vf(t){return function(){return t}}function zS(t,i){return t==null||t!==t?i:t}var US=c(),WS=c(!0);function Ri(t){return t}function Hf(t){return Lo(typeof t=="function"?t:lr(t,L))}function VS(t){return Qi(lr(t,L))}function HS(t,i){return ci(t,lr(i,L))}var $S=bt(function(t,i){return function(u){return Wr(u,t,i)}}),GS=bt(function(t,i){return function(u){return Wr(t,u,i)}});function $f(t,i,u){var m=xr(i),E=fl(i,m);u==null&&!(An(i)&&(E.length||!m.length))&&(u=i,i=t,t=this,E=fl(i,xr(i)));var O=!(An(u)&&"chain"in u)||!!u.chain,j=Rs(t);return Vn(E,function($){var J=i[$];t[$]=J,j&&(t.prototype[$]=function(){var ce=this.__chain__;if(O||ce){var de=t(this.__wrapped__),me=de.__actions__=Zn(this.__actions__);return me.push({func:J,args:arguments,thisArg:t}),de.__chain__=ce,de}return J.apply(t,Er([this.value()],arguments))})}),t}function ZS(){return En._===this&&(En._=dn),this}function Gf(){}function YS(t){return t=Tt(t),bt(function(i){return qa(i,t)})}var KS=D(qt),JS=D(vo),QS=D(fa);function kg(t){return Af(t)?h(Uo(t)):su(t)}function XS(t){return function(i){return t==null?n:Ja(t,i)}}var qS=fe(),e1=fe(!0);function Zf(){return[]}function Yf(){return!1}function t1(){return{}}function n1(){return""}function r1(){return!0}function i1(t,i){if(t=Tt(t),t<1||t>ze)return[];var u=ue,m=bn(t,ue);i=st(i),t-=ue;for(var E=Q(m,i);++u<t;)i(u);return E}function a1(t){return Et(t)?qt(t,Uo):ea(t)?[t]:Zn(Hh(an(t)))}function o1(t){var i=++Au;return an(t)+i}var s1=T(function(t,i){return t+i},0),l1=it("ceil"),u1=T(function(t,i){return t/i},1),c1=it("floor");function d1(t){return t&&t.length?dl(t,Ri,cs):n}function f1(t,i){return t&&t.length?dl(t,st(i,2),cs):n}function p1(t){return Xo(t,Ri)}function h1(t,i){return Xo(t,st(i,2))}function g1(t){return t&&t.length?dl(t,Ri,ui):n}function m1(t,i){return t&&t.length?dl(t,st(i,2),ui):n}var v1=T(function(t,i){return t*i},1),b1=it("round"),y1=T(function(t,i){return t-i},0);function w1(t){return t&&t.length?q(t,Ri):0}function x1(t,i){return t&&t.length?q(t,st(i,2)):0}return I.after=Vw,I.ary=tg,I.assign=Ax,I.assignIn=gg,I.assignInWith=Md,I.assignWith=Ox,I.at=Mx,I.before=ng,I.bind=Lf,I.bindAll=BS,I.bindKey=rg,I.castArray=tx,I.chain=Xh,I.chunk=c0,I.compact=d0,I.concat=f0,I.cond=NS,I.conforms=jS,I.constant=Vf,I.countBy=ww,I.create=Fx,I.curry=ig,I.curryRight=ag,I.debounce=og,I.defaults=Px,I.defaultsDeep=Dx,I.defer=Hw,I.delay=$w,I.difference=p0,I.differenceBy=h0,I.differenceWith=g0,I.drop=m0,I.dropRight=v0,I.dropRightWhile=b0,I.dropWhile=y0,I.fill=w0,I.filter=Sw,I.flatMap=Ew,I.flatMapDeep=Cw,I.flatMapDepth=Tw,I.flatten=Yh,I.flattenDeep=x0,I.flattenDepth=S0,I.flip=Gw,I.flow=US,I.flowRight=WS,I.fromPairs=_0,I.functions=Wx,I.functionsIn=Vx,I.groupBy=Rw,I.initial=E0,I.intersection=C0,I.intersectionBy=T0,I.intersectionWith=R0,I.invert=$x,I.invertBy=Gx,I.invokeMap=Aw,I.iteratee=Hf,I.keyBy=Ow,I.keys=xr,I.keysIn=Ti,I.map=Cd,I.mapKeys=Yx,I.mapValues=Kx,I.matches=VS,I.matchesProperty=HS,I.memoize=Rd,I.merge=Jx,I.mergeWith=mg,I.method=$S,I.methodOf=GS,I.mixin=$f,I.negate=Id,I.nthArg=YS,I.omit=Qx,I.omitBy=Xx,I.once=Zw,I.orderBy=Mw,I.over=KS,I.overArgs=Yw,I.overEvery=JS,I.overSome=QS,I.partial=Bf,I.partialRight=sg,I.partition=Fw,I.pick=qx,I.pickBy=vg,I.property=kg,I.propertyOf=XS,I.pull=M0,I.pullAll=Jh,I.pullAllBy=F0,I.pullAllWith=P0,I.pullAt=D0,I.range=qS,I.rangeRight=e1,I.rearg=Kw,I.reject=Lw,I.remove=L0,I.rest=Jw,I.reverse=Pf,I.sampleSize=Nw,I.set=tS,I.setWith=nS,I.shuffle=jw,I.slice=B0,I.sortBy=Ww,I.sortedUniq=H0,I.sortedUniqBy=$0,I.split=ES,I.spread=Qw,I.tail=G0,I.take=Z0,I.takeRight=Y0,I.takeRightWhile=K0,I.takeWhile=J0,I.tap=dw,I.throttle=Xw,I.thru=Ed,I.toArray=fg,I.toPairs=bg,I.toPairsIn=yg,I.toPath=a1,I.toPlainObject=hg,I.transform=rS,I.unary=qw,I.union=Q0,I.unionBy=X0,I.unionWith=q0,I.uniq=ew,I.uniqBy=tw,I.uniqWith=nw,I.unset=iS,I.unzip=Df,I.unzipWith=Qh,I.update=aS,I.updateWith=oS,I.values=Qu,I.valuesIn=sS,I.without=rw,I.words=Sg,I.wrap=ex,I.xor=iw,I.xorBy=aw,I.xorWith=ow,I.zip=sw,I.zipObject=lw,I.zipObjectDeep=uw,I.zipWith=cw,I.entries=bg,I.entriesIn=yg,I.extend=gg,I.extendWith=Md,$f(I,I),I.add=s1,I.attempt=_g,I.camelCase=dS,I.capitalize=wg,I.ceil=l1,I.clamp=lS,I.clone=nx,I.cloneDeep=ix,I.cloneDeepWith=ax,I.cloneWith=rx,I.conformsTo=ox,I.deburr=xg,I.defaultTo=zS,I.divide=u1,I.endsWith=fS,I.eq=no,I.escape=pS,I.escapeRegExp=hS,I.every=xw,I.find=_w,I.findIndex=Gh,I.findKey=Lx,I.findLast=kw,I.findLastIndex=Zh,I.findLastKey=Bx,I.floor=c1,I.forEach=qh,I.forEachRight=eg,I.forIn=Nx,I.forInRight=jx,I.forOwn=zx,I.forOwnRight=Ux,I.get=zf,I.gt=sx,I.gte=lx,I.has=Hx,I.hasIn=Uf,I.head=Kh,I.identity=Ri,I.includes=Iw,I.indexOf=k0,I.inRange=uS,I.invoke=Zx,I.isArguments=yu,I.isArray=Et,I.isArrayBuffer=ux,I.isArrayLike=Ci,I.isArrayLikeObject=Yn,I.isBoolean=cx,I.isBuffer=kl,I.isDate=dx,I.isElement=fx,I.isEmpty=px,I.isEqual=hx,I.isEqualWith=gx,I.isError=Nf,I.isFinite=mx,I.isFunction=Rs,I.isInteger=lg,I.isLength=Ad,I.isMap=ug,I.isMatch=vx,I.isMatchWith=bx,I.isNaN=yx,I.isNative=wx,I.isNil=Sx,I.isNull=xx,I.isNumber=cg,I.isObject=An,I.isObjectLike=Bn,I.isPlainObject=Lc,I.isRegExp=jf,I.isSafeInteger=_x,I.isSet=dg,I.isString=Od,I.isSymbol=ea,I.isTypedArray=Ju,I.isUndefined=kx,I.isWeakMap=Ex,I.isWeakSet=Cx,I.join=I0,I.kebabCase=gS,I.last=Ea,I.lastIndexOf=A0,I.lowerCase=mS,I.lowerFirst=vS,I.lt=Tx,I.lte=Rx,I.max=d1,I.maxBy=f1,I.mean=p1,I.meanBy=h1,I.min=g1,I.minBy=m1,I.stubArray=Zf,I.stubFalse=Yf,I.stubObject=t1,I.stubString=n1,I.stubTrue=r1,I.multiply=v1,I.nth=O0,I.noConflict=ZS,I.noop=Gf,I.now=Td,I.pad=bS,I.padEnd=yS,I.padStart=wS,I.parseInt=xS,I.random=cS,I.reduce=Pw,I.reduceRight=Dw,I.repeat=SS,I.replace=_S,I.result=eS,I.round=b1,I.runInContext=Y,I.sample=Bw,I.size=zw,I.snakeCase=kS,I.some=Uw,I.sortedIndex=N0,I.sortedIndexBy=j0,I.sortedIndexOf=z0,I.sortedLastIndex=U0,I.sortedLastIndexBy=W0,I.sortedLastIndexOf=V0,I.startCase=CS,I.startsWith=TS,I.subtract=y1,I.sum=w1,I.sumBy=x1,I.template=RS,I.times=i1,I.toFinite=Is,I.toInteger=Tt,I.toLength=pg,I.toLower=IS,I.toNumber=Ca,I.toSafeInteger=Ix,I.toString=an,I.toUpper=AS,I.trim=OS,I.trimEnd=MS,I.trimStart=FS,I.truncate=PS,I.unescape=DS,I.uniqueId=o1,I.upperCase=LS,I.upperFirst=Wf,I.each=qh,I.eachRight=eg,I.first=Kh,$f(I,function(){var t={};return _i(I,function(i,u){Ht.call(I.prototype,u)||(t[u]=i)}),t}(),{chain:!1}),I.VERSION=a,Vn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){I[t].placeholder=I}),Vn(["drop","take"],function(t,i){St.prototype[t]=function(u){u=u===n?1:vn(Tt(u),0);var m=this.__filtered__&&!i?new St(this):this.clone();return m.__filtered__?m.__takeCount__=bn(u,m.__takeCount__):m.__views__.push({size:bn(u,ue),type:t+(m.__dir__<0?"Right":"")}),m},St.prototype[t+"Right"]=function(u){return this.reverse()[t](u).reverse()}}),Vn(["filter","map","takeWhile"],function(t,i){var u=i+1,m=u==Be||u==He;St.prototype[t]=function(E){var O=this.clone();return O.__iteratees__.push({iteratee:st(E,3),type:u}),O.__filtered__=O.__filtered__||m,O}}),Vn(["head","last"],function(t,i){var u="take"+(i?"Right":"");St.prototype[t]=function(){return this[u](1).value()[0]}}),Vn(["initial","tail"],function(t,i){var u="drop"+(i?"":"Right");St.prototype[t]=function(){return this.__filtered__?new St(this):this[u](1)}}),St.prototype.compact=function(){return this.filter(Ri)},St.prototype.find=function(t){return this.filter(t).head()},St.prototype.findLast=function(t){return this.reverse().find(t)},St.prototype.invokeMap=bt(function(t,i){return typeof t=="function"?new St(this):this.map(function(u){return Wr(u,t,i)})}),St.prototype.reject=function(t){return this.filter(Id(st(t)))},St.prototype.slice=function(t,i){t=Tt(t);var u=this;return u.__filtered__&&(t>0||i<0)?new St(u):(t<0?u=u.takeRight(-t):t&&(u=u.drop(t)),i!==n&&(i=Tt(i),u=i<0?u.dropRight(-i):u.take(i-t)),u)},St.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},St.prototype.toArray=function(){return this.take(ue)},_i(St.prototype,function(t,i){var u=/^(?:filter|find|map|reject)|While$/.test(i),m=/^(?:head|last)$/.test(i),E=I[m?"take"+(i=="last"?"Right":""):i],O=m||/^find/.test(i);E&&(I.prototype[i]=function(){var j=this.__wrapped__,$=m?[1]:arguments,J=j instanceof St,ce=$[0],de=J||Et(j),me=function(Nt){var Wt=E.apply(I,Er([Nt],$));return m&&De?Wt[0]:Wt};de&&u&&typeof ce=="function"&&ce.length!=1&&(J=de=!1);var De=this.__chain__,Xe=!!this.__actions__.length,lt=O&&!De,Ot=J&&!Xe;if(!O&&de){j=Ot?j:new St(this);var ut=t.apply(j,$);return ut.__actions__.push({func:Ed,args:[me],thisArg:n}),new sr(ut,De)}return lt&&Ot?t.apply(this,$):(ut=this.thru(me),lt?m?ut.value()[0]:ut.value():ut)})}),Vn(["pop","push","shift","sort","splice","unshift"],function(t){var i=za[t],u=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",m=/^(?:pop|shift)$/.test(t);I.prototype[t]=function(){var E=arguments;if(m&&!this.__chain__){var O=this.value();return i.apply(Et(O)?O:[],E)}return this[u](function(j){return i.apply(Et(j)?j:[],E)})}}),_i(St.prototype,function(t,i){var u=I[i];if(u){var m=u.name+"";Ht.call(ya,m)||(ya[m]=[]),ya[m].push({name:i,func:u})}}),ya[g(n,G).name]=[{name:"wrapper",func:n}],St.prototype.clone=nl,St.prototype.reverse=Oo,St.prototype.value=ls,I.prototype.at=fw,I.prototype.chain=pw,I.prototype.commit=hw,I.prototype.next=gw,I.prototype.plant=vw,I.prototype.reverse=bw,I.prototype.toJSON=I.prototype.valueOf=I.prototype.value=yw,I.prototype.first=I.prototype.head,Hi&&(I.prototype[Hi]=mw),I},Dn=Iu();Ui?((Ui.exports=Dn)._=Dn,ho._=Dn):En._=Dn}).call(qn)}(td,td.exports);var Ho=td.exports;const $o=Symbol.for("@ts-pattern/matcher"),dv=Symbol.for("@ts-pattern/isVariadic"),nd="@ts-pattern/anonymous-select-key",Wd=r=>!!(r&&typeof r=="object"),rd=r=>r&&!!r[$o],so=(r,e,n)=>{if(rd(r)){const a=r[$o](),{matched:o,selections:d}=a.match(e);return o&&d&&Object.keys(d).forEach(v=>n(v,d[v])),o}if(Wd(r)){if(!Wd(e))return!1;if(Array.isArray(r)){if(!Array.isArray(e))return!1;let a=[],o=[],d=[];for(const v of r.keys()){const _=r[v];rd(_)&&_[dv]?d.push(_):d.length?o.push(_):a.push(_)}if(d.length){if(d.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(e.length<a.length+o.length)return!1;const v=e.slice(0,a.length),_=o.length===0?[]:e.slice(-o.length),w=e.slice(a.length,o.length===0?1/0:-o.length);return a.every((C,N)=>so(C,v[N],n))&&o.every((C,N)=>so(C,_[N],n))&&(d.length===0||so(d[0],w,n))}return r.length===e.length&&r.every((v,_)=>so(v,e[_],n))}return Reflect.ownKeys(r).every(a=>{const o=r[a];return(a in e||rd(d=o)&&d[$o]().matcherType==="optional")&&so(o,e[a],n);var d})}return Object.is(e,r)},Ls=r=>{var e,n,a;return Wd(r)?rd(r)?(e=(n=(a=r[$o]()).getSelectionKeys)==null?void 0:n.call(a))!=null?e:[]:Array.isArray(r)?hc(r,Ls):hc(Object.values(r),Ls):[]},hc=(r,e)=>r.reduce((n,a)=>n.concat(e(a)),[]);function ra(r){return Object.assign(r,{optional:()=>fv(r),and:e=>xn(r,e),or:e=>pv(r,e),select:e=>e===void 0?kp(r):kp(e,r)})}function fv(r){return ra({[$o]:()=>({match:e=>{let n={};const a=(o,d)=>{n[o]=d};return e===void 0?(Ls(r).forEach(o=>a(o,void 0)),{matched:!0,selections:n}):{matched:so(r,e,a),selections:n}},getSelectionKeys:()=>Ls(r),matcherType:"optional"})})}function xn(...r){return ra({[$o]:()=>({match:e=>{let n={};const a=(o,d)=>{n[o]=d};return{matched:r.every(o=>so(o,e,a)),selections:n}},getSelectionKeys:()=>hc(r,Ls),matcherType:"and"})})}function pv(...r){return ra({[$o]:()=>({match:e=>{let n={};const a=(o,d)=>{n[o]=d};return hc(r,Ls).forEach(o=>a(o,void 0)),{matched:r.some(o=>so(o,e,a)),selections:n}},getSelectionKeys:()=>hc(r,Ls),matcherType:"or"})})}function Qt(r){return{[$o]:()=>({match:e=>({matched:!!r(e)})})}}function kp(...r){const e=typeof r[0]=="string"?r[0]:void 0,n=r.length===2?r[1]:typeof r[0]=="string"?void 0:r[0];return ra({[$o]:()=>({match:a=>{let o={[e??nd]:a};return{matched:n===void 0||so(n,a,(d,v)=>{o[d]=v}),selections:o}},getSelectionKeys:()=>[e??nd].concat(n===void 0?[]:Ls(n))})})}function lo(r){return typeof r=="number"}function Bs(r){return typeof r=="string"}function Ns(r){return typeof r=="bigint"}ra(Qt(function(r){return!0}));const js=r=>Object.assign(ra(r),{startsWith:e=>{return js(xn(r,(n=e,Qt(a=>Bs(a)&&a.startsWith(n)))));var n},endsWith:e=>{return js(xn(r,(n=e,Qt(a=>Bs(a)&&a.endsWith(n)))));var n},minLength:e=>js(xn(r,(n=>Qt(a=>Bs(a)&&a.length>=n))(e))),length:e=>js(xn(r,(n=>Qt(a=>Bs(a)&&a.length===n))(e))),maxLength:e=>js(xn(r,(n=>Qt(a=>Bs(a)&&a.length<=n))(e))),includes:e=>{return js(xn(r,(n=e,Qt(a=>Bs(a)&&a.includes(n)))));var n},regex:e=>{return js(xn(r,(n=e,Qt(a=>Bs(a)&&!!a.match(n)))));var n}});js(Qt(Bs));const uo=r=>Object.assign(ra(r),{between:(e,n)=>uo(xn(r,((a,o)=>Qt(d=>lo(d)&&a<=d&&o>=d))(e,n))),lt:e=>uo(xn(r,(n=>Qt(a=>lo(a)&&a<n))(e))),gt:e=>uo(xn(r,(n=>Qt(a=>lo(a)&&a>n))(e))),lte:e=>uo(xn(r,(n=>Qt(a=>lo(a)&&a<=n))(e))),gte:e=>uo(xn(r,(n=>Qt(a=>lo(a)&&a>=n))(e))),int:()=>uo(xn(r,Qt(e=>lo(e)&&Number.isInteger(e)))),finite:()=>uo(xn(r,Qt(e=>lo(e)&&Number.isFinite(e)))),positive:()=>uo(xn(r,Qt(e=>lo(e)&&e>0))),negative:()=>uo(xn(r,Qt(e=>lo(e)&&e<0)))});uo(Qt(lo));const zs=r=>Object.assign(ra(r),{between:(e,n)=>zs(xn(r,((a,o)=>Qt(d=>Ns(d)&&a<=d&&o>=d))(e,n))),lt:e=>zs(xn(r,(n=>Qt(a=>Ns(a)&&a<n))(e))),gt:e=>zs(xn(r,(n=>Qt(a=>Ns(a)&&a>n))(e))),lte:e=>zs(xn(r,(n=>Qt(a=>Ns(a)&&a<=n))(e))),gte:e=>zs(xn(r,(n=>Qt(a=>Ns(a)&&a>=n))(e))),positive:()=>zs(xn(r,Qt(e=>Ns(e)&&e>0))),negative:()=>zs(xn(r,Qt(e=>Ns(e)&&e<0)))});zs(Qt(Ns)),ra(Qt(function(r){return typeof r=="boolean"})),ra(Qt(function(r){return typeof r=="symbol"})),ra(Qt(function(r){return r==null})),ra(Qt(function(r){return r!=null}));class hv extends Error{constructor(e){let n;try{n=JSON.stringify(e)}catch{n=e}super(`Pattern matching error: no pattern matches value ${n}`),this.input=void 0,this.input=e}}const Vd={matched:!1,value:void 0};function gv(r){return new id(r,Vd)}class id{constructor(e,n){this.input=void 0,this.state=void 0,this.input=e,this.state=n}with(...e){if(this.state.matched)return this;const n=e[e.length-1],a=[e[0]];let o;e.length===3&&typeof e[1]=="function"?o=e[1]:e.length>2&&a.push(...e.slice(1,e.length-1));let d=!1,v={};const _=(C,N)=>{d=!0,v[C]=N},w=!a.some(C=>so(C,this.input,_))||o&&!o(this.input)?Vd:{matched:!0,value:n(d?nd in v?v[nd]:v:this.input,this.input)};return new id(this.input,w)}when(e,n){if(this.state.matched)return this;const a=!!e(this.input);return new id(this.input,a?{matched:!0,value:n(this.input,this.input)}:Vd)}otherwise(e){return this.state.matched?this.state.value:e(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new hv(this.input)}run(){return this.exhaustive()}returnType(){return this}}const Sf=class{constructor(e,n){Vt(this,"sexpVariables");Vt(this,"questionKeyToCalculationKeys");Vt(this,"response");Vt(this,"results",{});this.sexpVariables=e,this.questionKeyToCalculationKeys=mv(e),this.response=n,Object.keys(e).forEach(a=>{this.results[a]=this.calculate(this.sexpVariables[a].calculation)})}handleValueChanged(e){var n;(n=this.questionKeyToCalculationKeys[e])==null||n.forEach(a=>{this.results[a]=this.calculate(this.sexpVariables[a].calculation)})}calculate(e){return e.op==="string_value"?this.stringValue(e.key):this.calculateNumber(e)}calculateNumber(e){return gv(e).with({op:"number"},({value:n})=>n).with({op:"number_value"},({key:n})=>this.response.numberValue(n)).with({op:"sum"},({values:n})=>this.reduce(n,"sum")).with({op:"subtract"},({values:n})=>this.reduce(n,"subtract")).with({op:"multiply"},({values:n})=>this.reduce(n,"multiply")).with({op:"divide"},({values:n})=>this.reduce(n,"divide")).with({op:"round"},({value:n,digits:a})=>this.round(n,a)).exhaustive()}stringValue(e){const n=this.response.values[e];return(n==null?void 0:n.toString())??null}reduce(e,n){const a=e.map(o=>this.calculateNumber(o));return a.some(o=>o===null)?null:a.reduce(Sf.numberReducers[n])}round(e,n){const a=this.calculateNumber(e);return a===null?null:Number(a.toFixed(n))}};let ad=Sf;Vt(ad,"numberReducers",{sum:(e,n)=>e+n,multiply:(e,n)=>e*n,subtract:(e,n)=>e-n,divide:(e,n)=>e/n});function mv(r){const e={};for(const[n,a]of Object.entries(r))Hd(a.calculation).forEach(d=>{e[d]??(e[d]=new Set),e[d].add(n)});return e}function Hd(r){switch(r.op){case"number_value":case"string_value":return[r.key];case"sum":case"multiply":case"divide":case"subtract":return r.values.flatMap(e=>Hd(e));case"round":return Hd(r.value);case"number":return[]}}function vv(r,e,n){if(arguments.length<3)throw new TypeError("3 argument required, but only "+arguments.length+" present");var a=new Date(r,e,n);return a.getFullYear()===r&&a.getMonth()===e&&a.getDate()===n}const Ep=["requires_answer","minimum_checked_required","answer_group_minimum"];function Cp(r){switch(r.type){case"requires_answer":return new Tp(r);case"valid_integer":return new Ap(r);case"valid_float":return new Op(r);case"valid_date":return new Ip(r);case"minimum":return new Mp(r);case"maximum":return new Fp(r);case"minimum_date":return new Pp(r);case"maximum_date":return new Dp(r);case"minimum_checked_required":return new Lp(r);case"maximum_checked_allowed":return new Bp(r);case"answer_group_minimum":return new Np(r);case"answer_group_maximum":return new jp(r);case"regexp":return new zp(r)}}class hi{constructor(e){Vt(this,"config");this.config=e}}class Tp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);od(n.value)||n.addError({type:this.config.type,message:{t:"requires_answer"}})}}function od(r){if(r==null)return!1;if(typeof r=="string")return!!r;if(typeof r=="number")return!0;if(r instanceof Map)return ld(r);if("size"in r)return r.size>0;if("length"in r)return r.length>0;throw"Unexpected value type in validation"}function sd(r){return r===void 0||r===null||r===""?!1:typeof r=="string"}function Rp(r){return r===void 0||r===null?!1:typeof r=="number"}function ld(r){if(r===void 0||r===null)return!1;for(const[e,n]of r){if(typeof e!="string"||typeof n!="string")return!1;if(sd(n))return!0}return!1}const bv=/(\s*-?[1-9][0-9]+\s*|\s*-?[0-9]\s*)/;class Ip extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);if(!ld(n.value))return;if(this.config.requiredParts.some(o=>!n.value.get(o))){n.addError({type:this.config.type,message:{t:`valid_date.${this.config.subtype}`}});return}const a=$d(n.value);(!a||!vv(a.year,a.month,a.day)||a.year<1900||a.year>2100||a.hour>23||a.minute>59)&&n.addError({type:this.config.type,message:{t:`valid_date.${this.config.subtype}`}})}}function $d(r){var e=function(n,a){const o=r.get(n);return o===void 0||o==""?a:parseInt(o,10)};return[...r.values()].some(n=>n&&!/^\d*$/.test(n))?null:{year:e("year",2e3),month:e("month",1)-1,day:e("day",1),hour:e("hour",0),minute:e("minute",0)}}class Ap extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);if(!sd(n.value))return;const a=bv.exec(n.value);(a===null||a[0]!==n.value)&&n.addError({type:this.config.type,message:{t:"valid_integer"}})}}class Op extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);if(!sd(n.value))return;const a=parseFloat(n.value);!isNaN(a)&&isFinite(a)||n.addError({type:this.config.type,message:{t:"valid_float"}})}}class Mp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);Rp(n.value)&&parseFloat(n.value)<this.config.value&&n.addError({type:this.config.type,message:{t:"minimum",value:this.config.value.toString()}})}}class Fp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);Rp(n.value)&&parseFloat(n.value)>this.config.value&&n.addError({type:this.config.type,message:{t:"maximum",value:this.config.value.toString()}})}}class Pp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);if(!ld(n.value))return;const a=$d(n.value);a&&new Date(a.year,a.month,a.hour)<new Date(this.config.value)&&n.addError({type:this.config.type,message:{t:"minimum_date",friendly_date:this.config.value}})}}class Dp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);if(!ld(n.value))return;const a=$d(n.value);a&&new Date(a.year,a.month,a.hour)>new Date(this.config.value)&&n.addError({type:this.config.type,message:{t:"maximum_date",friendly_date:this.config.value}})}}class Lp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);(!n.value||n.value.size<this.config.minimumCheckedValue)&&n.addError({type:this.config.type,message:{t:"minimum_checked_required",count:this.config.minimumCheckedValue}})}}class Bp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);od(n.value)&&n.value.size>this.config.maximumCheckedValue&&n.addError({type:this.config.type,message:{t:"maximum_checked_allowed",count:this.config.maximumCheckedValue}})}}class Np extends hi{validate(e){const n=this.config.fieldKeys.map(a=>e.getValidationFieldState(a));n.filter(a=>od(a.value)).length>=this.config.value||n.forEach(a=>{a.addError({type:this.config.type,message:{t:"answer_group_minimum",value:this.config.value}})})}}class jp extends hi{validate(e){const n=this.config.fieldKeys.map(a=>e.getValidationFieldState(a));n.filter(a=>od(a.value)).length<=this.config.value||n.forEach(a=>{a.addError({type:this.config.type,message:{t:"answer_group_maximum",value:this.config.value}})})}}class zp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);if(!sd(n.value))return;const a=this.config.matcher.replace("\\A","^").replace("\\Z","$"),d=new RegExp(a).exec(n.value);(d===null||d[0]!==n.value)&&n.addError({type:this.config.type,message:this.config.explanation||{t:"regexp",matcher:this.config.matcher}})}}const Up=er.coerce.number(),Wp=er.coerce.string(),Vp=er.preprocess(r=>r instanceof Array?new Set(r):r,er.set(er.string())),Hp=er.preprocess(r=>!(r instanceof Map)&&r instanceof Object?new Map(Object.entries(r)):r,er.map(Sp,er.string())),$p=er.record(er.boolean()),Gp=er.preprocess(r=>!(r instanceof Map)&&r instanceof Object?new Map(Object.entries(r)):r,er.map(er.string(),er.string()));class Gd{constructor(e,n){Vt(this,"questionnaire");Vt(this,"values");Vt(this,"originalValues");Vt(this,"beenActives");Vt(this,"errors");Vt(this,"visibility");Vt(this,"changeHandlers");Vt(this,"flags");Vt(this,"textvars");Vt(this,"activeQuestionKey");Vt(this,"calculations");this.questionnaire=e,this.values=n.value,this.originalValues={...n.value},this.beenActives=new Set,this.errors=new Map,this.visibility=new Map,this.changeHandlers=[],this.flags=n.flags,this.textvars=this.initTextvars(n.textvars),this.activeQuestionKey=null,this.validate(),this.calculateVisibility(),this.calculations=new ad(e.sexpVariables,this)}cleanValues(){const e=Object.keys(this.values).filter(n=>this.values[n]&&this.isVisible(n)&&!this.isDisabled(n));return Ho.pick(this.values,e)}onChange(e){this.changeHandlers.push(e)}offChange(e){Ho.pull(this.changeHandlers,e)}getFieldState(e){return{key:e,value:this.values[e],beenActive:this.beenActives.has(e),valid:(this.errors.get(e)||[]).length===0,errors:this.errors.get(e)||[],hidden:!this.isVisible(e),disabled:this.isDisabled(e),isActiveQuestion:this.activeQuestionKey===e,setAsActiveQuestion:()=>this.setActiveQuestion(e),setValue:n=>this.setValue(e,n)}}getValidationFieldState(e){return{value:this.values[e],addError:n=>this.addError(e,n)}}setTextvar(e,n){n?this.textvars.set(e,n):this.textvars.set(e,this.questionnaire.textvars.find(a=>a.key===e).default)}initTextvars(e){const n=new Map;for(const a of this.questionnaire.textvars)n.set(a.key,e.get(a.key)??a.default);for(const a of Object.values(this.questionnaire.questions)){const o=this.values[a.key];typeof o=="string"&&"setsTextvar"in a&&a.setsTextvar&&n.set(a.setsTextvar,o)}return n}setValue(e,n){const a=this.questionnaire.getField(e);this.values[e]=n,(n===null||typeof n=="string")&&"setsTextvar"in a&&a.setsTextvar&&this.setTextvar(a.setsTextvar,n),this.validate(),this.calculateVisibility(),this.calculations.handleValueChanged(e),this.changeHandlers.forEach(o=>o(this,"valueChanged"))}setActiveQuestion(e){this.activeQuestionKey!==e&&(this.activeQuestionKey&&this.touchField(this.activeQuestionKey),this.activeQuestionKey=e,this.changeHandlers.forEach(n=>n(this)))}addError(e,n){const a=this.errors.get(e)||[];a.push(n),this.errors.set(e,a)}valueHasChanged(){for(const e in this.questionnaire.questions){const n=Zp(this.values[e]),a=Zp(this.originalValues[e]);if(!Ho.isEqual(n,a))return!0}return!1}touchAllFields(){Object.values(this.questionnaire.questions).forEach(e=>{this.touchField(e.key)})}touchPanelFields(e){e.items.forEach(n=>{n.type==="question"&&this.touchField(n.key)})}touchField(e){if(this.beenActives.has(e))return;this.questionnaire.getQuestionsInSameGroup(e).forEach(a=>{this.beenActives.add(a.key),this.values[a.key]===void 0&&this.setValue(a.key,null)})}firstNotValidQuestionInPanel(e){const n=e.items.find(a=>{if(a.type!=="question"||!this.isVisible(a.key))return!1;if((this.errors.get(a.key)||[]).length>0)return!0});return(n==null?void 0:n.key)||null}firstNotValidQuestion(){const e=this.questionnaire.panels.find(n=>this.firstNotValidQuestionInPanel(n));return e==null?null:this.firstNotValidQuestionInPanel(e)}validate(){this.errors=new Map,this.questionnaire.validations.forEach(e=>{const n=Cp(e);n&&n.validate(this)})}validEnoughForForcedSave(){for(const e of this.errors.values())if(!e.every(n=>Ep.includes(n.type)))return!1;return!0}calculateVisibility(){this.visibility=new Map,this.questionnaire.visibilityRules.forEach(e=>{e.runAgainst(this)})}markShown(e){const n=this.visibility.get(e)||{shown:!1,hidden:!1};n.shown=!0,this.visibility.set(e,n)}markHidden(e){const n=this.visibility.get(e)||{shown:!1,hidden:!1};n.hidden=!0,this.visibility.set(e,n)}isDisabled(e){const n=this.questionnaire.getField(e);if(!n.parentKey||!n.parentOptionKey)return!1;const a=this.questionnaire.getField(n.parentKey),o=this.values[a.key];return a.type==="radio"?o!==n.parentOptionKey:a.type==="check_box"?!o||!o.has(n.parentOptionKey):!1}isVisible(e){const n=this.visibility.get(e)||{shown:!1,hidden:!1};return n.shown||!n.hidden}numberValue(e){if(!this.values[e])return null;switch(this.questionnaire.getField(e).type){case"integer":case"float":return this.values[e];case"select":case"radio":case"scale":this.questionnaire.getOptionNumberValue(e,this.values[e])}return null}}function Zp(r){return r===""||r==null||r instanceof Set&&r.size===0||r instanceof Map&&r.size===0?null:r}const Yp=new Ud({key:"test",title:"test",language:"nl",panels:[],questions:{},visibilityRules:[],textvars:{},validations:[]}),yv=new Gd(Yp,{value:{},flags:{},textvars:new Map}),wv={displayMode:"paged",darkMode:!1,newLayout:!0},xv=(r,e)=>null,Zd=Le.createContext({questionnaire:Yp,response:yv,setQuestionRef:xv,displayOptions:wv});class Yd extends Error{}const Kp=(r,e)=>{let n=r.value;return Ho.isEmpty(n)&&!Ho.isEmpty(e.defaultAnswerValue)&&(n=e.defaultAnswerValue),{flags:$p.parse(r.flags),textvars:Gp.parse(r.textvars),value:Sv(n,e)}},Sv=(r,e)=>{const n=er.record(er.string(),er.any()).parse(r);return Object.values(e.questions).reduce((a,o)=>{const d=n[o.key];if(d==null)return a;switch(o.type){case"integer":case"float":a[o.key]=Up.parse(d);break;case"string":case"textarea":a[o.key]=Wp.parse(d);break;case"select":case"scale":case"radio":a[o.key]=_v(d,o);break;case"check_box":a[o.key]=kv(d,o);break;case"date_parts":a[o.key]=Hp.parse(d);break}return a},{})},_v=(r,e)=>{if(e.children.some(n=>n.key===r))return er.string().parse(r);throw new Yd(`wrong option key ${r} present for ${e.key}`)},kv=(r,e)=>{const n=Vp.parse(r);return n.forEach(a=>{if(!e.children.some(o=>o.key===a))throw new Yd(`wrong option key ${a} present for ${e.key}`)}),n},Jp=/\{\{((?<type>[a-z_]+)\.(?<textvar>[a-z0-9]+)|(?<textvaronly>[a-z0-9_]+))\}\}/g;class Qp{constructor(e,n){Vt(this,"response");Vt(this,"questionnaire");Vt(this,"stringToVariables");this.response=e,this.questionnaire=n,this.stringToVariables=new Map,this.interpolateCurlies=this.interpolateCurlies.bind(this)}interpolateCurlies(e){return this.stringToVariables.has(e)||this.stringToVariables.set(e,Array.from(e.matchAll(Jp)).map(n=>n.groups.textvar)),this.stringToVariables.get(e).length==0?e:e.replace(Jp,(...n)=>{var _;const{type:a,textvar:o,textvaronly:d}=n[n.length-1],v=a==="calculation"?(_=this.response.calculations.results[o])==null?void 0:_.toString():this.response.textvars.get(`${this.questionnaire.key}_${o||d}`);return Ho.escape(v||"")})}}var Kd={exports:{}},gc={};/**
39
+ }`;var Ot=_g(function(){return Pt(O,Xe+"return "+me).apply(n,j)});if(Ot.source=me,Nf(Ot))throw Ot;return Ot}function IS(t){return an(t).toLowerCase()}function AS(t){return an(t).toUpperCase()}function OS(t,i,u){if(t=an(t),t&&(u||i===n))return xe(t);if(!t||!(i=yr(i)))return t;var m=Rr(t),E=Rr(i),O=Jt(m,E),j=Qn(m,E)+1;return di(m,O,j).join("")}function MS(t,i,u){if(t=an(t),t&&(u||i===n))return t.slice(0,Bl(t)+1);if(!t||!(i=yr(i)))return t;var m=Rr(t),E=Qn(m,Rr(i))+1;return di(m,0,E).join("")}function FS(t,i,u){if(t=an(t),t&&(u||i===n))return t.replace(rn,"");if(!t||!(i=yr(i)))return t;var m=Rr(t),E=Jt(m,Rr(i));return di(m,E).join("")}function PS(t,i){var u=Mt,m=ve;if(An(i)){var E="separator"in i?i.separator:E;u="length"in i?Tt(i.length):u,m="omission"in i?yr(i.omission):m}t=an(t);var O=t.length;if(xo(t)){var j=Rr(t);O=j.length}if(u>=O)return t;var $=u-_o(m);if($<1)return m;var J=j?di(j,0,$).join(""):t.slice(0,$);if(E===n)return J+m;if(j&&($+=J.length-$),jf(E)){if(t.slice($).search(E)){var ce,de=J;for(E.global||(E=ha(E.source,an(kt.exec(E))+"g")),E.lastIndex=0;ce=E.exec(de);)var me=ce.index;J=J.slice(0,me===n?$:me)}}else if(t.indexOf(yr(E),$)!=$){var De=J.lastIndexOf(E);De>-1&&(J=J.slice(0,De))}return J+m}function DS(t){return t=an(t),t&&hr.test(t)?t.replace(Mn,Ru):t}var LS=B(function(t,i,u){return t+(u?" ":"")+i.toUpperCase()}),Wf=M("toUpperCase");function Sg(t,i,u){return t=an(t),i=u?n:i,i===n?yc(t)?_c(t):bo(t):t.match(i)||[]}var _g=bt(function(t,i){try{return Cn(t,n,i)}catch(u){return Nf(u)?u:new ot(u)}}),BS=Cs(function(t,i){return Vn(i,function(u){u=Uo(u),$n(t,u,Lf(t[u],t))}),t});function NS(t){var i=t==null?0:t.length,u=st();return t=i?qt(t,function(m){if(typeof m[1]!="function")throw new vr(v);return[u(m[0]),m[1]]}):[],bt(function(m){for(var E=-1;++E<i;){var O=t[E];if(Cn(O[0],this,m))return Cn(O[1],this,m)}})}function jS(t){return Ql(lr(t,L))}function Vf(t){return function(){return t}}function zS(t,i){return t==null||t!==t?i:t}var US=c(),WS=c(!0);function Ri(t){return t}function Hf(t){return Lo(typeof t=="function"?t:lr(t,L))}function VS(t){return Qi(lr(t,L))}function HS(t,i){return ci(t,lr(i,L))}var $S=bt(function(t,i){return function(u){return Wr(u,t,i)}}),GS=bt(function(t,i){return function(u){return Wr(t,u,i)}});function $f(t,i,u){var m=xr(i),E=fl(i,m);u==null&&!(An(i)&&(E.length||!m.length))&&(u=i,i=t,t=this,E=fl(i,xr(i)));var O=!(An(u)&&"chain"in u)||!!u.chain,j=Rs(t);return Vn(E,function($){var J=i[$];t[$]=J,j&&(t.prototype[$]=function(){var ce=this.__chain__;if(O||ce){var de=t(this.__wrapped__),me=de.__actions__=Zn(this.__actions__);return me.push({func:J,args:arguments,thisArg:t}),de.__chain__=ce,de}return J.apply(t,Er([this.value()],arguments))})}),t}function ZS(){return En._===this&&(En._=dn),this}function Gf(){}function YS(t){return t=Tt(t),bt(function(i){return qa(i,t)})}var KS=D(qt),JS=D(vo),QS=D(fa);function kg(t){return Af(t)?h(Uo(t)):su(t)}function XS(t){return function(i){return t==null?n:Ja(t,i)}}var qS=fe(),e1=fe(!0);function Zf(){return[]}function Yf(){return!1}function t1(){return{}}function n1(){return""}function r1(){return!0}function i1(t,i){if(t=Tt(t),t<1||t>ze)return[];var u=ue,m=bn(t,ue);i=st(i),t-=ue;for(var E=Q(m,i);++u<t;)i(u);return E}function a1(t){return Et(t)?qt(t,Uo):ea(t)?[t]:Zn(Hh(an(t)))}function o1(t){var i=++Au;return an(t)+i}var s1=T(function(t,i){return t+i},0),l1=it("ceil"),u1=T(function(t,i){return t/i},1),c1=it("floor");function d1(t){return t&&t.length?dl(t,Ri,cs):n}function f1(t,i){return t&&t.length?dl(t,st(i,2),cs):n}function p1(t){return Xo(t,Ri)}function h1(t,i){return Xo(t,st(i,2))}function g1(t){return t&&t.length?dl(t,Ri,ui):n}function m1(t,i){return t&&t.length?dl(t,st(i,2),ui):n}var v1=T(function(t,i){return t*i},1),b1=it("round"),y1=T(function(t,i){return t-i},0);function w1(t){return t&&t.length?q(t,Ri):0}function x1(t,i){return t&&t.length?q(t,st(i,2)):0}return I.after=Vw,I.ary=tg,I.assign=Ax,I.assignIn=gg,I.assignInWith=Md,I.assignWith=Ox,I.at=Mx,I.before=ng,I.bind=Lf,I.bindAll=BS,I.bindKey=rg,I.castArray=tx,I.chain=Xh,I.chunk=c0,I.compact=d0,I.concat=f0,I.cond=NS,I.conforms=jS,I.constant=Vf,I.countBy=ww,I.create=Fx,I.curry=ig,I.curryRight=ag,I.debounce=og,I.defaults=Px,I.defaultsDeep=Dx,I.defer=Hw,I.delay=$w,I.difference=p0,I.differenceBy=h0,I.differenceWith=g0,I.drop=m0,I.dropRight=v0,I.dropRightWhile=b0,I.dropWhile=y0,I.fill=w0,I.filter=Sw,I.flatMap=Ew,I.flatMapDeep=Cw,I.flatMapDepth=Tw,I.flatten=Yh,I.flattenDeep=x0,I.flattenDepth=S0,I.flip=Gw,I.flow=US,I.flowRight=WS,I.fromPairs=_0,I.functions=Wx,I.functionsIn=Vx,I.groupBy=Rw,I.initial=E0,I.intersection=C0,I.intersectionBy=T0,I.intersectionWith=R0,I.invert=$x,I.invertBy=Gx,I.invokeMap=Aw,I.iteratee=Hf,I.keyBy=Ow,I.keys=xr,I.keysIn=Ti,I.map=Cd,I.mapKeys=Yx,I.mapValues=Kx,I.matches=VS,I.matchesProperty=HS,I.memoize=Rd,I.merge=Jx,I.mergeWith=mg,I.method=$S,I.methodOf=GS,I.mixin=$f,I.negate=Id,I.nthArg=YS,I.omit=Qx,I.omitBy=Xx,I.once=Zw,I.orderBy=Mw,I.over=KS,I.overArgs=Yw,I.overEvery=JS,I.overSome=QS,I.partial=Bf,I.partialRight=sg,I.partition=Fw,I.pick=qx,I.pickBy=vg,I.property=kg,I.propertyOf=XS,I.pull=M0,I.pullAll=Jh,I.pullAllBy=F0,I.pullAllWith=P0,I.pullAt=D0,I.range=qS,I.rangeRight=e1,I.rearg=Kw,I.reject=Lw,I.remove=L0,I.rest=Jw,I.reverse=Pf,I.sampleSize=Nw,I.set=tS,I.setWith=nS,I.shuffle=jw,I.slice=B0,I.sortBy=Ww,I.sortedUniq=H0,I.sortedUniqBy=$0,I.split=ES,I.spread=Qw,I.tail=G0,I.take=Z0,I.takeRight=Y0,I.takeRightWhile=K0,I.takeWhile=J0,I.tap=dw,I.throttle=Xw,I.thru=Ed,I.toArray=fg,I.toPairs=bg,I.toPairsIn=yg,I.toPath=a1,I.toPlainObject=hg,I.transform=rS,I.unary=qw,I.union=Q0,I.unionBy=X0,I.unionWith=q0,I.uniq=ew,I.uniqBy=tw,I.uniqWith=nw,I.unset=iS,I.unzip=Df,I.unzipWith=Qh,I.update=aS,I.updateWith=oS,I.values=Qu,I.valuesIn=sS,I.without=rw,I.words=Sg,I.wrap=ex,I.xor=iw,I.xorBy=aw,I.xorWith=ow,I.zip=sw,I.zipObject=lw,I.zipObjectDeep=uw,I.zipWith=cw,I.entries=bg,I.entriesIn=yg,I.extend=gg,I.extendWith=Md,$f(I,I),I.add=s1,I.attempt=_g,I.camelCase=dS,I.capitalize=wg,I.ceil=l1,I.clamp=lS,I.clone=nx,I.cloneDeep=ix,I.cloneDeepWith=ax,I.cloneWith=rx,I.conformsTo=ox,I.deburr=xg,I.defaultTo=zS,I.divide=u1,I.endsWith=fS,I.eq=no,I.escape=pS,I.escapeRegExp=hS,I.every=xw,I.find=_w,I.findIndex=Gh,I.findKey=Lx,I.findLast=kw,I.findLastIndex=Zh,I.findLastKey=Bx,I.floor=c1,I.forEach=qh,I.forEachRight=eg,I.forIn=Nx,I.forInRight=jx,I.forOwn=zx,I.forOwnRight=Ux,I.get=zf,I.gt=sx,I.gte=lx,I.has=Hx,I.hasIn=Uf,I.head=Kh,I.identity=Ri,I.includes=Iw,I.indexOf=k0,I.inRange=uS,I.invoke=Zx,I.isArguments=yu,I.isArray=Et,I.isArrayBuffer=ux,I.isArrayLike=Ci,I.isArrayLikeObject=Yn,I.isBoolean=cx,I.isBuffer=kl,I.isDate=dx,I.isElement=fx,I.isEmpty=px,I.isEqual=hx,I.isEqualWith=gx,I.isError=Nf,I.isFinite=mx,I.isFunction=Rs,I.isInteger=lg,I.isLength=Ad,I.isMap=ug,I.isMatch=vx,I.isMatchWith=bx,I.isNaN=yx,I.isNative=wx,I.isNil=Sx,I.isNull=xx,I.isNumber=cg,I.isObject=An,I.isObjectLike=Bn,I.isPlainObject=Lc,I.isRegExp=jf,I.isSafeInteger=_x,I.isSet=dg,I.isString=Od,I.isSymbol=ea,I.isTypedArray=Ju,I.isUndefined=kx,I.isWeakMap=Ex,I.isWeakSet=Cx,I.join=I0,I.kebabCase=gS,I.last=Ea,I.lastIndexOf=A0,I.lowerCase=mS,I.lowerFirst=vS,I.lt=Tx,I.lte=Rx,I.max=d1,I.maxBy=f1,I.mean=p1,I.meanBy=h1,I.min=g1,I.minBy=m1,I.stubArray=Zf,I.stubFalse=Yf,I.stubObject=t1,I.stubString=n1,I.stubTrue=r1,I.multiply=v1,I.nth=O0,I.noConflict=ZS,I.noop=Gf,I.now=Td,I.pad=bS,I.padEnd=yS,I.padStart=wS,I.parseInt=xS,I.random=cS,I.reduce=Pw,I.reduceRight=Dw,I.repeat=SS,I.replace=_S,I.result=eS,I.round=b1,I.runInContext=Y,I.sample=Bw,I.size=zw,I.snakeCase=kS,I.some=Uw,I.sortedIndex=N0,I.sortedIndexBy=j0,I.sortedIndexOf=z0,I.sortedLastIndex=U0,I.sortedLastIndexBy=W0,I.sortedLastIndexOf=V0,I.startCase=CS,I.startsWith=TS,I.subtract=y1,I.sum=w1,I.sumBy=x1,I.template=RS,I.times=i1,I.toFinite=Is,I.toInteger=Tt,I.toLength=pg,I.toLower=IS,I.toNumber=Ca,I.toSafeInteger=Ix,I.toString=an,I.toUpper=AS,I.trim=OS,I.trimEnd=MS,I.trimStart=FS,I.truncate=PS,I.unescape=DS,I.uniqueId=o1,I.upperCase=LS,I.upperFirst=Wf,I.each=qh,I.eachRight=eg,I.first=Kh,$f(I,function(){var t={};return _i(I,function(i,u){Ht.call(I.prototype,u)||(t[u]=i)}),t}(),{chain:!1}),I.VERSION=a,Vn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){I[t].placeholder=I}),Vn(["drop","take"],function(t,i){St.prototype[t]=function(u){u=u===n?1:vn(Tt(u),0);var m=this.__filtered__&&!i?new St(this):this.clone();return m.__filtered__?m.__takeCount__=bn(u,m.__takeCount__):m.__views__.push({size:bn(u,ue),type:t+(m.__dir__<0?"Right":"")}),m},St.prototype[t+"Right"]=function(u){return this.reverse()[t](u).reverse()}}),Vn(["filter","map","takeWhile"],function(t,i){var u=i+1,m=u==Be||u==He;St.prototype[t]=function(E){var O=this.clone();return O.__iteratees__.push({iteratee:st(E,3),type:u}),O.__filtered__=O.__filtered__||m,O}}),Vn(["head","last"],function(t,i){var u="take"+(i?"Right":"");St.prototype[t]=function(){return this[u](1).value()[0]}}),Vn(["initial","tail"],function(t,i){var u="drop"+(i?"":"Right");St.prototype[t]=function(){return this.__filtered__?new St(this):this[u](1)}}),St.prototype.compact=function(){return this.filter(Ri)},St.prototype.find=function(t){return this.filter(t).head()},St.prototype.findLast=function(t){return this.reverse().find(t)},St.prototype.invokeMap=bt(function(t,i){return typeof t=="function"?new St(this):this.map(function(u){return Wr(u,t,i)})}),St.prototype.reject=function(t){return this.filter(Id(st(t)))},St.prototype.slice=function(t,i){t=Tt(t);var u=this;return u.__filtered__&&(t>0||i<0)?new St(u):(t<0?u=u.takeRight(-t):t&&(u=u.drop(t)),i!==n&&(i=Tt(i),u=i<0?u.dropRight(-i):u.take(i-t)),u)},St.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},St.prototype.toArray=function(){return this.take(ue)},_i(St.prototype,function(t,i){var u=/^(?:filter|find|map|reject)|While$/.test(i),m=/^(?:head|last)$/.test(i),E=I[m?"take"+(i=="last"?"Right":""):i],O=m||/^find/.test(i);E&&(I.prototype[i]=function(){var j=this.__wrapped__,$=m?[1]:arguments,J=j instanceof St,ce=$[0],de=J||Et(j),me=function(Nt){var Wt=E.apply(I,Er([Nt],$));return m&&De?Wt[0]:Wt};de&&u&&typeof ce=="function"&&ce.length!=1&&(J=de=!1);var De=this.__chain__,Xe=!!this.__actions__.length,lt=O&&!De,Ot=J&&!Xe;if(!O&&de){j=Ot?j:new St(this);var ut=t.apply(j,$);return ut.__actions__.push({func:Ed,args:[me],thisArg:n}),new sr(ut,De)}return lt&&Ot?t.apply(this,$):(ut=this.thru(me),lt?m?ut.value()[0]:ut.value():ut)})}),Vn(["pop","push","shift","sort","splice","unshift"],function(t){var i=za[t],u=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",m=/^(?:pop|shift)$/.test(t);I.prototype[t]=function(){var E=arguments;if(m&&!this.__chain__){var O=this.value();return i.apply(Et(O)?O:[],E)}return this[u](function(j){return i.apply(Et(j)?j:[],E)})}}),_i(St.prototype,function(t,i){var u=I[i];if(u){var m=u.name+"";Ht.call(ya,m)||(ya[m]=[]),ya[m].push({name:i,func:u})}}),ya[g(n,G).name]=[{name:"wrapper",func:n}],St.prototype.clone=nl,St.prototype.reverse=Oo,St.prototype.value=ls,I.prototype.at=fw,I.prototype.chain=pw,I.prototype.commit=hw,I.prototype.next=gw,I.prototype.plant=vw,I.prototype.reverse=bw,I.prototype.toJSON=I.prototype.valueOf=I.prototype.value=yw,I.prototype.first=I.prototype.head,Hi&&(I.prototype[Hi]=mw),I},Dn=Iu();Ui?((Ui.exports=Dn)._=Dn,ho._=Dn):En._=Dn}).call(qn)}(td,td.exports);var Ho=td.exports;const $o=Symbol.for("@ts-pattern/matcher"),dv=Symbol.for("@ts-pattern/isVariadic"),nd="@ts-pattern/anonymous-select-key",Wd=r=>!!(r&&typeof r=="object"),rd=r=>r&&!!r[$o],so=(r,e,n)=>{if(rd(r)){const a=r[$o](),{matched:o,selections:d}=a.match(e);return o&&d&&Object.keys(d).forEach(v=>n(v,d[v])),o}if(Wd(r)){if(!Wd(e))return!1;if(Array.isArray(r)){if(!Array.isArray(e))return!1;let a=[],o=[],d=[];for(const v of r.keys()){const _=r[v];rd(_)&&_[dv]?d.push(_):d.length?o.push(_):a.push(_)}if(d.length){if(d.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(e.length<a.length+o.length)return!1;const v=e.slice(0,a.length),_=o.length===0?[]:e.slice(-o.length),w=e.slice(a.length,o.length===0?1/0:-o.length);return a.every((C,N)=>so(C,v[N],n))&&o.every((C,N)=>so(C,_[N],n))&&(d.length===0||so(d[0],w,n))}return r.length===e.length&&r.every((v,_)=>so(v,e[_],n))}return Reflect.ownKeys(r).every(a=>{const o=r[a];return(a in e||rd(d=o)&&d[$o]().matcherType==="optional")&&so(o,e[a],n);var d})}return Object.is(e,r)},Ls=r=>{var e,n,a;return Wd(r)?rd(r)?(e=(n=(a=r[$o]()).getSelectionKeys)==null?void 0:n.call(a))!=null?e:[]:Array.isArray(r)?hc(r,Ls):hc(Object.values(r),Ls):[]},hc=(r,e)=>r.reduce((n,a)=>n.concat(e(a)),[]);function ra(r){return Object.assign(r,{optional:()=>fv(r),and:e=>xn(r,e),or:e=>pv(r,e),select:e=>e===void 0?kp(r):kp(e,r)})}function fv(r){return ra({[$o]:()=>({match:e=>{let n={};const a=(o,d)=>{n[o]=d};return e===void 0?(Ls(r).forEach(o=>a(o,void 0)),{matched:!0,selections:n}):{matched:so(r,e,a),selections:n}},getSelectionKeys:()=>Ls(r),matcherType:"optional"})})}function xn(...r){return ra({[$o]:()=>({match:e=>{let n={};const a=(o,d)=>{n[o]=d};return{matched:r.every(o=>so(o,e,a)),selections:n}},getSelectionKeys:()=>hc(r,Ls),matcherType:"and"})})}function pv(...r){return ra({[$o]:()=>({match:e=>{let n={};const a=(o,d)=>{n[o]=d};return hc(r,Ls).forEach(o=>a(o,void 0)),{matched:r.some(o=>so(o,e,a)),selections:n}},getSelectionKeys:()=>hc(r,Ls),matcherType:"or"})})}function Qt(r){return{[$o]:()=>({match:e=>({matched:!!r(e)})})}}function kp(...r){const e=typeof r[0]=="string"?r[0]:void 0,n=r.length===2?r[1]:typeof r[0]=="string"?void 0:r[0];return ra({[$o]:()=>({match:a=>{let o={[e??nd]:a};return{matched:n===void 0||so(n,a,(d,v)=>{o[d]=v}),selections:o}},getSelectionKeys:()=>[e??nd].concat(n===void 0?[]:Ls(n))})})}function lo(r){return typeof r=="number"}function Bs(r){return typeof r=="string"}function Ns(r){return typeof r=="bigint"}ra(Qt(function(r){return!0}));const js=r=>Object.assign(ra(r),{startsWith:e=>{return js(xn(r,(n=e,Qt(a=>Bs(a)&&a.startsWith(n)))));var n},endsWith:e=>{return js(xn(r,(n=e,Qt(a=>Bs(a)&&a.endsWith(n)))));var n},minLength:e=>js(xn(r,(n=>Qt(a=>Bs(a)&&a.length>=n))(e))),length:e=>js(xn(r,(n=>Qt(a=>Bs(a)&&a.length===n))(e))),maxLength:e=>js(xn(r,(n=>Qt(a=>Bs(a)&&a.length<=n))(e))),includes:e=>{return js(xn(r,(n=e,Qt(a=>Bs(a)&&a.includes(n)))));var n},regex:e=>{return js(xn(r,(n=e,Qt(a=>Bs(a)&&!!a.match(n)))));var n}});js(Qt(Bs));const uo=r=>Object.assign(ra(r),{between:(e,n)=>uo(xn(r,((a,o)=>Qt(d=>lo(d)&&a<=d&&o>=d))(e,n))),lt:e=>uo(xn(r,(n=>Qt(a=>lo(a)&&a<n))(e))),gt:e=>uo(xn(r,(n=>Qt(a=>lo(a)&&a>n))(e))),lte:e=>uo(xn(r,(n=>Qt(a=>lo(a)&&a<=n))(e))),gte:e=>uo(xn(r,(n=>Qt(a=>lo(a)&&a>=n))(e))),int:()=>uo(xn(r,Qt(e=>lo(e)&&Number.isInteger(e)))),finite:()=>uo(xn(r,Qt(e=>lo(e)&&Number.isFinite(e)))),positive:()=>uo(xn(r,Qt(e=>lo(e)&&e>0))),negative:()=>uo(xn(r,Qt(e=>lo(e)&&e<0)))});uo(Qt(lo));const zs=r=>Object.assign(ra(r),{between:(e,n)=>zs(xn(r,((a,o)=>Qt(d=>Ns(d)&&a<=d&&o>=d))(e,n))),lt:e=>zs(xn(r,(n=>Qt(a=>Ns(a)&&a<n))(e))),gt:e=>zs(xn(r,(n=>Qt(a=>Ns(a)&&a>n))(e))),lte:e=>zs(xn(r,(n=>Qt(a=>Ns(a)&&a<=n))(e))),gte:e=>zs(xn(r,(n=>Qt(a=>Ns(a)&&a>=n))(e))),positive:()=>zs(xn(r,Qt(e=>Ns(e)&&e>0))),negative:()=>zs(xn(r,Qt(e=>Ns(e)&&e<0)))});zs(Qt(Ns)),ra(Qt(function(r){return typeof r=="boolean"})),ra(Qt(function(r){return typeof r=="symbol"})),ra(Qt(function(r){return r==null})),ra(Qt(function(r){return r!=null}));class hv extends Error{constructor(e){let n;try{n=JSON.stringify(e)}catch{n=e}super(`Pattern matching error: no pattern matches value ${n}`),this.input=void 0,this.input=e}}const Vd={matched:!1,value:void 0};function gv(r){return new id(r,Vd)}class id{constructor(e,n){this.input=void 0,this.state=void 0,this.input=e,this.state=n}with(...e){if(this.state.matched)return this;const n=e[e.length-1],a=[e[0]];let o;e.length===3&&typeof e[1]=="function"?o=e[1]:e.length>2&&a.push(...e.slice(1,e.length-1));let d=!1,v={};const _=(C,N)=>{d=!0,v[C]=N},w=!a.some(C=>so(C,this.input,_))||o&&!o(this.input)?Vd:{matched:!0,value:n(d?nd in v?v[nd]:v:this.input,this.input)};return new id(this.input,w)}when(e,n){if(this.state.matched)return this;const a=!!e(this.input);return new id(this.input,a?{matched:!0,value:n(this.input,this.input)}:Vd)}otherwise(e){return this.state.matched?this.state.value:e(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new hv(this.input)}run(){return this.exhaustive()}returnType(){return this}}const Sf=class{constructor(e,n){Vt(this,"sexpVariables");Vt(this,"questionKeyToCalculationKeys");Vt(this,"response");Vt(this,"results",{});this.sexpVariables=e,this.questionKeyToCalculationKeys=mv(e),this.response=n,Object.keys(e).forEach(a=>{this.results[a]=this.calculate(this.sexpVariables[a].calculation)})}handleValueChanged(e){var n;(n=this.questionKeyToCalculationKeys[e])==null||n.forEach(a=>{this.results[a]=this.calculate(this.sexpVariables[a].calculation)})}calculate(e){return e.op==="string_value"?this.stringValue(e.key):this.calculateNumber(e)}calculateNumber(e){return gv(e).with({op:"number"},({value:n})=>n).with({op:"number_value"},({key:n})=>this.response.numberValue(n)).with({op:"sum"},({values:n})=>this.reduce(n,"sum")).with({op:"subtract"},({values:n})=>this.reduce(n,"subtract")).with({op:"multiply"},({values:n})=>this.reduce(n,"multiply")).with({op:"divide"},({values:n})=>this.reduce(n,"divide")).with({op:"round"},({value:n,digits:a})=>this.round(n,a)).exhaustive()}stringValue(e){const n=this.response.values[e];return(n==null?void 0:n.toString())??null}reduce(e,n){const a=e.map(o=>this.calculateNumber(o));return a.some(o=>o===null)?null:a.reduce(Sf.numberReducers[n])}round(e,n){const a=this.calculateNumber(e);return a===null?null:Number(a.toFixed(n))}};let ad=Sf;Vt(ad,"numberReducers",{sum:(e,n)=>e+n,multiply:(e,n)=>e*n,subtract:(e,n)=>e-n,divide:(e,n)=>e/n});function mv(r){const e={};for(const[n,a]of Object.entries(r))Hd(a.calculation).forEach(d=>{e[d]??(e[d]=new Set),e[d].add(n)});return e}function Hd(r){switch(r.op){case"number_value":case"string_value":return[r.key];case"sum":case"multiply":case"divide":case"subtract":return r.values.flatMap(e=>Hd(e));case"round":return Hd(r.value);case"number":return[]}}function vv(r,e,n){if(arguments.length<3)throw new TypeError("3 argument required, but only "+arguments.length+" present");var a=new Date(r,e,n);return a.getFullYear()===r&&a.getMonth()===e&&a.getDate()===n}const Ep=["requires_answer","minimum_checked_required","answer_group_minimum"];function Cp(r){switch(r.type){case"requires_answer":return new Tp(r);case"valid_integer":return new Ap(r);case"valid_float":return new Op(r);case"valid_date":return new Ip(r);case"minimum":return new Mp(r);case"maximum":return new Fp(r);case"minimum_date":return new Pp(r);case"maximum_date":return new Dp(r);case"minimum_checked_required":return new Lp(r);case"maximum_checked_allowed":return new Bp(r);case"answer_group_minimum":return new Np(r);case"answer_group_maximum":return new jp(r);case"regexp":return new zp(r)}}class hi{constructor(e){Vt(this,"config");this.config=e}}class Tp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);od(n.value)||n.addError({type:this.config.type,message:{t:"requires_answer"}})}}function od(r){if(r==null)return!1;if(typeof r=="string")return!!r;if(typeof r=="number")return!0;if(r instanceof Map)return ld(r);if("size"in r)return r.size>0;if("length"in r)return r.length>0;throw"Unexpected value type in validation"}function sd(r){return r===void 0||r===null||r===""?!1:typeof r=="string"}function Rp(r){return r===void 0||r===null?!1:typeof r=="number"}function ld(r){if(r===void 0||r===null)return!1;for(const[e,n]of r){if(typeof e!="string"||typeof n!="string")return!1;if(sd(n))return!0}return!1}const bv=/(\s*-?[1-9][0-9]+\s*|\s*-?[0-9]\s*)/;class Ip extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);if(!ld(n.value))return;if(this.config.requiredParts.some(o=>!n.value.get(o))){n.addError({type:this.config.type,message:{t:`valid_date.${this.config.subtype}`}});return}const a=$d(n.value);(!a||!vv(a.year,a.month,a.day)||a.year<1900||a.year>2100||a.hour>23||a.minute>59)&&n.addError({type:this.config.type,message:{t:`valid_date.${this.config.subtype}`}})}}function $d(r){var e=function(n,a){const o=r.get(n);return o===void 0||o==""?a:parseInt(o,10)};return[...r.values()].some(n=>n&&!/^\d*$/.test(n))?null:{year:e("year",2e3),month:e("month",1)-1,day:e("day",1),hour:e("hour",0),minute:e("minute",0)}}class Ap extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);if(!sd(n.value))return;const a=bv.exec(n.value);(a===null||a[0]!==n.value)&&n.addError({type:this.config.type,message:{t:"valid_integer"}})}}class Op extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);if(!sd(n.value))return;const a=parseFloat(n.value);!isNaN(a)&&isFinite(a)||n.addError({type:this.config.type,message:{t:"valid_float"}})}}class Mp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);Rp(n.value)&&parseFloat(n.value)<this.config.value&&n.addError({type:this.config.type,message:{t:"minimum",value:this.config.value.toString()}})}}class Fp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);Rp(n.value)&&parseFloat(n.value)>this.config.value&&n.addError({type:this.config.type,message:{t:"maximum",value:this.config.value.toString()}})}}class Pp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);if(!ld(n.value))return;const a=$d(n.value);a&&new Date(a.year,a.month,a.hour)<new Date(this.config.value)&&n.addError({type:this.config.type,message:{t:"minimum_date",friendly_date:this.config.value}})}}class Dp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);if(!ld(n.value))return;const a=$d(n.value);a&&new Date(a.year,a.month,a.hour)>new Date(this.config.value)&&n.addError({type:this.config.type,message:{t:"maximum_date",friendly_date:this.config.value}})}}class Lp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);(!n.value||n.value.size<this.config.minimumCheckedValue)&&n.addError({type:this.config.type,message:{t:"minimum_checked_required",count:this.config.minimumCheckedValue}})}}class Bp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);od(n.value)&&n.value.size>this.config.maximumCheckedValue&&n.addError({type:this.config.type,message:{t:"maximum_checked_allowed",count:this.config.maximumCheckedValue}})}}class Np extends hi{validate(e){const n=this.config.fieldKeys.map(a=>e.getValidationFieldState(a));n.filter(a=>od(a.value)).length>=this.config.value||n.forEach(a=>{a.addError({type:this.config.type,message:{t:"answer_group_minimum",value:this.config.value}})})}}class jp extends hi{validate(e){const n=this.config.fieldKeys.map(a=>e.getValidationFieldState(a));n.filter(a=>od(a.value)).length<=this.config.value||n.forEach(a=>{a.addError({type:this.config.type,message:{t:"answer_group_maximum",value:this.config.value}})})}}class zp extends hi{validate(e){const n=e.getValidationFieldState(this.config.fieldKey);if(!sd(n.value))return;const a=this.config.matcher.replace("\\A","^").replace("\\Z","$"),d=new RegExp(a).exec(n.value);(d===null||d[0]!==n.value)&&n.addError({type:this.config.type,message:this.config.explanation||{t:"regexp",matcher:this.config.matcher}})}}const Up=er.coerce.number(),Wp=er.coerce.string(),Vp=er.preprocess(r=>r instanceof Array?new Set(r):r,er.set(er.string())),Hp=er.preprocess(r=>!(r instanceof Map)&&r instanceof Object?new Map(Object.entries(r)):r,er.map(Sp,er.string())),$p=er.record(er.boolean()),Gp=er.preprocess(r=>!(r instanceof Map)&&r instanceof Object?new Map(Object.entries(r)):r,er.map(er.string(),er.string()));class Gd{constructor(e,n){Vt(this,"questionnaire");Vt(this,"values");Vt(this,"originalValues");Vt(this,"beenActives");Vt(this,"errors");Vt(this,"visibility");Vt(this,"changeHandlers");Vt(this,"flags");Vt(this,"textvars");Vt(this,"activeQuestionKey");Vt(this,"calculations");this.questionnaire=e,this.values=n.value,this.originalValues={...n.value},this.beenActives=new Set,this.errors=new Map,this.visibility=new Map,this.changeHandlers=[],this.flags=n.flags,this.textvars=this.initTextvars(n.textvars),this.activeQuestionKey=null,this.validate(),this.calculateVisibility(),this.calculations=new ad(e.sexpVariables,this)}cleanValues(){const e=Object.keys(this.values).filter(n=>this.values[n]&&this.isVisible(n)&&!this.isDisabled(n));return Ho.pick(this.values,e)}onChange(e){this.changeHandlers.push(e)}offChange(e){Ho.pull(this.changeHandlers,e)}getFieldState(e){return{key:e,value:this.values[e],beenActive:this.beenActives.has(e),valid:(this.errors.get(e)||[]).length===0,errors:this.errors.get(e)||[],hidden:!this.isVisible(e),disabled:this.isDisabled(e),isActiveQuestion:this.activeQuestionKey===e,setAsActiveQuestion:()=>this.setActiveQuestion(e),setValue:n=>this.setValue(e,n)}}getValidationFieldState(e){return{value:this.values[e],addError:n=>this.addError(e,n)}}setTextvar(e,n){n?this.textvars.set(e,n):this.textvars.set(e,this.questionnaire.textvars.find(a=>a.key===e).default)}initTextvars(e){const n=new Map;for(const a of this.questionnaire.textvars)n.set(a.key,e.get(a.key)??a.default);for(const a of Object.values(this.questionnaire.questions)){const o=this.values[a.key];typeof o=="string"&&"setsTextvar"in a&&a.setsTextvar&&n.set(a.setsTextvar,o)}return n}setValue(e,n){const a=this.questionnaire.getField(e);this.values[e]=n,(n===null||typeof n=="string")&&"setsTextvar"in a&&a.setsTextvar&&this.setTextvar(a.setsTextvar,n),this.validate(),this.calculateVisibility(),this.calculations.handleValueChanged(e),this.changeHandlers.forEach(o=>o(this,"valueChanged"))}setActiveQuestion(e){this.activeQuestionKey!==e&&(this.activeQuestionKey&&this.touchField(this.activeQuestionKey),this.activeQuestionKey=e,this.changeHandlers.forEach(n=>n(this)))}addError(e,n){const a=this.errors.get(e)||[];a.push(n),this.errors.set(e,a)}valueHasChanged(){for(const e in this.questionnaire.questions){const n=Zp(this.values[e]),a=Zp(this.originalValues[e]);if(!Ho.isEqual(n,a))return!0}return!1}touchAllFields(){Object.values(this.questionnaire.questions).forEach(e=>{this.touchField(e.key)})}touchPanelFields(e){e.items.forEach(n=>{n.type==="question"&&this.touchField(n.key)})}touchField(e){if(this.beenActives.has(e))return;this.questionnaire.getQuestionsInSameGroup(e).forEach(a=>{this.beenActives.add(a.key),this.values[a.key]===void 0&&this.setValue(a.key,null)})}firstNotValidQuestionInPanel(e){const n=e.items.find(a=>{if(a.type!=="question"||!this.isVisible(a.key))return!1;if((this.errors.get(a.key)||[]).length>0)return!0});return(n==null?void 0:n.key)||null}firstNotValidQuestion(){const e=this.questionnaire.panels.find(n=>this.firstNotValidQuestionInPanel(n));return e==null?null:this.firstNotValidQuestionInPanel(e)}validate(){this.errors=new Map,this.questionnaire.validations.forEach(e=>{const n=Cp(e);n&&n.validate(this)})}validEnoughForForcedSave(){for(const e of this.errors.values())if(!e.every(n=>Ep.includes(n.type)))return!1;return!0}calculateVisibility(){this.visibility=new Map,this.questionnaire.visibilityRules.forEach(e=>{e.runAgainst(this)})}markShown(e){const n=this.visibility.get(e)||{shown:!1,hidden:!1};n.shown=!0,this.visibility.set(e,n)}markHidden(e){const n=this.visibility.get(e)||{shown:!1,hidden:!1};n.hidden=!0,this.visibility.set(e,n)}isDisabled(e){const n=this.questionnaire.getField(e);if(!n.parentKey||!n.parentOptionKey)return!1;const a=this.questionnaire.getField(n.parentKey),o=this.values[a.key];return a.type==="radio"?o!==n.parentOptionKey:a.type==="check_box"?!o||!o.has(n.parentOptionKey):!1}isVisible(e){const n=this.visibility.get(e)||{shown:!1,hidden:!1};return n.shown||!n.hidden}numberValue(e){if(!this.values[e])return null;switch(this.questionnaire.getField(e).type){case"integer":case"float":return this.values[e];case"select":case"radio":case"scale":return this.questionnaire.getOptionNumberValue(e,this.values[e])}return null}}function Zp(r){return r===""||r==null||r instanceof Set&&r.size===0||r instanceof Map&&r.size===0?null:r}const Yp=new Ud({key:"test",title:"test",language:"nl",panels:[],questions:{},visibilityRules:[],textvars:{},validations:[]}),yv=new Gd(Yp,{value:{},flags:{},textvars:new Map}),wv={displayMode:"paged",darkMode:!1,newLayout:!0},xv=(r,e)=>null,Zd=Le.createContext({questionnaire:Yp,response:yv,setQuestionRef:xv,displayOptions:wv});class Yd extends Error{}const Kp=(r,e)=>{let n=r.value;return Ho.isEmpty(n)&&!Ho.isEmpty(e.defaultAnswerValue)&&(n=e.defaultAnswerValue),{flags:$p.parse(r.flags),textvars:Gp.parse(r.textvars),value:Sv(n,e)}},Sv=(r,e)=>{const n=er.record(er.string(),er.any()).parse(r);return Object.values(e.questions).reduce((a,o)=>{const d=n[o.key];if(d==null)return a;switch(o.type){case"integer":case"float":a[o.key]=Up.parse(d);break;case"string":case"textarea":a[o.key]=Wp.parse(d);break;case"select":case"scale":case"radio":a[o.key]=_v(d,o);break;case"check_box":a[o.key]=kv(d,o);break;case"date_parts":a[o.key]=Hp.parse(d);break}return a},{})},_v=(r,e)=>{if(e.children.some(n=>n.key===r))return er.string().parse(r);throw new Yd(`wrong option key ${r} present for ${e.key}`)},kv=(r,e)=>{const n=Vp.parse(r);return n.forEach(a=>{if(!e.children.some(o=>o.key===a))throw new Yd(`wrong option key ${a} present for ${e.key}`)}),n},Jp=/\{\{((?<type>[a-z_]+)\.(?<textvar>[a-z0-9]+)|(?<textvaronly>[a-z0-9_]+))\}\}/g;class Qp{constructor(e,n){Vt(this,"response");Vt(this,"questionnaire");Vt(this,"stringToVariables");this.response=e,this.questionnaire=n,this.stringToVariables=new Map,this.interpolateCurlies=this.interpolateCurlies.bind(this)}interpolateCurlies(e){return this.stringToVariables.has(e)||this.stringToVariables.set(e,Array.from(e.matchAll(Jp)).map(n=>n.groups.textvar)),this.stringToVariables.get(e).length==0?e:e.replace(Jp,(...n)=>{var _;const{type:a,textvar:o,textvaronly:d}=n[n.length-1],v=a==="calculation"?(_=this.response.calculations.results[o])==null?void 0:_.toString():this.response.textvars.get(`${this.questionnaire.key}_${o||d}`);return Ho.escape(v||"")})}}var Kd={exports:{}},gc={};/**
40
40
  * @license React
41
41
  * react-jsx-runtime.production.min.js
42
42
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roqua/quby-frontend",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "main": "./dist/quby-frontend.umd.js",
5
5
  "module": "./dist/quby-frontend.es.js",
6
6
  "types": "./dist/index.d.ts",