@inploi/plugin-chatbot 3.6.1 → 3.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cdn/index.js CHANGED
@@ -50,8 +50,8 @@ var Sy=Object.defineProperty;var My=(Et,Je,Ie)=>Je in Et?Sy(Et,Je,{enumerable:!0
50
50
  `,hg=()=>{let e=null;return{getOrCreateChatbotElement:()=>{if(e)return e;const t=document.createElement("div");return document.body.appendChild(t),t.id=Ev,e=t,t},addStyle:(t,n)=>{const r=document.head,o=document.createElement("style");o.id=n,o.innerHTML=t,r.appendChild(o)}}},Su=(e,t)=>{if(typeof e=="number"){if(t===3)return{mode:"rgb",r:(e>>8&15|e>>4&240)/255,g:(e>>4&15|e&240)/255,b:(e&15|e<<4&240)/255};if(t===4)return{mode:"rgb",r:(e>>12&15|e>>8&240)/255,g:(e>>8&15|e>>4&240)/255,b:(e>>4&15|e&240)/255,alpha:(e&15|e<<4&240)/255};if(t===6)return{mode:"rgb",r:(e>>16&255)/255,g:(e>>8&255)/255,b:(e&255)/255};if(t===8)return{mode:"rgb",r:(e>>24&255)/255,g:(e>>16&255)/255,b:(e>>8&255)/255,alpha:(e&255)/255}}},pg={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},mg=e=>Su(pg[e.toLowerCase()],6),vg=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,gg=e=>{let t;return(t=e.match(vg))?Su(parseInt(t[1],16),t[1].length):void 0},$t="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",nr=`${$t}%`,os=`(?:${$t}%|${$t})`,bg=`(?:${$t}(deg|grad|rad|turn)|${$t})`,yn="\\s*,\\s*",yg=new RegExp(`^rgba?\\(\\s*${$t}${yn}${$t}${yn}${$t}\\s*(?:,\\s*${os}\\s*)?\\)$`),wg=new RegExp(`^rgba?\\(\\s*${nr}${yn}${nr}${yn}${nr}\\s*(?:,\\s*${os}\\s*)?\\)$`),_g=e=>{let t={mode:"rgb"},n;if(n=e.match(yg))n[1]!==void 0&&(t.r=n[1]/255),n[2]!==void 0&&(t.g=n[2]/255),n[3]!==void 0&&(t.b=n[3]/255);else if(n=e.match(wg))n[1]!==void 0&&(t.r=n[1]/100),n[2]!==void 0&&(t.g=n[2]/100),n[3]!==void 0&&(t.b=n[3]/100);else return;return n[4]!==void 0?t.alpha=n[4]/100:n[5]!==void 0&&(t.alpha=+n[5]),t},rr=(e,t)=>e===void 0?void 0:typeof e!="object"?Pg(e):e.mode!==void 0?e:t?{...e,mode:t}:void 0,it=(e="rgb")=>t=>(t=rr(t,e))!==void 0?t.mode===e?t:Ke[t.mode][e]?Ke[t.mode][e](t):e==="rgb"?Ke[t.mode].rgb(t):Ke.rgb[e](Ke[t.mode].rgb(t)):void 0,Ke={},Mu={},ao=[],Tu={},xg=e=>e,Z=e=>(Ke[e.mode]={...Ke[e.mode],...e.toMode},Object.keys(e.fromMode||{}).forEach(t=>{Ke[t]||(Ke[t]={}),Ke[t][e.mode]=e.fromMode[t]}),e.ranges||(e.ranges={}),e.difference||(e.difference={}),e.channels.forEach(t=>{if(e.ranges[t]===void 0&&(e.ranges[t]=[0,1]),!e.interpolate[t])throw new Error(`Missing interpolator for: ${t}`);typeof e.interpolate[t]=="function"&&(e.interpolate[t]={use:e.interpolate[t]}),e.interpolate[t].fixup||(e.interpolate[t].fixup=xg)}),Mu[e.mode]=e,(e.parse||[]).forEach(t=>{kg(t,e.mode)}),it(e.mode)),Wt=e=>Mu[e],kg=(e,t)=>{if(typeof e=="string"){if(!t)throw new Error("'mode' required when 'parser' is a string");Tu[e]=t}else typeof e=="function"&&ao.indexOf(e)<0&&ao.push(e)},is=/[^\x00-\x7F]|[a-zA-Z_]/,$g=/[^\x00-\x7F]|[-\w]/,$={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"};let D=0;function co(e){let t=e[D],n=e[D+1];return t==="-"||t==="+"?/\d/.test(n)||n==="."&&/\d/.test(e[D+2]):t==="."?/\d/.test(n):/\d/.test(t)}function ss(e){if(D>=e.length)return!1;let t=e[D];if(is.test(t))return!0;if(t==="-"){if(e.length-D<2)return!1;let n=e[D+1];return!!(n==="-"||is.test(n))}return!1}const Sg={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function or(e){let t="";if((e[D]==="-"||e[D]==="+")&&(t+=e[D++]),t+=lo(e),e[D]==="."&&/\d/.test(e[D+1])&&(t+=e[D++]+lo(e)),(e[D]==="e"||e[D]==="E")&&((e[D+1]==="-"||e[D+1]==="+")&&/\d/.test(e[D+2])?t+=e[D++]+e[D++]+lo(e):/\d/.test(e[D+1])&&(t+=e[D++]+lo(e))),ss(e)){let n=uo(e);return n==="deg"||n==="rad"||n==="turn"||n==="grad"?{type:$.Hue,value:t*Sg[n]}:void 0}return e[D]==="%"?(D++,{type:$.Percentage,value:+t}):{type:$.Number,value:+t}}function lo(e){let t="";for(;/\d/.test(e[D]);)t+=e[D++];return t}function uo(e){let t="";for(;D<e.length&&$g.test(e[D]);)t+=e[D++];return t}function Mg(e){let t=uo(e);return e[D]==="("?(D++,{type:$.Function,value:t}):t==="none"?{type:$.None,value:void 0}:{type:$.Ident,value:t}}function Tg(e=""){let t=e.trim(),n=[],r;for(D=0;D<t.length;){if(r=t[D++],r===`
51
51
  `||r===" "||r===" "){for(;D<t.length&&(t[D]===`
52
52
  `||t[D]===" "||t[D]===" ");)D++;continue}if(r===",")return;if(r===")"){n.push({type:$.ParenClose});continue}if(r==="+"){if(D--,co(t)){n.push(or(t));continue}return}if(r==="-"){if(D--,co(t)){n.push(or(t));continue}if(ss(t)){n.push({type:$.Ident,value:uo(t)});continue}return}if(r==="."){if(D--,co(t)){n.push(or(t));continue}return}if(r==="/"){for(;D<t.length&&(t[D]===`
53
- `||t[D]===" "||t[D]===" ");)D++;let o;if(co(t)&&(o=or(t),o.type!==$.Hue)){n.push({type:$.Alpha,value:o});continue}if(ss(t)&&uo(t)==="none"){n.push({type:$.Alpha,value:{type:$.None,value:void 0}});continue}return}if(/\d/.test(r)){D--,n.push(or(t));continue}if(is.test(r)){D--,n.push(Mg(t));continue}return}return n}function Cg(e){e._i=0;let t=e[e._i++];if(!t||t.type!==$.Function||t.value!=="color"||(t=e[e._i++],t.type!==$.Ident))return;const n=Tu[t.value];if(!n)return;const r={mode:n},o=Cu(e,!1);if(!o)return;const i=Wt(n).channels;for(let s=0,a;s<i.length;s++)a=o[s],a.type!==$.None&&(r[i[s]]=a.type===$.Number?a.value:a.value/100);return r}function Cu(e,t){const n=[];let r;for(;e._i<e.length;){if(r=e[e._i++],r.type===$.None||r.type===$.Number||r.type===$.Alpha||r.type===$.Percentage||t&&r.type===$.Hue){n.push(r);continue}if(r.type===$.ParenClose){if(e._i<e.length)return;continue}return}if(!(n.length<3||n.length>4)){if(n.length===4){if(n[3].type!==$.Alpha)return;n[3]=n[3].value}return n.length===3&&n.push({type:$.None,value:void 0}),n.every(o=>o.type!==$.Alpha)?n:void 0}}function Ag(e,t){e._i=0;let n=e[e._i++];if(!n||n.type!==$.Function)return;let r=Cu(e,t);if(r)return r.unshift(n.value),r}const Pg=e=>{if(typeof e!="string")return;const t=Tg(e),n=t?Ag(t,!0):void 0;let r,o=0,i=ao.length;for(;o<i;)if((r=ao[o++](e,n))!==void 0)return r;return t?Cg(t):void 0};function Eg(e,t){if(!t||t[0]!=="rgb"&&t[0]!=="rgba")return;const n={mode:"rgb"},[,r,o,i,s]=t;if(!(r.type===$.Hue||o.type===$.Hue||i.type===$.Hue))return r.type!==$.None&&(n.r=r.type===$.Number?r.value/255:r.value/100),o.type!==$.None&&(n.g=o.type===$.Number?o.value/255:o.value/100),i.type!==$.None&&(n.b=i.type===$.Number?i.value/255:i.value/100),s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const Vg=e=>e==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,Og=(e,t,n)=>e+n*(t-e),Lg=e=>{let t=[];for(let n=0;n<e.length-1;n++){let r=e[n],o=e[n+1];r===void 0&&o===void 0?t.push(void 0):r!==void 0&&o!==void 0?t.push([r,o]):t.push(r!==void 0?[r,r]:[o,o])}return t},A=(e=>t=>{let n=Lg(t);return r=>{let o=r*n.length,i=r>=1?n.length-1:Math.max(Math.floor(o),0),s=n[i];return s===void 0?void 0:e(s[0],s[1],o-i)}})(Og),he=e=>{let t=!1,n=e.map(r=>r!==void 0?(t=!0,r):1);return t?n:e},wn={mode:"rgb",channels:["r","g","b","alpha"],parse:[Eg,gg,_g,mg,Vg,"srgb"],serialize:"srgb",interpolate:{r:A,g:A,b:A,alpha:{use:A,fixup:he}},gamut:!0},as=e=>Math.pow(Math.abs(e),563/256)*Math.sign(e),Au=e=>{let t=as(e.r),n=as(e.g),r=as(e.b),o={mode:"xyz65",x:.5766690429101305*t+.1855582379065463*n+.1882286462349947*r,y:.297344975250536*t+.6273635662554661*n+.0752914584939979*r,z:.0270313613864123*t+.0706888525358272*n+.9913375368376386*r};return e.alpha!==void 0&&(o.alpha=e.alpha),o},cs=e=>Math.pow(Math.abs(e),256/563)*Math.sign(e),Pu=({x:e,y:t,z:n,alpha:r})=>{let o={mode:"a98",r:cs(e*2.0415879038107465-t*.5650069742788597-.3447313507783297*n),g:cs(e*-.9692436362808798+t*1.8759675015077206+.0415550574071756*n),b:cs(e*.0134442806320312-t*.1183623922310184+1.0151749943912058*n)};return r!==void 0&&(o.alpha=r),o},ls=e=>{const t=Math.abs(e);return t<=.04045?e/12.92:(Math.sign(e)||1)*Math.pow((t+.055)/1.055,2.4)},_n=({r:e,g:t,b:n,alpha:r})=>{let o={mode:"lrgb",r:ls(e),g:ls(t),b:ls(n)};return r!==void 0&&(o.alpha=r),o},xn=e=>{let{r:t,g:n,b:r,alpha:o}=_n(e),i={mode:"xyz65",x:.4123907992659593*t+.357584339383878*n+.1804807884018343*r,y:.2126390058715102*t+.715168678767756*n+.0721923153607337*r,z:.0193308187155918*t+.119194779794626*n+.9505321522496607*r};return o!==void 0&&(i.alpha=o),i},us=e=>{const t=Math.abs(e);return t>.0031308?(Math.sign(e)||1)*(1.055*Math.pow(t,1/2.4)-.055):e*12.92},kn=({r:e,g:t,b:n,alpha:r},o="rgb")=>{let i={mode:o,r:us(e),g:us(t),b:us(n)};return r!==void 0&&(i.alpha=r),i},$n=({x:e,y:t,z:n,alpha:r})=>{let o=kn({r:e*3.2409699419045226-t*1.537383177570094-.4986107602930034*n,g:e*-.9692436362808796+t*1.8759675015077204+.0415550574071756*n,b:e*.0556300796969936-t*.2039769588889765+1.0569715142428784*n});return r!==void 0&&(o.alpha=r),o},Ng={...wn,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:e=>Pu(xn(e)),xyz65:Pu},toMode:{rgb:e=>$n(Au(e)),xyz65:Au}},be=e=>(e=e%360)<0?e+360:e,Rg=(e,t)=>e.map((n,r,o)=>{if(n===void 0)return n;let i=be(n);return r===0||e[r-1]===void 0?i:t(i-be(o[r-1]))}).reduce((n,r)=>!n.length||r===void 0||n[n.length-1]===void 0?(n.push(r),n):(n.push(r+n[n.length-1]),n),[]),st=e=>Rg(e,t=>Math.abs(t)<=180?t:t-360*Math.sign(t)),pe=[-.14861,1.78277,-.29227,-.90649,1.97294,0],Ig=Math.PI/180,Fg=180/Math.PI;let Eu=pe[3]*pe[4],Vu=pe[1]*pe[4],Ou=pe[1]*pe[2]-pe[0]*pe[3];const Dg=({r:e,g:t,b:n,alpha:r})=>{let o=(Ou*n+e*Eu-t*Vu)/(Ou+Eu-Vu),i=n-o,s=(pe[4]*(t-o)-pe[2]*i)/pe[3],a={mode:"cubehelix",l:o,s:o===0||o===1?void 0:Math.sqrt(i*i+s*s)/(pe[4]*o*(1-o))};return a.s&&(a.h=Math.atan2(s,i)*Fg-120),r!==void 0&&(a.alpha=r),a},zg=({h:e,s:t,l:n,alpha:r})=>{let o={mode:"rgb"};e=(e===void 0?0:e+120)*Ig;let i=t===void 0?0:t*n*(1-n),s=Math.cos(e),a=Math.sin(e);return o.r=n+i*(pe[0]*s+pe[1]*a),o.g=n+i*(pe[2]*s+pe[3]*a),o.b=n+i*(pe[4]*s+pe[5]*a),r!==void 0&&(o.alpha=r),o},fo=(e,t)=>{if(e.h===void 0||t.h===void 0||!e.s||!t.s)return 0;let n=be(e.h),r=be(t.h),o=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(e.s*t.s)*o},Bg=(e,t)=>{if(e.h===void 0||t.h===void 0)return 0;let n=be(e.h),r=be(t.h);return Math.abs(r-n)>180?n-(r-360*Math.sign(r-n)):r-n},ho=(e,t)=>{if(e.h===void 0||t.h===void 0||!e.c||!t.c)return 0;let n=be(e.h),r=be(t.h),o=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(e.c*t.c)*o},Lu=(e="rgb",t=[1,1,1,0])=>{let n=Wt(e),r=n.channels,o=n.difference,i=it(e);return(s,a)=>{let c=i(s),u=i(a);return Math.sqrt(r.reduce((d,l,f)=>{let h=o[l]?o[l](c,u):c[l]-u[l];return d+(t[f]||0)*Math.pow(isNaN(h)?0:h,2)},0))}},at=e=>{let t=e.reduce((n,r)=>{if(r!==void 0){let o=r*Math.PI/180;n.sin+=Math.sin(o),n.cos+=Math.cos(o)}return n},{sin:0,cos:0});return Math.atan2(t.sin,t.cos)*180/Math.PI},jg={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:Dg},toMode:{rgb:zg},interpolate:{h:{use:A,fixup:st},s:A,l:A,alpha:{use:A,fixup:he}},difference:{h:fo},average:{h:at}},St=({l:e,a:t,b:n,alpha:r},o="lch")=>{let i=Math.sqrt(t*t+n*n),s={mode:o,l:e,c:i};return i&&(s.h=be(Math.atan2(n,t)*180/Math.PI)),r!==void 0&&(s.alpha=r),s},Mt=({l:e,c:t,h:n,alpha:r},o="lab")=>{let i={mode:o,l:e,a:t?t*Math.cos(n/180*Math.PI):0,b:t?t*Math.sin(n/180*Math.PI):0};return r!==void 0&&(i.alpha=r),i},Nu=Math.pow(29,3)/Math.pow(3,3),Ru=Math.pow(6,3)/Math.pow(29,3),ce={X:.3457/.3585,Y:1,Z:(1-.3457-.3585)/.3585},Sn={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329};let ds=e=>Math.pow(e,3)>Ru?Math.pow(e,3):(116*e-16)/Nu;const Iu=({l:e,a:t,b:n,alpha:r})=>{let o=(e+16)/116,i=t/500+o,s=o-n/200,a={mode:"xyz65",x:ds(i)*Sn.X,y:ds(o)*Sn.Y,z:ds(s)*Sn.Z};return r!==void 0&&(a.alpha=r),a},po=e=>$n(Iu(e)),fs=e=>e>Ru?Math.cbrt(e):(Nu*e+16)/116,Fu=({x:e,y:t,z:n,alpha:r})=>{let o=fs(e/Sn.X),i=fs(t/Sn.Y),s=fs(n/Sn.Z),a={mode:"lab65",l:116*i-16,a:500*(o-i),b:200*(i-s)};return r!==void 0&&(a.alpha=r),a},mo=e=>{let t=Fu(xn(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},vo=1,Du=1,ir=26/180*Math.PI,go=Math.cos(ir),bo=Math.sin(ir),zu=100/Math.log(139/100),hs=({l:e,c:t,h:n,alpha:r})=>{let o={mode:"lab65",l:(Math.exp(e*vo/zu)-1)/.0039};if(n===void 0)o.a=o.b=0;else{let i=(Math.exp(.0435*t*Du*vo)-1)/.075,s=i*Math.cos(n/180*Math.PI-ir),a=i*Math.sin(n/180*Math.PI-ir);o.a=s*go-a/.83*bo,o.b=s*bo+a/.83*go}return r!==void 0&&(o.alpha=r),o},ps=({l:e,a:t,b:n,alpha:r})=>{let o=t*go+n*bo,i=.83*(n*go-t*bo),s=Math.sqrt(o*o+i*i),a={mode:"dlch",l:zu/vo*Math.log(1+.0039*e),c:Math.log(1+.075*s)/(.0435*Du*vo)};return a.c&&(a.h=be((Math.atan2(i,o)+ir)/Math.PI*180)),r!==void 0&&(a.alpha=r),a},Bu=e=>hs(St(e,"dlch")),ju=e=>Mt(ps(e),"dlab"),Hg={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:Bu,rgb:e=>po(Bu(e))},fromMode:{lab65:ju,rgb:e=>ju(mo(e))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:A,a:A,b:A,alpha:{use:A,fixup:he}}},Ug={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:hs,dlab:e=>Mt(e,"dlab"),rgb:e=>po(hs(e))},fromMode:{lab65:ps,dlab:e=>St(e,"dlch"),rgb:e=>ps(mo(e))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:A,c:A,h:{use:A,fixup:st},alpha:{use:A,fixup:he}},difference:{h:ho},average:{h:at}};function Xg({h:e,s:t,i:n,alpha:r}){e=be(e);let o=Math.abs(e/60%2-1),i;switch(Math.floor(e/60)){case 0:i={r:n*(1+t*(3/(2-o)-1)),g:n*(1+t*(3*(1-o)/(2-o)-1)),b:n*(1-t)};break;case 1:i={r:n*(1+t*(3*(1-o)/(2-o)-1)),g:n*(1+t*(3/(2-o)-1)),b:n*(1-t)};break;case 2:i={r:n*(1-t),g:n*(1+t*(3/(2-o)-1)),b:n*(1+t*(3*(1-o)/(2-o)-1))};break;case 3:i={r:n*(1-t),g:n*(1+t*(3*(1-o)/(2-o)-1)),b:n*(1+t*(3/(2-o)-1))};break;case 4:i={r:n*(1+t*(3*(1-o)/(2-o)-1)),g:n*(1-t),b:n*(1+t*(3/(2-o)-1))};break;case 5:i={r:n*(1+t*(3/(2-o)-1)),g:n*(1-t),b:n*(1+t*(3*(1-o)/(2-o)-1))};break;default:i={r:n*(1-t),g:n*(1-t),b:n*(1-t)}}return i.mode="rgb",r!==void 0&&(i.alpha=r),i}function qg({r:e,g:t,b:n,alpha:r}){let o=Math.max(e,t,n),i=Math.min(e,t,n),s={mode:"hsi",s:e+t+n===0?0:1-3*i/(e+t+n),i:(e+t+n)/3};return o-i!==0&&(s.h=(o===e?(t-n)/(o-i)+(t<n)*6:o===t?(n-e)/(o-i)+2:(e-t)/(o-i)+4)*60),r!==void 0&&(s.alpha=r),s}const Wg={mode:"hsi",toMode:{rgb:Xg},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:qg},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:A,fixup:st},s:A,i:A,alpha:{use:A,fixup:he}},difference:{h:fo},average:{h:at}};function Kg({h:e,s:t,l:n,alpha:r}){e=be(e);let o=n+t*(n<.5?n:1-n),i=o-(o-n)*2*Math.abs(e/60%2-1),s;switch(Math.floor(e/60)){case 0:s={r:o,g:i,b:2*n-o};break;case 1:s={r:i,g:o,b:2*n-o};break;case 2:s={r:2*n-o,g:o,b:i};break;case 3:s={r:2*n-o,g:i,b:o};break;case 4:s={r:i,g:2*n-o,b:o};break;case 5:s={r:o,g:2*n-o,b:i};break;default:s={r:2*n-o,g:2*n-o,b:2*n-o}}return s.mode="rgb",r!==void 0&&(s.alpha=r),s}function Yg({r:e,g:t,b:n,alpha:r}){let o=Math.max(e,t,n),i=Math.min(e,t,n),s={mode:"hsl",s:o===i?0:(o-i)/(1-Math.abs(o+i-1)),l:.5*(o+i)};return o-i!==0&&(s.h=(o===e?(t-n)/(o-i)+(t<n)*6:o===t?(n-e)/(o-i)+2:(e-t)/(o-i)+4)*60),r!==void 0&&(s.alpha=r),s}const Gg=(e,t)=>{switch(t){case"deg":return+e;case"rad":return e/Math.PI*180;case"grad":return e/10*9;case"turn":return e*360}},Zg=new RegExp(`^hsla?\\(\\s*${bg}${yn}${nr}${yn}${nr}\\s*(?:,\\s*${os}\\s*)?\\)$`),Jg=e=>{let t=e.match(Zg);if(!t)return;let n={mode:"hsl"};return t[3]!==void 0?n.h=+t[3]:t[1]!==void 0&&t[2]!==void 0&&(n.h=Gg(t[1],t[2])),t[4]!==void 0&&(n.s=Math.min(Math.max(0,t[4]/100),1)),t[5]!==void 0&&(n.l=Math.min(Math.max(0,t[5]/100),1)),t[6]!==void 0?n.alpha=t[6]/100:t[7]!==void 0&&(n.alpha=+t[7]),n};function Qg(e,t){if(!t||t[0]!=="hsl"&&t[0]!=="hsla")return;const n={mode:"hsl"},[,r,o,i,s]=t;if(r.type!==$.None){if(r.type===$.Percentage)return;n.h=r.value}if(o.type!==$.None){if(o.type===$.Hue)return;n.s=o.type===$.Number?o.value:o.value/100}if(i.type!==$.None){if(i.type===$.Hue)return;n.l=i.type===$.Number?i.value:i.value/100}return s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const Hu={mode:"hsl",toMode:{rgb:Kg},fromMode:{rgb:Yg},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[Qg,Jg],serialize:e=>`hsl(${e.h||0} ${e.s!==void 0?e.s*100+"%":"none"} ${e.l!==void 0?e.l*100+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:A,fixup:st},s:A,l:A,alpha:{use:A,fixup:he}},difference:{h:fo},average:{h:at}};function Uu({h:e,s:t,v:n,alpha:r}){e=be(e);let o=Math.abs(e/60%2-1),i;switch(Math.floor(e/60)){case 0:i={r:n,g:n*(1-t*o),b:n*(1-t)};break;case 1:i={r:n*(1-t*o),g:n,b:n*(1-t)};break;case 2:i={r:n*(1-t),g:n,b:n*(1-t*o)};break;case 3:i={r:n*(1-t),g:n*(1-t*o),b:n};break;case 4:i={r:n*(1-t*o),g:n*(1-t),b:n};break;case 5:i={r:n,g:n*(1-t),b:n*(1-t*o)};break;default:i={r:n*(1-t),g:n*(1-t),b:n*(1-t)}}return i.mode="rgb",r!==void 0&&(i.alpha=r),i}function Xu({r:e,g:t,b:n,alpha:r}){let o=Math.max(e,t,n),i=Math.min(e,t,n),s={mode:"hsv",s:o===0?0:1-i/o,v:o};return o-i!==0&&(s.h=(o===e?(t-n)/(o-i)+(t<n)*6:o===t?(n-e)/(o-i)+2:(e-t)/(o-i)+4)*60),r!==void 0&&(s.alpha=r),s}const qu={mode:"hsv",toMode:{rgb:Uu},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:Xu},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:A,fixup:st},s:A,v:A,alpha:{use:A,fixup:he}},difference:{h:fo},average:{h:at}};function e1({h:e,w:t,b:n,alpha:r}){if(t+n>1){let o=t+n;t/=o,n/=o}return Uu({h:e,s:n===1?1:1-t/(1-n),v:1-n,alpha:r})}function t1(e){let t=Xu(e);if(t===void 0)return;let n={mode:"hwb",w:(1-t.s)*t.v,b:1-t.v};return t.h!==void 0&&(n.h=t.h),t.alpha!==void 0&&(n.alpha=t.alpha),n}function n1(e,t){if(!t||t[0]!=="hwb")return;const n={mode:"hwb"},[,r,o,i,s]=t;if(r.type!==$.None){if(r.type===$.Percentage)return;n.h=r.value}if(o.type!==$.None){if(o.type===$.Hue)return;n.w=o.type===$.Number?o.value:o.value/100}if(i.type!==$.None){if(i.type===$.Hue)return;n.b=i.type===$.Number?i.value:i.value/100}return s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const r1={mode:"hwb",toMode:{rgb:e1},fromMode:{rgb:t1},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[n1],serialize:e=>`hwb(${e.h||0} ${e.w*100}% ${e.b*100}%${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:A,fixup:st},w:A,b:A,alpha:{use:A,fixup:he}},difference:{h:Bg},average:{h:at}},o1=.1593017578125,i1=134.03437499999998,s1=.8359375,a1=18.8515625,c1=18.6875,l1=16295499532821565e-27,ms=e=>{let t=Math.pow(e/1e4,o1);return Math.pow((s1+a1*t)/(1+c1*t),i1)||0},vs=e=>Math.max(e*203,0),Wu=({x:e,y:t,z:n,alpha:r})=>{e=vs(e),t=vs(t),n=vs(n);let o=1.15*e-.15*n,i=.66*t+.34*e,s=ms(.41478972*o+.579999*i+.014648*n),a=ms(-.20151*o+1.120649*i+.0531008*n),c=ms(-.0166008*o+.2648*i+.6684799*n),u=(s+a)/2,d={mode:"jab",j:.44*u/(1-.56*u)-l1,a:3.524*s-4.066708*a+.542708*c,b:.199076*s+1.096799*a-1.295875*c};return r!==void 0&&(d.alpha=r),d},u1=.1593017578125,d1=134.03437499999998,f1=.8359375,h1=18.8515625,p1=18.6875,Ku=16295499532821565e-27,gs=e=>{let t=Math.pow(e,1/d1);return 1e4*Math.pow((f1-t)/(p1*t-h1),1/u1)||0},bs=e=>e/203,Yu=({j:e,a:t,b:n,alpha:r})=>{let o=(e+Ku)/(.44+.56*(e+Ku)),i=gs(o+.13860504*t+.058047316*n),s=gs(o-.13860504*t-.058047316*n),a=gs(o-.096019242*t-.8118919*n),c={mode:"xyz65",x:bs(1.661373024652174*i-.914523081304348*s+.23136208173913045*a),y:bs(-.3250758611844533*i+1.571847026732543*s-.21825383453227928*a),z:bs(-.090982811*i-.31272829*s+1.5227666*a)};return r!==void 0&&(c.alpha=r),c},Gu=e=>{let t=Wu(xn(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},Zu=e=>$n(Yu(e)),m1={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:Gu,xyz65:Wu},toMode:{rgb:Zu,xyz65:Yu},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:A,a:A,b:A,alpha:{use:A,fixup:he}}},Ju=({j:e,a:t,b:n,alpha:r})=>{let o=Math.sqrt(t*t+n*n),i={mode:"jch",j:e,c:o};return o&&(i.h=be(Math.atan2(n,t)*180/Math.PI)),r!==void 0&&(i.alpha=r),i},Qu=({j:e,c:t,h:n,alpha:r})=>{let o={mode:"jab",j:e,a:t?t*Math.cos(n/180*Math.PI):0,b:t?t*Math.sin(n/180*Math.PI):0};return r!==void 0&&(o.alpha=r),o},v1={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:Qu,rgb:e=>Zu(Qu(e))},fromMode:{rgb:e=>Ju(Gu(e)),jab:Ju},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:A,fixup:st},c:A,j:A,alpha:{use:A,fixup:he}},difference:{h:ho},average:{h:at}},yo=Math.pow(29,3)/Math.pow(3,3),ys=Math.pow(6,3)/Math.pow(29,3);let ws=e=>Math.pow(e,3)>ys?Math.pow(e,3):(116*e-16)/yo;const _s=({l:e,a:t,b:n,alpha:r})=>{let o=(e+16)/116,i=t/500+o,s=o-n/200,a={mode:"xyz50",x:ws(i)*ce.X,y:ws(o)*ce.Y,z:ws(s)*ce.Z};return r!==void 0&&(a.alpha=r),a},sr=({x:e,y:t,z:n,alpha:r})=>{let o=kn({r:e*3.1341359569958707-t*1.6173863321612538-.4906619460083532*n,g:e*-.978795502912089+t*1.916254567259524+.03344273116131949*n,b:e*.07195537988411677-t*.2289768264158322+1.405386058324125*n});return r!==void 0&&(o.alpha=r),o},ed=e=>sr(_s(e)),ar=e=>{let{r:t,g:n,b:r,alpha:o}=_n(e),i={mode:"xyz50",x:.436065742824811*t+.3851514688337912*n+.14307845442264197*r,y:.22249319175623702*t+.7168870538238823*n+.06061979053616537*r,z:.013923904500943465*t+.09708128566574634*n+.7140993584005155*r};return o!==void 0&&(i.alpha=o),i},xs=e=>e>ys?Math.cbrt(e):(yo*e+16)/116,ks=({x:e,y:t,z:n,alpha:r})=>{let o=xs(e/ce.X),i=xs(t/ce.Y),s=xs(n/ce.Z),a={mode:"lab",l:116*i-16,a:500*(o-i),b:200*(i-s)};return r!==void 0&&(a.alpha=r),a},td=e=>{let t=ks(ar(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t};function g1(e,t){if(!t||t[0]!=="lab")return;const n={mode:"lab"},[,r,o,i,s]=t;if(!(r.type===$.Hue||o.type===$.Hue||i.type===$.Hue))return r.type!==$.None&&(n.l=r.value),o.type!==$.None&&(n.a=o.type===$.Number?o.value:o.value*125/100),i.type!==$.None&&(n.b=i.type===$.Number?i.value:i.value*125/100),s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const $s={mode:"lab",toMode:{xyz50:_s,rgb:ed},fromMode:{xyz50:ks,rgb:td},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-100,100],b:[-100,100]},parse:[g1],serialize:e=>`lab(${e.l!==void 0?e.l:"none"} ${e.a!==void 0?e.a:"none"} ${e.b!==void 0?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{l:A,a:A,b:A,alpha:{use:A,fixup:he}}},b1={...$s,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:Iu,rgb:po},fromMode:{xyz65:Fu,rgb:mo},ranges:{l:[0,100],a:[-86.182,98.234],b:[-107.86,94.477]}};function y1(e,t){if(!t||t[0]!=="lch")return;const n={mode:"lch"},[,r,o,i,s]=t;if(r.type!==$.None){if(r.type===$.Hue)return;n.l=r.value}if(o.type!==$.None&&(n.c=Math.max(0,o.type===$.Number?o.value:o.value*150/100)),i.type!==$.None){if(i.type===$.Percentage)return;n.h=i.value}return s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const Ss={mode:"lch",toMode:{lab:Mt,rgb:e=>ed(Mt(e))},fromMode:{rgb:e=>St(td(e)),lab:St},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[y1],serialize:e=>`lch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h||0}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:A,fixup:st},c:A,l:A,alpha:{use:A,fixup:he}},difference:{h:ho},average:{h:at}},w1={...Ss,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:e=>Mt(e,"lab65"),rgb:e=>po(Mt(e,"lab65"))},fromMode:{rgb:e=>St(mo(e),"lch65"),lab65:e=>St(e,"lch65")},ranges:{l:[0,100],c:[0,133.807],h:[0,360]}},nd=({l:e,u:t,v:n,alpha:r})=>{let o=Math.sqrt(t*t+n*n),i={mode:"lchuv",l:e,c:o};return o&&(i.h=be(Math.atan2(n,t)*180/Math.PI)),r!==void 0&&(i.alpha=r),i},rd=({l:e,c:t,h:n,alpha:r})=>{let o={mode:"luv",l:e,u:t?t*Math.cos(n/180*Math.PI):0,v:t?t*Math.sin(n/180*Math.PI):0};return r!==void 0&&(o.alpha=r),o},od=(e,t,n)=>4*e/(e+15*t+3*n),id=(e,t,n)=>9*t/(e+15*t+3*n),_1=od(ce.X,ce.Y,ce.Z),x1=id(ce.X,ce.Y,ce.Z),k1=e=>e<=ys?yo*e:116*Math.cbrt(e)-16,Ms=({x:e,y:t,z:n,alpha:r})=>{let o=k1(t/ce.Y),i=od(e,t,n),s=id(e,t,n);!isFinite(i)||!isFinite(s)?o=i=s=0:(i=13*o*(i-_1),s=13*o*(s-x1));let a={mode:"luv",l:o,u:i,v:s};return r!==void 0&&(a.alpha=r),a},$1=(e,t,n)=>4*e/(e+15*t+3*n),S1=(e,t,n)=>9*t/(e+15*t+3*n),M1=$1(ce.X,ce.Y,ce.Z),T1=S1(ce.X,ce.Y,ce.Z),Ts=({l:e,u:t,v:n,alpha:r})=>{let o=t/(13*e)+M1,i=n/(13*e)+T1,s=ce.Y*(e<=8?e/yo:Math.pow((e+16)/116,3)),a=s*(9*o)/(4*i),c=s*(12-3*o-20*i)/(4*i),u={mode:"xyz50",x:a,y:s,z:c};return r!==void 0&&(u.alpha=r),u},C1={mode:"lchuv",toMode:{luv:rd,rgb:e=>sr(Ts(rd(e)))},fromMode:{rgb:e=>nd(Ms(ar(e))),luv:nd},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:A,fixup:st},c:A,l:A,alpha:{use:A,fixup:he}},difference:{h:ho},average:{h:at}},A1={...wn,mode:"lrgb",toMode:{rgb:kn},fromMode:{rgb:_n},parse:["srgb-linear"],serialize:"srgb-linear"},P1={mode:"luv",toMode:{xyz50:Ts,rgb:e=>sr(Ts(e))},fromMode:{xyz50:Ms,rgb:e=>Ms(ar(e))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:A,u:A,v:A,alpha:{use:A,fixup:he}}},sd=({r:e,g:t,b:n,alpha:r})=>{let o=Math.cbrt(.41222147079999993*e+.5363325363*t+.0514459929*n),i=Math.cbrt(.2119034981999999*e+.6806995450999999*t+.1073969566*n),s=Math.cbrt(.08830246189999998*e+.2817188376*t+.6299787005000002*n),a={mode:"oklab",l:.2104542553*o+.793617785*i-.0040720468*s,a:1.9779984951*o-2.428592205*i+.4505937099*s,b:.0259040371*o+.7827717662*i-.808675766*s};return r!==void 0&&(a.alpha=r),a},wo=e=>{let t=sd(_n(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},cr=({l:e,a:t,b:n,alpha:r})=>{let o=Math.pow(e*.9999999984505198+.39633779217376786*t+.2158037580607588*n,3),i=Math.pow(e*1.0000000088817609-.10556134232365635*t-.06385417477170591*n,3),s=Math.pow(e*1.0000000546724108-.08948418209496575*t-1.2914855378640917*n,3),a={mode:"lrgb",r:4.076741661347994*o-3.307711590408193*i+.230969928729428*s,g:-1.2684380040921763*o+2.6097574006633715*i-.3413193963102197*s,b:-.004196086541837188*o-.7034186144594493*i+1.7076147009309444*s};return r!==void 0&&(a.alpha=r),a},_o=e=>kn(cr(e));function Cs(e){const r=1.170873786407767;return .5*(r*e-.206+Math.sqrt((r*e-.206)*(r*e-.206)+4*.03*r*e))}function xo(e){const r=1.170873786407767;return(e*e+.206*e)/(r*(e+.03))}function E1(e,t){let n,r,o,i,s,a,c,u;-1.88170328*e-.80936493*t>1?(n=1.19086277,r=1.76576728,o=.59662641,i=.75515197,s=.56771245,a=4.0767416621,c=-3.3077115913,u=.2309699292):1.81444104*e-1.19445276*t>1?(n=.73956515,r=-.45954404,o=.08285427,i=.1254107,s=.14503204,a=-1.2684380046,c=2.6097574011,u=-.3413193965):(n=1.35733652,r=-.00915799,o=-1.1513021,i=-.50559606,s=.00692167,a=-.0041960863,c=-.7034186147,u=1.707614701);let d=n+r*e+o*t+i*e*e+s*e*t,l=.3963377774*e+.2158037573*t,f=-.1055613458*e-.0638541728*t,h=-.0894841775*e-1.291485548*t;{let p=1+d*l,m=1+d*f,y=1+d*h,x=p*p*p,g=m*m*m,w=y*y*y,M=3*l*p*p,S=3*f*m*m,I=3*h*y*y,N=6*l*l*p,C=6*f*f*m,E=6*h*h*y,q=a*x+c*g+u*w,K=a*M+c*S+u*I,j=a*N+c*C+u*E;d=d-q*K/(K*K-.5*q*j)}return d}function As(e,t){let n=E1(e,t),r=cr({l:1,a:n*e,b:n*t}),o=Math.cbrt(1/Math.max(r.r,r.g,r.b)),i=o*n;return[o,i]}function V1(e,t,n,r,o,i=null){i||(i=As(e,t));let s;if((n-o)*i[1]-(i[0]-o)*r<=0)s=i[1]*o/(r*i[0]+i[1]*(o-n));else{s=i[1]*(o-1)/(r*(i[0]-1)+i[1]*(o-n));{let a=n-o,c=r,u=.3963377774*e+.2158037573*t,d=-.1055613458*e-.0638541728*t,l=-.0894841775*e-1.291485548*t,f=a+c*u,h=a+c*d,p=a+c*l;{let m=o*(1-s)+s*n,y=s*r,x=m+y*u,g=m+y*d,w=m+y*l,M=x*x*x,S=g*g*g,I=w*w*w,N=3*f*x*x,C=3*h*g*g,E=3*p*w*w,q=6*f*f*x,K=6*h*h*g,j=6*p*p*w,B=4.0767416621*M-3.3077115913*S+.2309699292*I-1,H=4.0767416621*N-3.3077115913*C+.2309699292*E,X=4.0767416621*q-3.3077115913*K+.2309699292*j,re=H/(H*H-.5*B*X),se=-B*re,Le=-1.2684380046*M+2.6097574011*S-.3413193965*I-1,Ne=-1.2684380046*N+2.6097574011*C-.3413193965*E,ut=-1.2684380046*q+2.6097574011*K-.3413193965*j,Y=Ne/(Ne*Ne-.5*Le*ut),Re=-Le*Y,At=-.0041960863*M-.7034186147*S+1.707614701*I-1,Pt=-.0041960863*N-.7034186147*C+1.707614701*E,Gt=-.0041960863*q-.7034186147*K+1.707614701*j,Ge=Pt/(Pt*Pt-.5*At*Gt),Ze=-At*Ge;se=re>=0?se:1e6,Re=Y>=0?Re:1e6,Ze=Ge>=0?Ze:1e6,s+=Math.min(se,Math.min(Re,Ze))}}}return s}function Ps(e,t,n=null){n||(n=As(e,t));let r=n[0],o=n[1];return[o/r,o/(1-r)]}function ad(e,t,n){let r=As(t,n),o=V1(t,n,e,1,e,r),i=Ps(t,n,r),s=.11516993+1/(7.4477897+4.1590124*n+t*(-2.19557347+1.75198401*n+t*(-2.13704948-10.02301043*n+t*(-4.24894561+5.38770819*n+4.69891013*t)))),a=.11239642+1/(1.6132032-.68124379*n+t*(.40370612+.90148123*n+t*(-.27087943+.6122399*n+t*(.00299215-.45399568*n-.14661872*t)))),c=o/Math.min(e*i[0],(1-e)*i[1]),u=e*s,d=(1-e)*a,l=.9*c*Math.sqrt(Math.sqrt(1/(1/(u*u*u*u)+1/(d*d*d*d))));return u=e*.4,d=(1-e)*.8,[Math.sqrt(1/(1/(u*u)+1/(d*d))),l,o]}function cd(e){const t={mode:"okhsl",l:Cs(e.l)};e.alpha!==void 0&&(t.alpha=e.alpha);let n=Math.sqrt(e.a*e.a+e.b*e.b);if(!n)return t.s=0,t;let[r,o,i]=ad(e.l,e.a/n,e.b/n),s;if(n<o){let a=0,c=.8*r,u=1-c/o;s=(n-a)/(c+u*(n-a))*.8}else{let a=o,c=.2*o*o*1.25*1.25/r,u=1-c/(i-o);s=.8+.2*((n-a)/(c+u*(n-a)))}return s&&(t.s=s,t.h=be(Math.atan2(e.b,e.a)*180/Math.PI)),t}function ld(e){let t=xo(e.l);const n={mode:"oklab",l:t};if(e.alpha!==void 0&&(n.alpha=e.alpha),!e.s||e.l===1)return n.a=n.b=0,n;let r=Math.cos(e.h/180*Math.PI),o=Math.sin(e.h/180*Math.PI),[i,s,a]=ad(t,r,o),c,u,d,l;e.s<.8?(c=1.25*e.s,u=0,d=.8*i,l=1-d/s):(c=5*(e.s-.8),u=s,d=.2*s*s*1.25*1.25/i,l=1-d/(a-s));let f=u+c*d/(1-l*c);return n.a=f*r,n.b=f*o,n}const O1={...Hu,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:cd,rgb:e=>cd(wo(e))},toMode:{oklab:ld,rgb:e=>_o(ld(e))}};function ud(e){let t=Math.sqrt(e.a*e.a+e.b*e.b),n=e.l,r=t?e.a/t:1,o=t?e.b/t:1,[i,s]=Ps(r,o),a=.5,c=1-a/i,u=s/(t+n*s),d=u*n,l=u*t,f=xo(d),h=l*f/d,p=cr({l:f,a:r*h,b:o*h}),m=Math.cbrt(1/Math.max(p.r,p.g,p.b,0));n=n/m,t=t/m*Cs(n)/n,n=Cs(n);const y={mode:"okhsv",s:t?(a+s)*l/(s*a+s*c*l):0,v:n?n/d:0};return y.s&&(y.h=be(Math.atan2(e.b,e.a)*180/Math.PI)),e.alpha!==void 0&&(y.alpha=e.alpha),y}function dd(e){const t={mode:"oklab"};e.alpha!==void 0&&(t.alpha=e.alpha);const n=e.h||0,r=Math.cos(n/180*Math.PI),o=Math.sin(n/180*Math.PI),[i,s]=Ps(r,o),a=.5,c=1-a/i,u=1-e.s*a/(a+s-s*c*e.s),d=e.s*s*a/(a+s-s*c*e.s),l=xo(u),f=d*l/u,h=cr({l,a:r*f,b:o*f}),p=Math.cbrt(1/Math.max(h.r,h.g,h.b,0)),m=xo(e.v*u),y=d*m/u;return t.l=m*p,t.a=y*r*p,t.b=y*o*p,t}const L1={...qu,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:ud,rgb:e=>ud(wo(e))},toMode:{oklab:dd,rgb:e=>_o(dd(e))}};function N1(e,t){if(!t||t[0]!=="oklab")return;const n={mode:"oklab"},[,r,o,i,s]=t;if(!(r.type===$.Hue||o.type===$.Hue||i.type===$.Hue))return r.type!==$.None&&(n.l=r.type===$.Number?r.value:r.value/100),o.type!==$.None&&(n.a=o.type===$.Number?o.value:o.value*.4/100),i.type!==$.None&&(n.b=i.type===$.Number?i.value:i.value*.4/100),s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const R1={...$s,mode:"oklab",toMode:{lrgb:cr,rgb:_o},fromMode:{lrgb:sd,rgb:wo},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[N1],serialize:e=>`oklab(${e.l!==void 0?e.l:"none"} ${e.a!==void 0?e.a:"none"} ${e.b!==void 0?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`};function I1(e,t){if(!t||t[0]!=="oklch")return;const n={mode:"oklch"},[,r,o,i,s]=t;if(r.type!==$.None){if(r.type===$.Hue)return;n.l=r.type===$.Number?r.value:r.value/100}if(o.type!==$.None&&(n.c=Math.max(0,o.type===$.Number?o.value:o.value*.4/100)),i.type!==$.None){if(i.type===$.Percentage)return;n.h=i.value}return s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const F1={...Ss,mode:"oklch",toMode:{oklab:e=>Mt(e,"oklab"),rgb:e=>_o(Mt(e,"oklab"))},fromMode:{rgb:e=>St(wo(e),"oklch"),oklab:e=>St(e,"oklch")},parse:[I1],serialize:e=>`oklch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h||0}${e.alpha<1?` / ${e.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},fd=e=>{let{r:t,g:n,b:r,alpha:o}=_n(e),i={mode:"xyz65",x:.486570948648216*t+.265667693169093*n+.1982172852343625*r,y:.2289745640697487*t+.6917385218365062*n+.079286914093745*r,z:0*t+.0451133818589026*n+1.043944368900976*r};return o!==void 0&&(i.alpha=o),i},hd=({x:e,y:t,z:n,alpha:r})=>{let o=kn({r:e*2.4934969119414263-t*.9313836179191242-.402710784450717*n,g:e*-.8294889695615749+t*1.7626640603183465+.0236246858419436*n,b:e*.0358458302437845-t*.0761723892680418+.9568845240076871*n},"p3");return r!==void 0&&(o.alpha=r),o},D1={...wn,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:e=>hd(xn(e)),xyz65:hd},toMode:{rgb:e=>$n(fd(e)),xyz65:fd}},Es=e=>{let t=Math.abs(e);return t>=1/512?Math.sign(e)*Math.pow(t,1/1.8):16*e},pd=({x:e,y:t,z:n,alpha:r})=>{let o={mode:"prophoto",r:Es(e*1.3457868816471585-t*.2555720873797946-.0511018649755453*n),g:Es(e*-.5446307051249019+t*1.5082477428451466+.0205274474364214*n),b:Es(e*0+t*0+1.2119675456389452*n)};return r!==void 0&&(o.alpha=r),o},Vs=e=>{let t=Math.abs(e);return t>=16/512?Math.sign(e)*Math.pow(t,1.8):e/16},md=e=>{let t=Vs(e.r),n=Vs(e.g),r=Vs(e.b),o={mode:"xyz50",x:.7977666449006423*t+.1351812974005331*n+.0313477341283922*r,y:.2880748288194013*t+.7118352342418731*n+899369387256e-16*r,z:0*t+0*n+.8251046025104602*r};return e.alpha!==void 0&&(o.alpha=e.alpha),o},z1={...wn,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:pd,rgb:e=>pd(ar(e))},toMode:{xyz50:md,rgb:e=>sr(md(e))}},vd=1.09929682680944,B1=.018053968510807,Os=e=>{const t=Math.abs(e);return t>B1?(Math.sign(e)||1)*(vd*Math.pow(t,.45)-(vd-1)):4.5*e},gd=({x:e,y:t,z:n,alpha:r})=>{let o={mode:"rec2020",r:Os(e*1.7166511879712683-t*.3556707837763925-.2533662813736599*n),g:Os(e*-.6666843518324893+t*1.6164812366349395+.0157685458139111*n),b:Os(e*.0176398574453108-t*.0427706132578085+.9421031212354739*n)};return r!==void 0&&(o.alpha=r),o},bd=1.09929682680944,j1=.018053968510807,Ls=e=>{let t=Math.abs(e);return t<j1*4.5?e/4.5:(Math.sign(e)||1)*Math.pow((t+bd-1)/bd,1/.45)},yd=e=>{let t=Ls(e.r),n=Ls(e.g),r=Ls(e.b),o={mode:"xyz65",x:.6369580483012911*t+.1446169035862083*n+.1688809751641721*r,y:.262700212011267*t+.6779980715188708*n+.059301716469862*r,z:0*t+.0280726930490874*n+1.0609850577107909*r};return e.alpha!==void 0&&(o.alpha=e.alpha),o},H1={...wn,mode:"rec2020",fromMode:{xyz65:gd,rgb:e=>gd(xn(e))},toMode:{xyz65:yd,rgb:e=>$n(yd(e))},parse:["rec2020"],serialize:"rec2020"},Kt=.0037930732552754493,wd=Math.cbrt(Kt),Ns=e=>Math.cbrt(e)-wd,U1=e=>{const{r:t,g:n,b:r,alpha:o}=_n(e),i=Ns(.3*t+.622*n+.078*r+Kt),s=Ns(.23*t+.692*n+.078*r+Kt),a=Ns(.2434226892454782*t+.2047674442449682*n+.5518098665095535*r+Kt),c={mode:"xyb",x:(i-s)/2,y:(i+s)/2,b:a-(i+s)/2};return o!==void 0&&(c.alpha=o),c},Rs=e=>Math.pow(e+wd,3),X1={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:({x:e,y:t,b:n,alpha:r})=>{const o=Rs(e+t)-Kt,i=Rs(t-e)-Kt,s=Rs(n+t)-Kt,a=kn({r:11.031566904639861*o-9.866943908131562*i-.16462299650829934*s,g:-3.2541473810744237*o+4.418770377582723*i-.16462299650829934*s,b:-3.6588512867136815*o+2.7129230459360922*i+1.9459282407775895*s});return r!==void 0&&(a.alpha=r),a}},fromMode:{rgb:U1},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:A,y:A,b:A,alpha:{use:A,fixup:he}}},q1={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:sr,lab:ks},fromMode:{rgb:ar,lab:_s},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:A,y:A,z:A,alpha:{use:A,fixup:he}}},W1={mode:"xyz65",toMode:{rgb:$n,xyz50:e=>{let{x:t,y:n,z:r,alpha:o}=e,i={mode:"xyz50",x:1.0479298208405488*t+.0229467933410191*n-.0501922295431356*r,y:.0296278156881593*t+.990434484573249*n-.0170738250293851*r,z:-.0092430581525912*t+.0150551448965779*n+.7518742899580008*r};return o!==void 0&&(i.alpha=o),i}},fromMode:{rgb:xn,xyz50:e=>{let{x:t,y:n,z:r,alpha:o}=e,i={mode:"xyz65",x:.9554734527042182*t-.0230985368742614*n+.0632593086610217*r,y:-.0283697069632081*t+1.0099954580058226*n+.021041398966943*r,z:.0123140016883199*t-.0205076964334779*n+1.3303659366080753*r};return o!==void 0&&(i.alpha=o),i}},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:A,y:A,z:A,alpha:{use:A,fixup:he}}},K1={mode:"yiq",toMode:{rgb:({y:e,i:t,q:n,alpha:r})=>{const o={mode:"rgb",r:e+.95608445*t+.6208885*n,g:e-.27137664*t-.6486059*n,b:e-1.10561724*t+1.70250126*n};return r!==void 0&&(o.alpha=r),o}},fromMode:{rgb:({r:e,g:t,b:n,alpha:r})=>{const o={mode:"yiq",y:.29889531*e+.58662247*t+.11448223*n,i:.59597799*e-.2741761*t-.32180189*n,q:.21147017*e-.52261711*t+.31114694*n};return r!==void 0&&(o.alpha=r),o}},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:A,i:A,q:A,alpha:{use:A,fixup:he}}},Y1=(e,t)=>Math.round(e*(t=Math.pow(10,t)))/t;((e=4)=>t=>typeof t=="number"?Y1(t,e):t)(2);const G1=e=>{const t=rr(e);if(!t)return;const n=Wt(t.mode);if(!n.serialize||typeof n.serialize=="string"){let r=`color(${n.serialize||`--${t.mode}`} `;return n.channels.forEach((o,i)=>{o!=="alpha"&&(r+=(i?" ":"")+(t[o]!==void 0?t[o]:"none"))}),t.alpha!==void 0&&t.alpha<1&&(r+=` / ${t.alpha}`),r+")"}if(typeof n.serialize=="function")return n.serialize(t)};it("rgb");const Z1=e=>{const t={mode:e.mode,r:Math.max(0,Math.min(e.r,1)),g:Math.max(0,Math.min(e.g,1)),b:Math.max(0,Math.min(e.b,1))};return e.alpha!==void 0&&(t.alpha=e.alpha),t},J1=e=>e!==void 0&&e.r>=0&&e.r<=1&&e.g>=0&&e.g<=1&&e.b>=0&&e.b<=1;function _d(e="rgb"){const{gamut:t}=Wt(e);if(!t)return r=>!0;const n=it(typeof t=="string"?t:e);return r=>J1(n(r))}function Q1(e="rgb"){const{gamut:t}=Wt(e);if(!t)return i=>rr(i);const n=typeof t=="string"?t:e,r=it(n),o=_d(n);return i=>{const s=rr(i);if(!s)return;const a=r(s);if(o(a))return s;const c=Z1(a);return s.mode===c.mode?c:it(s.mode)(c)}}function eb(e="rgb",t="oklch",n=Lu("oklch"),r=.02){const o=it(e);if(!Wt(e).gamut)return l=>o(l);const i=_d(e),s=Q1(e),a=it(t),{ranges:c}=Wt(t),u=o("white"),d=o("black");return l=>{if(l=rr(l),l===void 0)return;const f={...a(l)};if(f.l>=c.l[1]){const x={...u};return l.alpha!==void 0&&(x.alpha=l.alpha),x}if(f.l<=c.l[0]){const x={...d};return l.alpha!==void 0&&(x.alpha=l.alpha),x}if(i(f))return o(f);let h=0,p=f.c,m=(c.c[1]-c.c[0])/4e3,y=s(f);for(;p-h>m;)f.c=(h+p)*.5,y=s(f),i(f)||n&&r>0&&n(f,y)<=r?h=f.c:p=f.c;return o(i(f)?f:y)}}Z(Ng),Z(jg),Z(Hg),Z(Ug),Z(Wg),Z(Hu),Z(qu),Z(r1),Z(m1),Z(v1),Z($s),Z(b1),Z(Ss),Z(w1),Z(C1),Z(A1),Z(P1),Z(O1),Z(L1),Z(R1),Z(F1),Z(D1),Z(z1),Z(H1),Z(wn),Z(X1),Z(q1),Z(W1),Z(K1);const tb=it("oklch"),nb=Object.keys({1:!0,2:!0,3:!0,4:!0,5:!0,6:!0,7:!0,8:!0,9:!0,10:!0,11:!0,12:!0}),rb={1:{l:97.78,c:.0108},2:{l:93.56,c:.0321},3:{l:88.11,c:.0609},4:{l:82.67,c:.0908},5:{l:74.22,c:.1398},6:{l:64.78,c:.1472},7:{l:57.33,c:.1299},8:{l:46.89,c:.1067},9:{l:39.44,c:.0898},10:{l:32,c:.0726},11:{l:23.78,c:.054},12:{l:15.56,c:.0353}},ob=(e,t=1)=>n=>{const{c:r,l:o}=rb[n],i="oklch("+o+"% "+r*t+" "+e+")",s=tb(eb("p3","oklch",Lu("oklch"),0)(i)),a=G1(s);if(!a)throw new Error("Could not format color");return a},xd=e=>{const t=ob(e.hue,e.chroma);return Object.fromEntries(nb.map(n=>[n,t(n)]))},ib=e=>e.replace("oklch(","").replace(")",""),sb=e=>`#isdk {
54
- ${e.flatMap(n=>Object.entries(n.colors).map(([r,o])=>`--i-${n.name}-${r}: ${ib(o)};`).join(`
53
+ `||t[D]===" "||t[D]===" ");)D++;let o;if(co(t)&&(o=or(t),o.type!==$.Hue)){n.push({type:$.Alpha,value:o});continue}if(ss(t)&&uo(t)==="none"){n.push({type:$.Alpha,value:{type:$.None,value:void 0}});continue}return}if(/\d/.test(r)){D--,n.push(or(t));continue}if(is.test(r)){D--,n.push(Mg(t));continue}return}return n}function Cg(e){e._i=0;let t=e[e._i++];if(!t||t.type!==$.Function||t.value!=="color"||(t=e[e._i++],t.type!==$.Ident))return;const n=Tu[t.value];if(!n)return;const r={mode:n},o=Cu(e,!1);if(!o)return;const i=Wt(n).channels;for(let s=0,a;s<i.length;s++)a=o[s],a.type!==$.None&&(r[i[s]]=a.type===$.Number?a.value:a.value/100);return r}function Cu(e,t){const n=[];let r;for(;e._i<e.length;){if(r=e[e._i++],r.type===$.None||r.type===$.Number||r.type===$.Alpha||r.type===$.Percentage||t&&r.type===$.Hue){n.push(r);continue}if(r.type===$.ParenClose){if(e._i<e.length)return;continue}return}if(!(n.length<3||n.length>4)){if(n.length===4){if(n[3].type!==$.Alpha)return;n[3]=n[3].value}return n.length===3&&n.push({type:$.None,value:void 0}),n.every(o=>o.type!==$.Alpha)?n:void 0}}function Ag(e,t){e._i=0;let n=e[e._i++];if(!n||n.type!==$.Function)return;let r=Cu(e,t);if(r)return r.unshift(n.value),r}const Pg=e=>{if(typeof e!="string")return;const t=Tg(e),n=t?Ag(t,!0):void 0;let r,o=0,i=ao.length;for(;o<i;)if((r=ao[o++](e,n))!==void 0)return r;return t?Cg(t):void 0};function Eg(e,t){if(!t||t[0]!=="rgb"&&t[0]!=="rgba")return;const n={mode:"rgb"},[,r,o,i,s]=t;if(!(r.type===$.Hue||o.type===$.Hue||i.type===$.Hue))return r.type!==$.None&&(n.r=r.type===$.Number?r.value/255:r.value/100),o.type!==$.None&&(n.g=o.type===$.Number?o.value/255:o.value/100),i.type!==$.None&&(n.b=i.type===$.Number?i.value/255:i.value/100),s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const Vg=e=>e==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,Og=(e,t,n)=>e+n*(t-e),Lg=e=>{let t=[];for(let n=0;n<e.length-1;n++){let r=e[n],o=e[n+1];r===void 0&&o===void 0?t.push(void 0):r!==void 0&&o!==void 0?t.push([r,o]):t.push(r!==void 0?[r,r]:[o,o])}return t},A=(e=>t=>{let n=Lg(t);return r=>{let o=r*n.length,i=r>=1?n.length-1:Math.max(Math.floor(o),0),s=n[i];return s===void 0?void 0:e(s[0],s[1],o-i)}})(Og),he=e=>{let t=!1,n=e.map(r=>r!==void 0?(t=!0,r):1);return t?n:e},wn={mode:"rgb",channels:["r","g","b","alpha"],parse:[Eg,gg,_g,mg,Vg,"srgb"],serialize:"srgb",interpolate:{r:A,g:A,b:A,alpha:{use:A,fixup:he}},gamut:!0},as=e=>Math.pow(Math.abs(e),563/256)*Math.sign(e),Au=e=>{let t=as(e.r),n=as(e.g),r=as(e.b),o={mode:"xyz65",x:.5766690429101305*t+.1855582379065463*n+.1882286462349947*r,y:.297344975250536*t+.6273635662554661*n+.0752914584939979*r,z:.0270313613864123*t+.0706888525358272*n+.9913375368376386*r};return e.alpha!==void 0&&(o.alpha=e.alpha),o},cs=e=>Math.pow(Math.abs(e),256/563)*Math.sign(e),Pu=({x:e,y:t,z:n,alpha:r})=>{let o={mode:"a98",r:cs(e*2.0415879038107465-t*.5650069742788597-.3447313507783297*n),g:cs(e*-.9692436362808798+t*1.8759675015077206+.0415550574071756*n),b:cs(e*.0134442806320312-t*.1183623922310184+1.0151749943912058*n)};return r!==void 0&&(o.alpha=r),o},ls=e=>{const t=Math.abs(e);return t<=.04045?e/12.92:(Math.sign(e)||1)*Math.pow((t+.055)/1.055,2.4)},_n=({r:e,g:t,b:n,alpha:r})=>{let o={mode:"lrgb",r:ls(e),g:ls(t),b:ls(n)};return r!==void 0&&(o.alpha=r),o},xn=e=>{let{r:t,g:n,b:r,alpha:o}=_n(e),i={mode:"xyz65",x:.4123907992659593*t+.357584339383878*n+.1804807884018343*r,y:.2126390058715102*t+.715168678767756*n+.0721923153607337*r,z:.0193308187155918*t+.119194779794626*n+.9505321522496607*r};return o!==void 0&&(i.alpha=o),i},us=e=>{const t=Math.abs(e);return t>.0031308?(Math.sign(e)||1)*(1.055*Math.pow(t,1/2.4)-.055):e*12.92},kn=({r:e,g:t,b:n,alpha:r},o="rgb")=>{let i={mode:o,r:us(e),g:us(t),b:us(n)};return r!==void 0&&(i.alpha=r),i},$n=({x:e,y:t,z:n,alpha:r})=>{let o=kn({r:e*3.2409699419045226-t*1.537383177570094-.4986107602930034*n,g:e*-.9692436362808796+t*1.8759675015077204+.0415550574071756*n,b:e*.0556300796969936-t*.2039769588889765+1.0569715142428784*n});return r!==void 0&&(o.alpha=r),o},Ng={...wn,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:e=>Pu(xn(e)),xyz65:Pu},toMode:{rgb:e=>$n(Au(e)),xyz65:Au}},be=e=>(e=e%360)<0?e+360:e,Rg=(e,t)=>e.map((n,r,o)=>{if(n===void 0)return n;let i=be(n);return r===0||e[r-1]===void 0?i:t(i-be(o[r-1]))}).reduce((n,r)=>!n.length||r===void 0||n[n.length-1]===void 0?(n.push(r),n):(n.push(r+n[n.length-1]),n),[]),st=e=>Rg(e,t=>Math.abs(t)<=180?t:t-360*Math.sign(t)),pe=[-.14861,1.78277,-.29227,-.90649,1.97294,0],Ig=Math.PI/180,Fg=180/Math.PI;let Eu=pe[3]*pe[4],Vu=pe[1]*pe[4],Ou=pe[1]*pe[2]-pe[0]*pe[3];const Dg=({r:e,g:t,b:n,alpha:r})=>{let o=(Ou*n+e*Eu-t*Vu)/(Ou+Eu-Vu),i=n-o,s=(pe[4]*(t-o)-pe[2]*i)/pe[3],a={mode:"cubehelix",l:o,s:o===0||o===1?void 0:Math.sqrt(i*i+s*s)/(pe[4]*o*(1-o))};return a.s&&(a.h=Math.atan2(s,i)*Fg-120),r!==void 0&&(a.alpha=r),a},zg=({h:e,s:t,l:n,alpha:r})=>{let o={mode:"rgb"};e=(e===void 0?0:e+120)*Ig;let i=t===void 0?0:t*n*(1-n),s=Math.cos(e),a=Math.sin(e);return o.r=n+i*(pe[0]*s+pe[1]*a),o.g=n+i*(pe[2]*s+pe[3]*a),o.b=n+i*(pe[4]*s+pe[5]*a),r!==void 0&&(o.alpha=r),o},fo=(e,t)=>{if(e.h===void 0||t.h===void 0||!e.s||!t.s)return 0;let n=be(e.h),r=be(t.h),o=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(e.s*t.s)*o},Bg=(e,t)=>{if(e.h===void 0||t.h===void 0)return 0;let n=be(e.h),r=be(t.h);return Math.abs(r-n)>180?n-(r-360*Math.sign(r-n)):r-n},ho=(e,t)=>{if(e.h===void 0||t.h===void 0||!e.c||!t.c)return 0;let n=be(e.h),r=be(t.h),o=Math.sin((r-n+360)/2*Math.PI/180);return 2*Math.sqrt(e.c*t.c)*o},Lu=(e="rgb",t=[1,1,1,0])=>{let n=Wt(e),r=n.channels,o=n.difference,i=it(e);return(s,a)=>{let c=i(s),u=i(a);return Math.sqrt(r.reduce((d,l,f)=>{let h=o[l]?o[l](c,u):c[l]-u[l];return d+(t[f]||0)*Math.pow(isNaN(h)?0:h,2)},0))}},at=e=>{let t=e.reduce((n,r)=>{if(r!==void 0){let o=r*Math.PI/180;n.sin+=Math.sin(o),n.cos+=Math.cos(o)}return n},{sin:0,cos:0});return Math.atan2(t.sin,t.cos)*180/Math.PI},jg={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:Dg},toMode:{rgb:zg},interpolate:{h:{use:A,fixup:st},s:A,l:A,alpha:{use:A,fixup:he}},difference:{h:fo},average:{h:at}},St=({l:e,a:t,b:n,alpha:r},o="lch")=>{let i=Math.sqrt(t*t+n*n),s={mode:o,l:e,c:i};return i&&(s.h=be(Math.atan2(n,t)*180/Math.PI)),r!==void 0&&(s.alpha=r),s},Mt=({l:e,c:t,h:n,alpha:r},o="lab")=>{let i={mode:o,l:e,a:t?t*Math.cos(n/180*Math.PI):0,b:t?t*Math.sin(n/180*Math.PI):0};return r!==void 0&&(i.alpha=r),i},Nu=Math.pow(29,3)/Math.pow(3,3),Ru=Math.pow(6,3)/Math.pow(29,3),ce={X:.3457/.3585,Y:1,Z:(1-.3457-.3585)/.3585},Sn={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329};let ds=e=>Math.pow(e,3)>Ru?Math.pow(e,3):(116*e-16)/Nu;const Iu=({l:e,a:t,b:n,alpha:r})=>{let o=(e+16)/116,i=t/500+o,s=o-n/200,a={mode:"xyz65",x:ds(i)*Sn.X,y:ds(o)*Sn.Y,z:ds(s)*Sn.Z};return r!==void 0&&(a.alpha=r),a},po=e=>$n(Iu(e)),fs=e=>e>Ru?Math.cbrt(e):(Nu*e+16)/116,Fu=({x:e,y:t,z:n,alpha:r})=>{let o=fs(e/Sn.X),i=fs(t/Sn.Y),s=fs(n/Sn.Z),a={mode:"lab65",l:116*i-16,a:500*(o-i),b:200*(i-s)};return r!==void 0&&(a.alpha=r),a},mo=e=>{let t=Fu(xn(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},vo=1,Du=1,ir=26/180*Math.PI,go=Math.cos(ir),bo=Math.sin(ir),zu=100/Math.log(139/100),hs=({l:e,c:t,h:n,alpha:r})=>{let o={mode:"lab65",l:(Math.exp(e*vo/zu)-1)/.0039};if(n===void 0)o.a=o.b=0;else{let i=(Math.exp(.0435*t*Du*vo)-1)/.075,s=i*Math.cos(n/180*Math.PI-ir),a=i*Math.sin(n/180*Math.PI-ir);o.a=s*go-a/.83*bo,o.b=s*bo+a/.83*go}return r!==void 0&&(o.alpha=r),o},ps=({l:e,a:t,b:n,alpha:r})=>{let o=t*go+n*bo,i=.83*(n*go-t*bo),s=Math.sqrt(o*o+i*i),a={mode:"dlch",l:zu/vo*Math.log(1+.0039*e),c:Math.log(1+.075*s)/(.0435*Du*vo)};return a.c&&(a.h=be((Math.atan2(i,o)+ir)/Math.PI*180)),r!==void 0&&(a.alpha=r),a},Bu=e=>hs(St(e,"dlch")),ju=e=>Mt(ps(e),"dlab"),Hg={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:Bu,rgb:e=>po(Bu(e))},fromMode:{lab65:ju,rgb:e=>ju(mo(e))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:A,a:A,b:A,alpha:{use:A,fixup:he}}},Ug={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:hs,dlab:e=>Mt(e,"dlab"),rgb:e=>po(hs(e))},fromMode:{lab65:ps,dlab:e=>St(e,"dlch"),rgb:e=>ps(mo(e))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:A,c:A,h:{use:A,fixup:st},alpha:{use:A,fixup:he}},difference:{h:ho},average:{h:at}};function Xg({h:e,s:t,i:n,alpha:r}){e=be(e);let o=Math.abs(e/60%2-1),i;switch(Math.floor(e/60)){case 0:i={r:n*(1+t*(3/(2-o)-1)),g:n*(1+t*(3*(1-o)/(2-o)-1)),b:n*(1-t)};break;case 1:i={r:n*(1+t*(3*(1-o)/(2-o)-1)),g:n*(1+t*(3/(2-o)-1)),b:n*(1-t)};break;case 2:i={r:n*(1-t),g:n*(1+t*(3/(2-o)-1)),b:n*(1+t*(3*(1-o)/(2-o)-1))};break;case 3:i={r:n*(1-t),g:n*(1+t*(3*(1-o)/(2-o)-1)),b:n*(1+t*(3/(2-o)-1))};break;case 4:i={r:n*(1+t*(3*(1-o)/(2-o)-1)),g:n*(1-t),b:n*(1+t*(3/(2-o)-1))};break;case 5:i={r:n*(1+t*(3/(2-o)-1)),g:n*(1-t),b:n*(1+t*(3*(1-o)/(2-o)-1))};break;default:i={r:n*(1-t),g:n*(1-t),b:n*(1-t)}}return i.mode="rgb",r!==void 0&&(i.alpha=r),i}function qg({r:e,g:t,b:n,alpha:r}){let o=Math.max(e,t,n),i=Math.min(e,t,n),s={mode:"hsi",s:e+t+n===0?0:1-3*i/(e+t+n),i:(e+t+n)/3};return o-i!==0&&(s.h=(o===e?(t-n)/(o-i)+(t<n)*6:o===t?(n-e)/(o-i)+2:(e-t)/(o-i)+4)*60),r!==void 0&&(s.alpha=r),s}const Wg={mode:"hsi",toMode:{rgb:Xg},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:qg},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:A,fixup:st},s:A,i:A,alpha:{use:A,fixup:he}},difference:{h:fo},average:{h:at}};function Kg({h:e,s:t,l:n,alpha:r}){e=be(e);let o=n+t*(n<.5?n:1-n),i=o-(o-n)*2*Math.abs(e/60%2-1),s;switch(Math.floor(e/60)){case 0:s={r:o,g:i,b:2*n-o};break;case 1:s={r:i,g:o,b:2*n-o};break;case 2:s={r:2*n-o,g:o,b:i};break;case 3:s={r:2*n-o,g:i,b:o};break;case 4:s={r:i,g:2*n-o,b:o};break;case 5:s={r:o,g:2*n-o,b:i};break;default:s={r:2*n-o,g:2*n-o,b:2*n-o}}return s.mode="rgb",r!==void 0&&(s.alpha=r),s}function Yg({r:e,g:t,b:n,alpha:r}){let o=Math.max(e,t,n),i=Math.min(e,t,n),s={mode:"hsl",s:o===i?0:(o-i)/(1-Math.abs(o+i-1)),l:.5*(o+i)};return o-i!==0&&(s.h=(o===e?(t-n)/(o-i)+(t<n)*6:o===t?(n-e)/(o-i)+2:(e-t)/(o-i)+4)*60),r!==void 0&&(s.alpha=r),s}const Gg=(e,t)=>{switch(t){case"deg":return+e;case"rad":return e/Math.PI*180;case"grad":return e/10*9;case"turn":return e*360}},Zg=new RegExp(`^hsla?\\(\\s*${bg}${yn}${nr}${yn}${nr}\\s*(?:,\\s*${os}\\s*)?\\)$`),Jg=e=>{let t=e.match(Zg);if(!t)return;let n={mode:"hsl"};return t[3]!==void 0?n.h=+t[3]:t[1]!==void 0&&t[2]!==void 0&&(n.h=Gg(t[1],t[2])),t[4]!==void 0&&(n.s=Math.min(Math.max(0,t[4]/100),1)),t[5]!==void 0&&(n.l=Math.min(Math.max(0,t[5]/100),1)),t[6]!==void 0?n.alpha=t[6]/100:t[7]!==void 0&&(n.alpha=+t[7]),n};function Qg(e,t){if(!t||t[0]!=="hsl"&&t[0]!=="hsla")return;const n={mode:"hsl"},[,r,o,i,s]=t;if(r.type!==$.None){if(r.type===$.Percentage)return;n.h=r.value}if(o.type!==$.None){if(o.type===$.Hue)return;n.s=o.type===$.Number?o.value:o.value/100}if(i.type!==$.None){if(i.type===$.Hue)return;n.l=i.type===$.Number?i.value:i.value/100}return s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const Hu={mode:"hsl",toMode:{rgb:Kg},fromMode:{rgb:Yg},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[Qg,Jg],serialize:e=>`hsl(${e.h||0} ${e.s!==void 0?e.s*100+"%":"none"} ${e.l!==void 0?e.l*100+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:A,fixup:st},s:A,l:A,alpha:{use:A,fixup:he}},difference:{h:fo},average:{h:at}};function Uu({h:e,s:t,v:n,alpha:r}){e=be(e);let o=Math.abs(e/60%2-1),i;switch(Math.floor(e/60)){case 0:i={r:n,g:n*(1-t*o),b:n*(1-t)};break;case 1:i={r:n*(1-t*o),g:n,b:n*(1-t)};break;case 2:i={r:n*(1-t),g:n,b:n*(1-t*o)};break;case 3:i={r:n*(1-t),g:n*(1-t*o),b:n};break;case 4:i={r:n*(1-t*o),g:n*(1-t),b:n};break;case 5:i={r:n,g:n*(1-t),b:n*(1-t*o)};break;default:i={r:n*(1-t),g:n*(1-t),b:n*(1-t)}}return i.mode="rgb",r!==void 0&&(i.alpha=r),i}function Xu({r:e,g:t,b:n,alpha:r}){let o=Math.max(e,t,n),i=Math.min(e,t,n),s={mode:"hsv",s:o===0?0:1-i/o,v:o};return o-i!==0&&(s.h=(o===e?(t-n)/(o-i)+(t<n)*6:o===t?(n-e)/(o-i)+2:(e-t)/(o-i)+4)*60),r!==void 0&&(s.alpha=r),s}const qu={mode:"hsv",toMode:{rgb:Uu},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:Xu},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:A,fixup:st},s:A,v:A,alpha:{use:A,fixup:he}},difference:{h:fo},average:{h:at}};function eb({h:e,w:t,b:n,alpha:r}){if(t+n>1){let o=t+n;t/=o,n/=o}return Uu({h:e,s:n===1?1:1-t/(1-n),v:1-n,alpha:r})}function tb(e){let t=Xu(e);if(t===void 0)return;let n={mode:"hwb",w:(1-t.s)*t.v,b:1-t.v};return t.h!==void 0&&(n.h=t.h),t.alpha!==void 0&&(n.alpha=t.alpha),n}function nb(e,t){if(!t||t[0]!=="hwb")return;const n={mode:"hwb"},[,r,o,i,s]=t;if(r.type!==$.None){if(r.type===$.Percentage)return;n.h=r.value}if(o.type!==$.None){if(o.type===$.Hue)return;n.w=o.type===$.Number?o.value:o.value/100}if(i.type!==$.None){if(i.type===$.Hue)return;n.b=i.type===$.Number?i.value:i.value/100}return s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const rb={mode:"hwb",toMode:{rgb:eb},fromMode:{rgb:tb},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[nb],serialize:e=>`hwb(${e.h||0} ${e.w*100}% ${e.b*100}%${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:A,fixup:st},w:A,b:A,alpha:{use:A,fixup:he}},difference:{h:Bg},average:{h:at}},ob=.1593017578125,ib=134.03437499999998,sb=.8359375,ab=18.8515625,cb=18.6875,lb=16295499532821565e-27,ms=e=>{let t=Math.pow(e/1e4,ob);return Math.pow((sb+ab*t)/(1+cb*t),ib)||0},vs=e=>Math.max(e*203,0),Wu=({x:e,y:t,z:n,alpha:r})=>{e=vs(e),t=vs(t),n=vs(n);let o=1.15*e-.15*n,i=.66*t+.34*e,s=ms(.41478972*o+.579999*i+.014648*n),a=ms(-.20151*o+1.120649*i+.0531008*n),c=ms(-.0166008*o+.2648*i+.6684799*n),u=(s+a)/2,d={mode:"jab",j:.44*u/(1-.56*u)-lb,a:3.524*s-4.066708*a+.542708*c,b:.199076*s+1.096799*a-1.295875*c};return r!==void 0&&(d.alpha=r),d},ub=.1593017578125,db=134.03437499999998,fb=.8359375,hb=18.8515625,pb=18.6875,Ku=16295499532821565e-27,gs=e=>{let t=Math.pow(e,1/db);return 1e4*Math.pow((fb-t)/(pb*t-hb),1/ub)||0},bs=e=>e/203,Yu=({j:e,a:t,b:n,alpha:r})=>{let o=(e+Ku)/(.44+.56*(e+Ku)),i=gs(o+.13860504*t+.058047316*n),s=gs(o-.13860504*t-.058047316*n),a=gs(o-.096019242*t-.8118919*n),c={mode:"xyz65",x:bs(1.661373024652174*i-.914523081304348*s+.23136208173913045*a),y:bs(-.3250758611844533*i+1.571847026732543*s-.21825383453227928*a),z:bs(-.090982811*i-.31272829*s+1.5227666*a)};return r!==void 0&&(c.alpha=r),c},Gu=e=>{let t=Wu(xn(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},Zu=e=>$n(Yu(e)),mb={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:Gu,xyz65:Wu},toMode:{rgb:Zu,xyz65:Yu},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:A,a:A,b:A,alpha:{use:A,fixup:he}}},Ju=({j:e,a:t,b:n,alpha:r})=>{let o=Math.sqrt(t*t+n*n),i={mode:"jch",j:e,c:o};return o&&(i.h=be(Math.atan2(n,t)*180/Math.PI)),r!==void 0&&(i.alpha=r),i},Qu=({j:e,c:t,h:n,alpha:r})=>{let o={mode:"jab",j:e,a:t?t*Math.cos(n/180*Math.PI):0,b:t?t*Math.sin(n/180*Math.PI):0};return r!==void 0&&(o.alpha=r),o},vb={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:Qu,rgb:e=>Zu(Qu(e))},fromMode:{rgb:e=>Ju(Gu(e)),jab:Ju},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:A,fixup:st},c:A,j:A,alpha:{use:A,fixup:he}},difference:{h:ho},average:{h:at}},yo=Math.pow(29,3)/Math.pow(3,3),ys=Math.pow(6,3)/Math.pow(29,3);let ws=e=>Math.pow(e,3)>ys?Math.pow(e,3):(116*e-16)/yo;const _s=({l:e,a:t,b:n,alpha:r})=>{let o=(e+16)/116,i=t/500+o,s=o-n/200,a={mode:"xyz50",x:ws(i)*ce.X,y:ws(o)*ce.Y,z:ws(s)*ce.Z};return r!==void 0&&(a.alpha=r),a},sr=({x:e,y:t,z:n,alpha:r})=>{let o=kn({r:e*3.1341359569958707-t*1.6173863321612538-.4906619460083532*n,g:e*-.978795502912089+t*1.916254567259524+.03344273116131949*n,b:e*.07195537988411677-t*.2289768264158322+1.405386058324125*n});return r!==void 0&&(o.alpha=r),o},ed=e=>sr(_s(e)),ar=e=>{let{r:t,g:n,b:r,alpha:o}=_n(e),i={mode:"xyz50",x:.436065742824811*t+.3851514688337912*n+.14307845442264197*r,y:.22249319175623702*t+.7168870538238823*n+.06061979053616537*r,z:.013923904500943465*t+.09708128566574634*n+.7140993584005155*r};return o!==void 0&&(i.alpha=o),i},xs=e=>e>ys?Math.cbrt(e):(yo*e+16)/116,ks=({x:e,y:t,z:n,alpha:r})=>{let o=xs(e/ce.X),i=xs(t/ce.Y),s=xs(n/ce.Z),a={mode:"lab",l:116*i-16,a:500*(o-i),b:200*(i-s)};return r!==void 0&&(a.alpha=r),a},td=e=>{let t=ks(ar(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t};function gb(e,t){if(!t||t[0]!=="lab")return;const n={mode:"lab"},[,r,o,i,s]=t;if(!(r.type===$.Hue||o.type===$.Hue||i.type===$.Hue))return r.type!==$.None&&(n.l=r.value),o.type!==$.None&&(n.a=o.type===$.Number?o.value:o.value*125/100),i.type!==$.None&&(n.b=i.type===$.Number?i.value:i.value*125/100),s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const $s={mode:"lab",toMode:{xyz50:_s,rgb:ed},fromMode:{xyz50:ks,rgb:td},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-100,100],b:[-100,100]},parse:[gb],serialize:e=>`lab(${e.l!==void 0?e.l:"none"} ${e.a!==void 0?e.a:"none"} ${e.b!==void 0?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{l:A,a:A,b:A,alpha:{use:A,fixup:he}}},bb={...$s,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:Iu,rgb:po},fromMode:{xyz65:Fu,rgb:mo},ranges:{l:[0,100],a:[-86.182,98.234],b:[-107.86,94.477]}};function yb(e,t){if(!t||t[0]!=="lch")return;const n={mode:"lch"},[,r,o,i,s]=t;if(r.type!==$.None){if(r.type===$.Hue)return;n.l=r.value}if(o.type!==$.None&&(n.c=Math.max(0,o.type===$.Number?o.value:o.value*150/100)),i.type!==$.None){if(i.type===$.Percentage)return;n.h=i.value}return s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const Ss={mode:"lch",toMode:{lab:Mt,rgb:e=>ed(Mt(e))},fromMode:{rgb:e=>St(td(e)),lab:St},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[yb],serialize:e=>`lch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h||0}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:A,fixup:st},c:A,l:A,alpha:{use:A,fixup:he}},difference:{h:ho},average:{h:at}},wb={...Ss,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:e=>Mt(e,"lab65"),rgb:e=>po(Mt(e,"lab65"))},fromMode:{rgb:e=>St(mo(e),"lch65"),lab65:e=>St(e,"lch65")},ranges:{l:[0,100],c:[0,133.807],h:[0,360]}},nd=({l:e,u:t,v:n,alpha:r})=>{let o=Math.sqrt(t*t+n*n),i={mode:"lchuv",l:e,c:o};return o&&(i.h=be(Math.atan2(n,t)*180/Math.PI)),r!==void 0&&(i.alpha=r),i},rd=({l:e,c:t,h:n,alpha:r})=>{let o={mode:"luv",l:e,u:t?t*Math.cos(n/180*Math.PI):0,v:t?t*Math.sin(n/180*Math.PI):0};return r!==void 0&&(o.alpha=r),o},od=(e,t,n)=>4*e/(e+15*t+3*n),id=(e,t,n)=>9*t/(e+15*t+3*n),_b=od(ce.X,ce.Y,ce.Z),xb=id(ce.X,ce.Y,ce.Z),kb=e=>e<=ys?yo*e:116*Math.cbrt(e)-16,Ms=({x:e,y:t,z:n,alpha:r})=>{let o=kb(t/ce.Y),i=od(e,t,n),s=id(e,t,n);!isFinite(i)||!isFinite(s)?o=i=s=0:(i=13*o*(i-_b),s=13*o*(s-xb));let a={mode:"luv",l:o,u:i,v:s};return r!==void 0&&(a.alpha=r),a},$b=(e,t,n)=>4*e/(e+15*t+3*n),Sb=(e,t,n)=>9*t/(e+15*t+3*n),Mb=$b(ce.X,ce.Y,ce.Z),Tb=Sb(ce.X,ce.Y,ce.Z),Ts=({l:e,u:t,v:n,alpha:r})=>{let o=t/(13*e)+Mb,i=n/(13*e)+Tb,s=ce.Y*(e<=8?e/yo:Math.pow((e+16)/116,3)),a=s*(9*o)/(4*i),c=s*(12-3*o-20*i)/(4*i),u={mode:"xyz50",x:a,y:s,z:c};return r!==void 0&&(u.alpha=r),u},Cb={mode:"lchuv",toMode:{luv:rd,rgb:e=>sr(Ts(rd(e)))},fromMode:{rgb:e=>nd(Ms(ar(e))),luv:nd},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:A,fixup:st},c:A,l:A,alpha:{use:A,fixup:he}},difference:{h:ho},average:{h:at}},Ab={...wn,mode:"lrgb",toMode:{rgb:kn},fromMode:{rgb:_n},parse:["srgb-linear"],serialize:"srgb-linear"},Pb={mode:"luv",toMode:{xyz50:Ts,rgb:e=>sr(Ts(e))},fromMode:{xyz50:Ms,rgb:e=>Ms(ar(e))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:A,u:A,v:A,alpha:{use:A,fixup:he}}},sd=({r:e,g:t,b:n,alpha:r})=>{let o=Math.cbrt(.41222147079999993*e+.5363325363*t+.0514459929*n),i=Math.cbrt(.2119034981999999*e+.6806995450999999*t+.1073969566*n),s=Math.cbrt(.08830246189999998*e+.2817188376*t+.6299787005000002*n),a={mode:"oklab",l:.2104542553*o+.793617785*i-.0040720468*s,a:1.9779984951*o-2.428592205*i+.4505937099*s,b:.0259040371*o+.7827717662*i-.808675766*s};return r!==void 0&&(a.alpha=r),a},wo=e=>{let t=sd(_n(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},cr=({l:e,a:t,b:n,alpha:r})=>{let o=Math.pow(e*.9999999984505198+.39633779217376786*t+.2158037580607588*n,3),i=Math.pow(e*1.0000000088817609-.10556134232365635*t-.06385417477170591*n,3),s=Math.pow(e*1.0000000546724108-.08948418209496575*t-1.2914855378640917*n,3),a={mode:"lrgb",r:4.076741661347994*o-3.307711590408193*i+.230969928729428*s,g:-1.2684380040921763*o+2.6097574006633715*i-.3413193963102197*s,b:-.004196086541837188*o-.7034186144594493*i+1.7076147009309444*s};return r!==void 0&&(a.alpha=r),a},_o=e=>kn(cr(e));function Cs(e){const r=1.170873786407767;return .5*(r*e-.206+Math.sqrt((r*e-.206)*(r*e-.206)+4*.03*r*e))}function xo(e){const r=1.170873786407767;return(e*e+.206*e)/(r*(e+.03))}function Eb(e,t){let n,r,o,i,s,a,c,u;-1.88170328*e-.80936493*t>1?(n=1.19086277,r=1.76576728,o=.59662641,i=.75515197,s=.56771245,a=4.0767416621,c=-3.3077115913,u=.2309699292):1.81444104*e-1.19445276*t>1?(n=.73956515,r=-.45954404,o=.08285427,i=.1254107,s=.14503204,a=-1.2684380046,c=2.6097574011,u=-.3413193965):(n=1.35733652,r=-.00915799,o=-1.1513021,i=-.50559606,s=.00692167,a=-.0041960863,c=-.7034186147,u=1.707614701);let d=n+r*e+o*t+i*e*e+s*e*t,l=.3963377774*e+.2158037573*t,f=-.1055613458*e-.0638541728*t,h=-.0894841775*e-1.291485548*t;{let p=1+d*l,m=1+d*f,y=1+d*h,x=p*p*p,g=m*m*m,w=y*y*y,M=3*l*p*p,S=3*f*m*m,I=3*h*y*y,N=6*l*l*p,C=6*f*f*m,E=6*h*h*y,q=a*x+c*g+u*w,K=a*M+c*S+u*I,j=a*N+c*C+u*E;d=d-q*K/(K*K-.5*q*j)}return d}function As(e,t){let n=Eb(e,t),r=cr({l:1,a:n*e,b:n*t}),o=Math.cbrt(1/Math.max(r.r,r.g,r.b)),i=o*n;return[o,i]}function Vb(e,t,n,r,o,i=null){i||(i=As(e,t));let s;if((n-o)*i[1]-(i[0]-o)*r<=0)s=i[1]*o/(r*i[0]+i[1]*(o-n));else{s=i[1]*(o-1)/(r*(i[0]-1)+i[1]*(o-n));{let a=n-o,c=r,u=.3963377774*e+.2158037573*t,d=-.1055613458*e-.0638541728*t,l=-.0894841775*e-1.291485548*t,f=a+c*u,h=a+c*d,p=a+c*l;{let m=o*(1-s)+s*n,y=s*r,x=m+y*u,g=m+y*d,w=m+y*l,M=x*x*x,S=g*g*g,I=w*w*w,N=3*f*x*x,C=3*h*g*g,E=3*p*w*w,q=6*f*f*x,K=6*h*h*g,j=6*p*p*w,B=4.0767416621*M-3.3077115913*S+.2309699292*I-1,H=4.0767416621*N-3.3077115913*C+.2309699292*E,X=4.0767416621*q-3.3077115913*K+.2309699292*j,re=H/(H*H-.5*B*X),se=-B*re,Le=-1.2684380046*M+2.6097574011*S-.3413193965*I-1,Ne=-1.2684380046*N+2.6097574011*C-.3413193965*E,ut=-1.2684380046*q+2.6097574011*K-.3413193965*j,Y=Ne/(Ne*Ne-.5*Le*ut),Re=-Le*Y,At=-.0041960863*M-.7034186147*S+1.707614701*I-1,Pt=-.0041960863*N-.7034186147*C+1.707614701*E,Gt=-.0041960863*q-.7034186147*K+1.707614701*j,Ge=Pt/(Pt*Pt-.5*At*Gt),Ze=-At*Ge;se=re>=0?se:1e6,Re=Y>=0?Re:1e6,Ze=Ge>=0?Ze:1e6,s+=Math.min(se,Math.min(Re,Ze))}}}return s}function Ps(e,t,n=null){n||(n=As(e,t));let r=n[0],o=n[1];return[o/r,o/(1-r)]}function ad(e,t,n){let r=As(t,n),o=Vb(t,n,e,1,e,r),i=Ps(t,n,r),s=.11516993+1/(7.4477897+4.1590124*n+t*(-2.19557347+1.75198401*n+t*(-2.13704948-10.02301043*n+t*(-4.24894561+5.38770819*n+4.69891013*t)))),a=.11239642+1/(1.6132032-.68124379*n+t*(.40370612+.90148123*n+t*(-.27087943+.6122399*n+t*(.00299215-.45399568*n-.14661872*t)))),c=o/Math.min(e*i[0],(1-e)*i[1]),u=e*s,d=(1-e)*a,l=.9*c*Math.sqrt(Math.sqrt(1/(1/(u*u*u*u)+1/(d*d*d*d))));return u=e*.4,d=(1-e)*.8,[Math.sqrt(1/(1/(u*u)+1/(d*d))),l,o]}function cd(e){const t={mode:"okhsl",l:Cs(e.l)};e.alpha!==void 0&&(t.alpha=e.alpha);let n=Math.sqrt(e.a*e.a+e.b*e.b);if(!n)return t.s=0,t;let[r,o,i]=ad(e.l,e.a/n,e.b/n),s;if(n<o){let a=0,c=.8*r,u=1-c/o;s=(n-a)/(c+u*(n-a))*.8}else{let a=o,c=.2*o*o*1.25*1.25/r,u=1-c/(i-o);s=.8+.2*((n-a)/(c+u*(n-a)))}return s&&(t.s=s,t.h=be(Math.atan2(e.b,e.a)*180/Math.PI)),t}function ld(e){let t=xo(e.l);const n={mode:"oklab",l:t};if(e.alpha!==void 0&&(n.alpha=e.alpha),!e.s||e.l===1)return n.a=n.b=0,n;let r=Math.cos(e.h/180*Math.PI),o=Math.sin(e.h/180*Math.PI),[i,s,a]=ad(t,r,o),c,u,d,l;e.s<.8?(c=1.25*e.s,u=0,d=.8*i,l=1-d/s):(c=5*(e.s-.8),u=s,d=.2*s*s*1.25*1.25/i,l=1-d/(a-s));let f=u+c*d/(1-l*c);return n.a=f*r,n.b=f*o,n}const Ob={...Hu,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:cd,rgb:e=>cd(wo(e))},toMode:{oklab:ld,rgb:e=>_o(ld(e))}};function ud(e){let t=Math.sqrt(e.a*e.a+e.b*e.b),n=e.l,r=t?e.a/t:1,o=t?e.b/t:1,[i,s]=Ps(r,o),a=.5,c=1-a/i,u=s/(t+n*s),d=u*n,l=u*t,f=xo(d),h=l*f/d,p=cr({l:f,a:r*h,b:o*h}),m=Math.cbrt(1/Math.max(p.r,p.g,p.b,0));n=n/m,t=t/m*Cs(n)/n,n=Cs(n);const y={mode:"okhsv",s:t?(a+s)*l/(s*a+s*c*l):0,v:n?n/d:0};return y.s&&(y.h=be(Math.atan2(e.b,e.a)*180/Math.PI)),e.alpha!==void 0&&(y.alpha=e.alpha),y}function dd(e){const t={mode:"oklab"};e.alpha!==void 0&&(t.alpha=e.alpha);const n=e.h||0,r=Math.cos(n/180*Math.PI),o=Math.sin(n/180*Math.PI),[i,s]=Ps(r,o),a=.5,c=1-a/i,u=1-e.s*a/(a+s-s*c*e.s),d=e.s*s*a/(a+s-s*c*e.s),l=xo(u),f=d*l/u,h=cr({l,a:r*f,b:o*f}),p=Math.cbrt(1/Math.max(h.r,h.g,h.b,0)),m=xo(e.v*u),y=d*m/u;return t.l=m*p,t.a=y*r*p,t.b=y*o*p,t}const Lb={...qu,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:ud,rgb:e=>ud(wo(e))},toMode:{oklab:dd,rgb:e=>_o(dd(e))}};function Nb(e,t){if(!t||t[0]!=="oklab")return;const n={mode:"oklab"},[,r,o,i,s]=t;if(!(r.type===$.Hue||o.type===$.Hue||i.type===$.Hue))return r.type!==$.None&&(n.l=r.type===$.Number?r.value:r.value/100),o.type!==$.None&&(n.a=o.type===$.Number?o.value:o.value*.4/100),i.type!==$.None&&(n.b=i.type===$.Number?i.value:i.value*.4/100),s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const Rb={...$s,mode:"oklab",toMode:{lrgb:cr,rgb:_o},fromMode:{lrgb:sd,rgb:wo},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[Nb],serialize:e=>`oklab(${e.l!==void 0?e.l:"none"} ${e.a!==void 0?e.a:"none"} ${e.b!==void 0?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`};function Ib(e,t){if(!t||t[0]!=="oklch")return;const n={mode:"oklch"},[,r,o,i,s]=t;if(r.type!==$.None){if(r.type===$.Hue)return;n.l=r.type===$.Number?r.value:r.value/100}if(o.type!==$.None&&(n.c=Math.max(0,o.type===$.Number?o.value:o.value*.4/100)),i.type!==$.None){if(i.type===$.Percentage)return;n.h=i.value}return s.type!==$.None&&(n.alpha=s.type===$.Number?s.value:s.value/100),n}const Fb={...Ss,mode:"oklch",toMode:{oklab:e=>Mt(e,"oklab"),rgb:e=>_o(Mt(e,"oklab"))},fromMode:{rgb:e=>St(wo(e),"oklch"),oklab:e=>St(e,"oklch")},parse:[Ib],serialize:e=>`oklch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h||0}${e.alpha<1?` / ${e.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},fd=e=>{let{r:t,g:n,b:r,alpha:o}=_n(e),i={mode:"xyz65",x:.486570948648216*t+.265667693169093*n+.1982172852343625*r,y:.2289745640697487*t+.6917385218365062*n+.079286914093745*r,z:0*t+.0451133818589026*n+1.043944368900976*r};return o!==void 0&&(i.alpha=o),i},hd=({x:e,y:t,z:n,alpha:r})=>{let o=kn({r:e*2.4934969119414263-t*.9313836179191242-.402710784450717*n,g:e*-.8294889695615749+t*1.7626640603183465+.0236246858419436*n,b:e*.0358458302437845-t*.0761723892680418+.9568845240076871*n},"p3");return r!==void 0&&(o.alpha=r),o},Db={...wn,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:e=>hd(xn(e)),xyz65:hd},toMode:{rgb:e=>$n(fd(e)),xyz65:fd}},Es=e=>{let t=Math.abs(e);return t>=1/512?Math.sign(e)*Math.pow(t,1/1.8):16*e},pd=({x:e,y:t,z:n,alpha:r})=>{let o={mode:"prophoto",r:Es(e*1.3457868816471585-t*.2555720873797946-.0511018649755453*n),g:Es(e*-.5446307051249019+t*1.5082477428451466+.0205274474364214*n),b:Es(e*0+t*0+1.2119675456389452*n)};return r!==void 0&&(o.alpha=r),o},Vs=e=>{let t=Math.abs(e);return t>=16/512?Math.sign(e)*Math.pow(t,1.8):e/16},md=e=>{let t=Vs(e.r),n=Vs(e.g),r=Vs(e.b),o={mode:"xyz50",x:.7977666449006423*t+.1351812974005331*n+.0313477341283922*r,y:.2880748288194013*t+.7118352342418731*n+899369387256e-16*r,z:0*t+0*n+.8251046025104602*r};return e.alpha!==void 0&&(o.alpha=e.alpha),o},zb={...wn,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:pd,rgb:e=>pd(ar(e))},toMode:{xyz50:md,rgb:e=>sr(md(e))}},vd=1.09929682680944,Bb=.018053968510807,Os=e=>{const t=Math.abs(e);return t>Bb?(Math.sign(e)||1)*(vd*Math.pow(t,.45)-(vd-1)):4.5*e},gd=({x:e,y:t,z:n,alpha:r})=>{let o={mode:"rec2020",r:Os(e*1.7166511879712683-t*.3556707837763925-.2533662813736599*n),g:Os(e*-.6666843518324893+t*1.6164812366349395+.0157685458139111*n),b:Os(e*.0176398574453108-t*.0427706132578085+.9421031212354739*n)};return r!==void 0&&(o.alpha=r),o},bd=1.09929682680944,jb=.018053968510807,Ls=e=>{let t=Math.abs(e);return t<jb*4.5?e/4.5:(Math.sign(e)||1)*Math.pow((t+bd-1)/bd,1/.45)},yd=e=>{let t=Ls(e.r),n=Ls(e.g),r=Ls(e.b),o={mode:"xyz65",x:.6369580483012911*t+.1446169035862083*n+.1688809751641721*r,y:.262700212011267*t+.6779980715188708*n+.059301716469862*r,z:0*t+.0280726930490874*n+1.0609850577107909*r};return e.alpha!==void 0&&(o.alpha=e.alpha),o},Hb={...wn,mode:"rec2020",fromMode:{xyz65:gd,rgb:e=>gd(xn(e))},toMode:{xyz65:yd,rgb:e=>$n(yd(e))},parse:["rec2020"],serialize:"rec2020"},Kt=.0037930732552754493,wd=Math.cbrt(Kt),Ns=e=>Math.cbrt(e)-wd,Ub=e=>{const{r:t,g:n,b:r,alpha:o}=_n(e),i=Ns(.3*t+.622*n+.078*r+Kt),s=Ns(.23*t+.692*n+.078*r+Kt),a=Ns(.2434226892454782*t+.2047674442449682*n+.5518098665095535*r+Kt),c={mode:"xyb",x:(i-s)/2,y:(i+s)/2,b:a-(i+s)/2};return o!==void 0&&(c.alpha=o),c},Rs=e=>Math.pow(e+wd,3),Xb={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:({x:e,y:t,b:n,alpha:r})=>{const o=Rs(e+t)-Kt,i=Rs(t-e)-Kt,s=Rs(n+t)-Kt,a=kn({r:11.031566904639861*o-9.866943908131562*i-.16462299650829934*s,g:-3.2541473810744237*o+4.418770377582723*i-.16462299650829934*s,b:-3.6588512867136815*o+2.7129230459360922*i+1.9459282407775895*s});return r!==void 0&&(a.alpha=r),a}},fromMode:{rgb:Ub},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:A,y:A,b:A,alpha:{use:A,fixup:he}}},qb={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:sr,lab:ks},fromMode:{rgb:ar,lab:_s},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:A,y:A,z:A,alpha:{use:A,fixup:he}}},Wb={mode:"xyz65",toMode:{rgb:$n,xyz50:e=>{let{x:t,y:n,z:r,alpha:o}=e,i={mode:"xyz50",x:1.0479298208405488*t+.0229467933410191*n-.0501922295431356*r,y:.0296278156881593*t+.990434484573249*n-.0170738250293851*r,z:-.0092430581525912*t+.0150551448965779*n+.7518742899580008*r};return o!==void 0&&(i.alpha=o),i}},fromMode:{rgb:xn,xyz50:e=>{let{x:t,y:n,z:r,alpha:o}=e,i={mode:"xyz65",x:.9554734527042182*t-.0230985368742614*n+.0632593086610217*r,y:-.0283697069632081*t+1.0099954580058226*n+.021041398966943*r,z:.0123140016883199*t-.0205076964334779*n+1.3303659366080753*r};return o!==void 0&&(i.alpha=o),i}},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:A,y:A,z:A,alpha:{use:A,fixup:he}}},Kb={mode:"yiq",toMode:{rgb:({y:e,i:t,q:n,alpha:r})=>{const o={mode:"rgb",r:e+.95608445*t+.6208885*n,g:e-.27137664*t-.6486059*n,b:e-1.10561724*t+1.70250126*n};return r!==void 0&&(o.alpha=r),o}},fromMode:{rgb:({r:e,g:t,b:n,alpha:r})=>{const o={mode:"yiq",y:.29889531*e+.58662247*t+.11448223*n,i:.59597799*e-.2741761*t-.32180189*n,q:.21147017*e-.52261711*t+.31114694*n};return r!==void 0&&(o.alpha=r),o}},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:A,i:A,q:A,alpha:{use:A,fixup:he}}},Yb=(e,t)=>Math.round(e*(t=Math.pow(10,t)))/t;((e=4)=>t=>typeof t=="number"?Yb(t,e):t)(2);const Gb=e=>{const t=rr(e);if(!t)return;const n=Wt(t.mode);if(!n.serialize||typeof n.serialize=="string"){let r=`color(${n.serialize||`--${t.mode}`} `;return n.channels.forEach((o,i)=>{o!=="alpha"&&(r+=(i?" ":"")+(t[o]!==void 0?t[o]:"none"))}),t.alpha!==void 0&&t.alpha<1&&(r+=` / ${t.alpha}`),r+")"}if(typeof n.serialize=="function")return n.serialize(t)};it("rgb");const Zb=e=>{const t={mode:e.mode,r:Math.max(0,Math.min(e.r,1)),g:Math.max(0,Math.min(e.g,1)),b:Math.max(0,Math.min(e.b,1))};return e.alpha!==void 0&&(t.alpha=e.alpha),t},Jb=e=>e!==void 0&&e.r>=0&&e.r<=1&&e.g>=0&&e.g<=1&&e.b>=0&&e.b<=1;function _d(e="rgb"){const{gamut:t}=Wt(e);if(!t)return r=>!0;const n=it(typeof t=="string"?t:e);return r=>Jb(n(r))}function Qb(e="rgb"){const{gamut:t}=Wt(e);if(!t)return i=>rr(i);const n=typeof t=="string"?t:e,r=it(n),o=_d(n);return i=>{const s=rr(i);if(!s)return;const a=r(s);if(o(a))return s;const c=Zb(a);return s.mode===c.mode?c:it(s.mode)(c)}}function e1(e="rgb",t="oklch",n=Lu("oklch"),r=.02){const o=it(e);if(!Wt(e).gamut)return l=>o(l);const i=_d(e),s=Qb(e),a=it(t),{ranges:c}=Wt(t),u=o("white"),d=o("black");return l=>{if(l=rr(l),l===void 0)return;const f={...a(l)};if(f.l>=c.l[1]){const x={...u};return l.alpha!==void 0&&(x.alpha=l.alpha),x}if(f.l<=c.l[0]){const x={...d};return l.alpha!==void 0&&(x.alpha=l.alpha),x}if(i(f))return o(f);let h=0,p=f.c,m=(c.c[1]-c.c[0])/4e3,y=s(f);for(;p-h>m;)f.c=(h+p)*.5,y=s(f),i(f)||n&&r>0&&n(f,y)<=r?h=f.c:p=f.c;return o(i(f)?f:y)}}Z(Ng),Z(jg),Z(Hg),Z(Ug),Z(Wg),Z(Hu),Z(qu),Z(rb),Z(mb),Z(vb),Z($s),Z(bb),Z(Ss),Z(wb),Z(Cb),Z(Ab),Z(Pb),Z(Ob),Z(Lb),Z(Rb),Z(Fb),Z(Db),Z(zb),Z(Hb),Z(wn),Z(Xb),Z(qb),Z(Wb),Z(Kb);const t1=it("oklch"),n1=Object.keys({1:!0,2:!0,3:!0,4:!0,5:!0,6:!0,7:!0,8:!0,9:!0,10:!0,11:!0,12:!0}),r1={1:{l:97.78,c:.0108},2:{l:93.56,c:.0321},3:{l:88.11,c:.0609},4:{l:82.67,c:.0908},5:{l:74.22,c:.1398},6:{l:64.78,c:.1472},7:{l:57.33,c:.1299},8:{l:46.89,c:.1067},9:{l:39.44,c:.0898},10:{l:32,c:.0726},11:{l:23.78,c:.054},12:{l:15.56,c:.0353}},o1=(e,t=1)=>n=>{const{c:r,l:o}=r1[n],i="oklch("+o+"% "+r*t+" "+e+")",s=t1(e1("p3","oklch",Lu("oklch"),0)(i)),a=Gb(s);if(!a)throw new Error("Could not format color");return a},xd=e=>{const t=o1(e.hue,e.chroma);return Object.fromEntries(n1.map(n=>[n,t(n)]))},i1=e=>e.replace("oklch(","").replace(")",""),s1=e=>`#isdk {
54
+ ${e.flatMap(n=>Object.entries(n.colors).map(([r,o])=>`--i-${n.name}-${r}: ${i1(o)};`).join(`
55
55
  `)).join(`
56
56
  `)}
57
- }`,ab=({_internal_domManager:e=hg(),theme:t})=>Et(({apiClient:n,logger:r,analytics:o})=>{let i=!1;const s=()=>{if(typeof window>"u")return;const a=e.getOrCreateChatbotElement();e.addStyle(fg,"inploi-chatbot-style");const c=sb([{name:"a",colors:xd(t)},{name:"n",colors:xd({hue:t.hue,chroma:.1})}]);e.addStyle(c,"inploi-chatbot-theme"),en(R(Hv,{apiClient:n,logger:r,analytics:o}),a),i=!0};return{prepare:async()=>{if(!(typeof window>"u"))try{if(i)return;s(),r.info("Chatbot plugin prepared")}catch(a){console.error(a),r.error("Error preparing chatbot plugin",a)}},startApplication:async({jobId:a})=>{if(!(typeof window>"u"))try{ne.cancel(),pf(()=>{rt.value="maximised",ne.current$.value={state:"loading"}}),dg({jobId:a,apiClient:n,logger:r}).then(async c=>{c.ok?(await o.log({event:"APPLY_START",properties:{job_id:a,flow_id:c.value.flow.id}}).catch(r.error),ne.start(c.value)):ne.current$.value={state:"error",error:c.error}}),i||s()}catch(c){console.error(c),r.error("Error starting application",c)}},closeApplication:async()=>{typeof window>"u"||(r.info("Closing application from an external source"),ne.cancel())}}});if(!window.inploi)throw new Error("Please insert the SDK script tag above the plugins.");window.inploi.chatbotPlugin=ab;const kd=({node:e,nodes:t,stopWhen:n})=>{if((n==null?void 0:n(e))===!0)return e;const r=e.nextId?t.find(o=>o.id===e.nextId):void 0;if(r)return kd({node:r,nodes:t,stopWhen:n})},cb=({childNode:e,nodes:t})=>{const r=t.filter(o=>o.type==="if-block").find(o=>{if(!o.branchId)return!1;const i=t.find(a=>a.id===o.branchId);if(!i)return!1;const s=kd({node:i,nodes:t,stopWhen:a=>a.id===e.id});return!(!s||s.id!==e.id)});if(r!=null&&r.nextId)return t.find(o=>o.id===r.nextId)},lb=({flow:e,analytics:t,logger:n,context:r,apiClient:o,getSubmissions:i,chatService:s,onFlowEnd:a,onInterpret:c})=>{const u=new AbortController,d=async(l,f)=>{const h=i();c==null||c(l,f);try{await ub({analytics:t,logger:n,apiClient:o,context:r,node:l,submissions:h,chat:{sendMessage:async p=>s.send({groupId:l.id,message:p,signal:u.signal}),userInput:async p=>s.input({input:p,signal:u.signal})},next:p=>{const m=p?e.find(y=>y.id===p):cb({childNode:l,nodes:e});return m?d(m,l):a==null?void 0:a(l)},end:()=>a==null?void 0:a(l)})}catch(p){if(p instanceof Jn)return;throw p}};return{interpret:async l=>{const f=e.find(h=>h.id===l)??vu(e);return d(f)},abort:()=>{u.abort()}}};async function ub(e){return await nt(e).with({node:{type:"text"}},pb).with({node:{type:"image"}},mb).with({node:{type:"question-text"}},vb).with({node:{type:"question-enum"}},bb).with({node:{type:"question-number"}},gb).with({node:{type:"question-boolean"}},yb).with({node:{type:"question-file"}},_b).with({node:{type:"question-address"}},wb).with({node:{type:"end-flow"}},xb).with({node:{type:"if-block"}},hb).with({node:{type:"jump"}},({node:t,next:n})=>n(t.data.targetId)).with({node:{type:"link"}},fb).with({node:{type:"integration-application-submit"}},db).with({node:{type:"integration-workflow-get"}},()=>Error("Unreachable")).exhaustive()}async function db({chat:e,next:t,node:n,logger:r,apiClient:o,submissions:i,context:s,analytics:a}){await e.userInput({type:"multiple-choice",key:void 0,config:{options:[{label:"Submit my application",value:"submit"}],maxSelected:1,minSelected:1}});const c=()=>{const d=typeof s.jobId=="string"?s.jobId:void 0,l=typeof s.flowId=="string"?s.flowId:void 0;rn(d),rn(l),d&&a.log({event:"APPLY_COMPLETE",properties:{job_id:d,flow_id:l}})};await e.sendMessage({type:"system",variant:"info",text:"Submitting your application…"});const u=await o.fetch("/flow/apply",{method:"POST",body:JSON.stringify({...s,type:n.data.type,ats:n.data.ats,integration_id:n.data.integrationId,anonymous_id:a.getAnonymousId(),submissions:Nv(i||{})})}).catch(d=>d);await nt(u).with({ats_data:{redirect_url:Ae.string}},async d=>{await e.sendMessage({type:"text",author:"bot",text:"Almost there! Please finalise your application on our partner’s website."});const l=a.getAnonymousId(),f=new URL(d.ats_data.redirect_url);l&&!f.searchParams.has("anonymous_id")&&f.searchParams.set("anonymous_id",l),c(),await e.sendMessage({type:"link",href:f.toString(),text:"Finalise application on partner"})}).with({success:!0},async()=>{c(),await e.sendMessage({type:"system",variant:"success",text:"Application submitted"}),t(n.nextId)}).otherwise(async d=>{r.error(d),await e.sendMessage({type:"system",variant:"error",text:"Failed to submit application"}),t(n.id)})}async function fb({chat:e,next:t,node:n}){await e.sendMessage({type:"link",href:n.data.href,text:n.data.cta}),t(n.nextId)}async function hb({submissions:e,next:t,node:n}){const r=kb(n,e)?n.branchId:n.nextId;t(r)}async function pb({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"text",text:n.data.text}),t(n.nextId)}async function mb({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"image",url:n.data.url,height:n.data.height,width:n.data.width}),t(n.nextId)}async function vb({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"text",text:n.data.question});const r=await e.userInput({key:n.data.key,type:"text",config:{placeholder:n.data.placeholder,format:n.data.format}});await e.sendMessage({author:"user",type:"text",text:r.value}),t(n.nextId)}async function gb({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"text",text:n.data.question});const r=await e.userInput({key:n.data.key,type:"text",config:{placeholder:n.data.placeholder,format:"text"}});await e.sendMessage({author:"user",type:"text",text:r.value}),t(n.nextId)}async function bb({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"text",text:n.data.question});const r=await e.userInput({key:n.data.key,type:"multiple-choice",config:n.data});await e.sendMessage({author:"user",type:"text",text:n.data.options.filter(o=>r.value.includes(o.value)).map(o=>o.label).join(", ")}),t(n.nextId)}async function yb({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"text",text:n.data.question});const o=(await e.userInput({key:n.data.key,type:"boolean",config:{labels:{true:n.data.trueLabel,false:n.data.falseLabel}}})).value,i={true:n.data.trueLabel,false:n.data.falseLabel};await e.sendMessage({author:"user",type:"text",text:i[o]}),t(n.nextId)}async function wb({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"text",text:"Address questions are not implemented yet"}),t(n.nextId)}async function _b({node:e,chat:t,next:n}){await t.sendMessage({author:"bot",type:"text",text:e.data.question});const r=await t.userInput({key:e.data.key,type:"file",config:{extensions:e.data.extensions,fileSizeLimitKib:e.data.maxSizeKb??10*1024,allowMultiple:e.data.multiple===!0}});for await(const o of r.value)await t.sendMessage({author:"user",type:"file",fileName:o.name,fileSizeKb:o.sizeKb});n(e.nextId)}async function xb({chat:e,end:t,node:n}){await e.sendMessage({type:"system",variant:"info",text:n.data.systemMessage||"Conversation finished"}),t()}const $d=Ae.union(Ae.string,Ae.array(Ae.string)),kb=(e,t)=>{const n=t==null?void 0:t[e.data.compareKey];return n?nt({...e.data,answer:n}).with({compare:"equals"},({compareValue:r})=>typeof n.value=="string"||typeof n.value=="boolean"?r===n.value.toString():!1).with({compare:"notEquals"},({compareValue:r})=>typeof n.value=="string"||typeof n.value=="boolean"?r!==n.value.toString():!1).with({compare:"contains",answer:{value:$d}},({compareValue:r,answer:o})=>o.value.includes(r)).with({compare:"notContains",answer:{value:$d}},({compareValue:r,answer:o})=>!o.value.includes(r)).with({answer:{type:"file"}},()=>!1).exhaustive():!1},ko=({class:e,...t})=>b("button",{class:Xt("bg-accent-7 active:bg-accent-10 active:text-accent-2 text-lowest pointer-coarse:touch-hitbox focus-visible:ring-accent-7/50 flex-shrink-0 rounded-full p-2 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:b("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",children:[b("title",{children:"Send"}),b("path",{d:"M3.5 7.5L8 3L12.5 7.5"}),b("path",{d:"M8 4V13"})]})}),Is=()=>{const e=U(null);return G(()=>{var t;(t=e.current)==null||t.focus()},[]),e},Sd=["true","false"],$b=eg(Sd),Sb="answer",Mb=({input:e,onSubmitSuccess:t,onHeightChange:n})=>{const r=Is();return n(),b("form",{noValidate:!0,class:"flex items-center gap-2",onSubmit:o=>{o.preventDefault();const i=nt(o).with({nativeEvent:{submitter:Ae.select(Ae.union(Ae.instanceOf(HTMLButtonElement),Ae.instanceOf(HTMLInputElement)))}},a=>a.value).otherwise(()=>{throw new Error("invalid form")}),s=rs($b,i);t(s)},children:Sd.map((o,i)=>b("button",{ref:i===0?r:null,type:"submit",name:Sb,value:o,class:"bg-lowest ease-expo-out ring-neutral-12/5 text-neutral-12 active:ring-accent-7 active:bg-accent-2 active:text-accent-11 fr duration-snappy block flex-1 overflow-hidden rounded-2xl px-2.5 py-2.5 ring-2 transition-all selection:bg-transparent",children:b("p",{class:"truncate text-center text-base",children:e.config.labels[o]})}))})},Fs=({error:e,onAnimationComplete:t})=>b(to,{children:e&&b(Kn.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},onAnimationComplete:t,role:"alert",class:"text-error-11 flex max-w-full items-center gap-1 overflow-hidden rounded-full p-0.5 px-1 opacity-0",children:[b("svg",{class:"text-error-10",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b("circle",{cx:"8",cy:"8",r:"6.3",stroke:"currentColor","stroke-width":"1.4"}),b("rect",{x:"7",y:"4",width:"2",height:"5",fill:"currentColor"}),b("rect",{x:"7",y:"10",width:"2",height:"2",fill:"currentColor"})]}),b("p",{class:"truncate pr-1 text-sm",children:e.message})]})}),Tb=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>r.result?t(r.result.toString()):n("No result from reader"),r.onerror=n}),$o=e=>nt(e).with(Ae.number.lte(1e3),()=>`${Math.round(e)}KB`).with(Ae.number.lt(1e3*10),()=>`${(e/1e3).toFixed(1)}MB`).otherwise(()=>`${Math.round(e/1e3)}MB`),Cb=e=>e.reduce((t,n)=>t+n.sizeKb,0),Ab=ts("file"),Md=3,Pb=({file:e,class:t,...n})=>{const r=e.name.split(".").pop(),o=e.name.replace(new RegExp(`.${r}$`),"");return b("div",{class:Xt("bg-accent-1 outline-neutral-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline",t),...n,children:[b("p",{"aria-label":"File name",class:"text-accent-12 flex flex-grow overflow-hidden",children:[b("span",{class:"block truncate",children:o}),b("span",{children:[".",r]})]}),b("p",{"aria-label":"File size",class:"text-neutral-10",children:$o(e.sizeKb)})]})},Td=({class:e,...t})=>b("li",{class:Xt("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1",e),...t}),Eb=({input:e,onSubmitSuccess:t,onHeightChange:n})=>{var l;const r=(l=ne.current$.value.application)==null?void 0:l.data.submissions[e.key],[o,i]=ae(Ab(r)?r.value:[]),[s,a]=ae(),c=o.length-Md,u=Cb(o),d=Is();return b("form",{class:"flex flex-col gap-1",onSubmit:f=>(f.preventDefault(),a(void 0),o.length===0?a({type:"required",message:"Please select a file"}):e.config.fileSizeLimitKib&&u>e.config.fileSizeLimitKib?a({type:"max",message:`File size exceeds limit of ${$o(e.config.fileSizeLimitKib)}`}):e.config.allowMultiple===!1&&o.length>1?a({type:"invalid",message:"Only one file is allowed"}):t(o)),children:[b("div",{class:"flex items-center gap-2",children:[b("label",{ref:d,for:"dropzone-file",class:"border-neutral-8 bg-neutral-2 flex h-48 w-full cursor-pointer flex-col items-center justify-center overflow-hidden rounded-2xl border border-dashed p-4",children:[o.length>0?b(ue,{children:[b("ul",{class:"flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",children:[o.slice(0,Md).map(f=>{const h=f.name.split(".").pop(),p=f.name.replace(new RegExp(`.${h}$`),"");return b(Td,{class:"flex overflow-hidden",children:[b("span",{class:"block truncate",children:p}),b("span",{children:[".",h]})]})}),c>0?b(Td,{children:["+",c," file",c!==1?"s":""]}):null]}),b("p",{class:"text-neutral-11 text-xs",children:[$o(u)," ",o.length>1?"total":""]})]}):b("div",{class:"flex flex-col justify-center gap-4 pb-6 pt-5",children:[b("header",{class:"flex flex-col items-center gap-0",children:[b("svg",{class:"text-neutral-11 mb-1 h-8 w-8","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 16",children:b("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"})}),b("p",{class:"text-neutral-12 tracking-[-0.01em] dark:text-gray-400",children:[e.config.allowMultiple?"Select files":"Select a file"," to upload"]}),e.config.fileSizeLimitKib?b("p",{class:"text-neutral-10 text-xs",children:["(max ",$o(e.config.fileSizeLimitKib),")"]}):null]}),b("aside",{class:"flex flex-col items-center gap-2",children:[b("p",{id:"accepted-filetypes",class:"sr-only",children:"Accepted file extensions"}),b("ul",{"aria-describedby":"accepted-filetypes",class:"flex flex-wrap justify-center gap-2",children:e.config.extensions.map(f=>b("li",{class:"ring-lowest outline-neutral-6 text-neutral-9 bg-neutral-1 rounded-md px-1 py-0.5 text-[11px] uppercase tracking-wide outline outline-1 ring-2",children:f.replace(".","")}))})]})]}),b("input",{id:"dropzone-file",onInput:async f=>{rn(f.target instanceof HTMLInputElement);const h=f.target.files?Array.from(f.target.files):[],p=await Promise.allSettled(h.map(async y=>{const x=await Tb(y);return{name:y.name,data:x,sizeKb:y.size/1e3}}));if(p.some(({status:y})=>y==="rejected"))return a({type:"invalid",message:"Invalid file"});const m=p.map(y=>y.status==="fulfilled"?y.value:null).filter(Boolean);i(m)},multiple:e.config.allowMultiple,type:"file",class:"sr-only"})]}),b(ko,{disabled:o.length===0})]}),s&&b(Fs,{onAnimationComplete:n,error:s})]})};var lr=e=>e.type==="checkbox",Mn=e=>e instanceof Date,Me=e=>e==null;const Cd=e=>typeof e=="object";var fe=e=>!Me(e)&&!Array.isArray(e)&&Cd(e)&&!Mn(e),Vb=e=>fe(e)&&e.target?lr(e.target)?e.target.checked:e.target.value:e,Ob=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Lb=(e,t)=>e.has(Ob(t)),Nb=e=>{const t=e.constructor&&e.constructor.prototype;return fe(t)&&t.hasOwnProperty("isPrototypeOf")},Ds=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ct(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Ds&&(e instanceof Blob||e instanceof FileList))&&(n||fe(e)))if(t=n?[]:{},!n&&!Nb(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=ct(e[r]));else return e;return t}var ur=e=>Array.isArray(e)?e.filter(Boolean):[],ie=e=>e===void 0,O=(e,t,n)=>{if(!t||!fe(e))return n;const r=ur(t.split(/[,[\].]+?/)).reduce((o,i)=>Me(o)?o:o[i],e);return ie(r)||r===e?ie(e[t])?n:e[t]:r},Tt=e=>typeof e=="boolean";const Ad={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ze={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},lt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};De.createContext(null);var Rb=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const s=i;return t._proxyFormState[s]!==ze.all&&(t._proxyFormState[s]=!r||ze.all),n&&(n[s]=!0),e[s]}});return o},Oe=e=>fe(e)&&!Object.keys(e).length,Ib=(e,t,n,r)=>{n(e);const{name:o,...i}=e;return Oe(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!r||ze.all))},zs=e=>Array.isArray(e)?e:[e];function Fb(e){const t=De.useRef(e);t.current=e,De.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}var Ye=e=>typeof e=="string",Db=(e,t,n,r,o)=>Ye(e)?(r&&t.watch.add(e),O(n,e,o)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),O(n,i))):(r&&(t.watchAll=!0),n),Bs=e=>/^\w*$/.test(e),Pd=e=>ur(e.replace(/["|']|\]/g,"").split(/\.|\[/));function Q(e,t,n){let r=-1;const o=Bs(t)?[t]:Pd(t),i=o.length,s=i-1;for(;++r<i;){const a=o[r];let c=n;if(r!==s){const u=e[a];c=fe(u)||Array.isArray(u)?u:isNaN(+o[r+1])?{}:[]}e[a]=c,e=e[a]}return e}var Ed=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},Vd=e=>({isOnSubmit:!e||e===ze.onSubmit,isOnBlur:e===ze.onBlur,isOnChange:e===ze.onChange,isOnAll:e===ze.all,isOnTouch:e===ze.onTouched}),Od=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const So=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const i=O(e,o);if(i){const{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],o)&&!r)break;if(s.ref&&t(s.ref,s.name)&&!r)break}else fe(a)&&So(a,t)}}};var zb=(e,t,n)=>{const r=ur(O(e,n));return Q(r,"root",t[n]),Q(e,n,r),e},js=e=>e.type==="file",Ct=e=>typeof e=="function",Mo=e=>{if(!Ds)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},To=e=>Ye(e),Hs=e=>e.type==="radio",Co=e=>e instanceof RegExp;const Ld={value:!1,isValid:!1},Nd={value:!0,isValid:!0};var Rd=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ie(e[0].attributes.value)?ie(e[0].value)||e[0].value===""?Nd:{value:e[0].value,isValid:!0}:Nd:Ld}return Ld};const Id={isValid:!1,value:null};var Fd=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Id):Id;function Dd(e,t,n="validate"){if(To(e)||Array.isArray(e)&&e.every(To)||Tt(e)&&!e)return{type:n,message:To(e)?e:"",ref:t}}var Tn=e=>fe(e)&&!Co(e)?e:{value:e,message:""},zd=async(e,t,n,r,o)=>{const{ref:i,refs:s,required:a,maxLength:c,minLength:u,min:d,max:l,pattern:f,validate:h,name:p,valueAsNumber:m,mount:y,disabled:x}=e._f,g=O(t,p);if(!y||x)return{};const w=s?s[0]:i,M=j=>{r&&w.reportValidity&&(w.setCustomValidity(Tt(j)?"":j||""),w.reportValidity())},S={},I=Hs(i),N=lr(i),C=I||N,E=(m||js(i))&&ie(i.value)&&ie(g)||Mo(i)&&i.value===""||g===""||Array.isArray(g)&&!g.length,q=Ed.bind(null,p,n,S),K=(j,B,H,X=lt.maxLength,re=lt.minLength)=>{const se=j?B:H;S[p]={type:j?X:re,message:se,ref:i,...q(j?X:re,se)}};if(o?!Array.isArray(g)||!g.length:a&&(!C&&(E||Me(g))||Tt(g)&&!g||N&&!Rd(s).isValid||I&&!Fd(s).isValid)){const{value:j,message:B}=To(a)?{value:!!a,message:a}:Tn(a);if(j&&(S[p]={type:lt.required,message:B,ref:w,...q(lt.required,B)},!n))return M(B),S}if(!E&&(!Me(d)||!Me(l))){let j,B;const H=Tn(l),X=Tn(d);if(!Me(g)&&!isNaN(g)){const re=i.valueAsNumber||g&&+g;Me(H.value)||(j=re>H.value),Me(X.value)||(B=re<X.value)}else{const re=i.valueAsDate||new Date(g),se=ut=>new Date(new Date().toDateString()+" "+ut),Le=i.type=="time",Ne=i.type=="week";Ye(H.value)&&g&&(j=Le?se(g)>se(H.value):Ne?g>H.value:re>new Date(H.value)),Ye(X.value)&&g&&(B=Le?se(g)<se(X.value):Ne?g<X.value:re<new Date(X.value))}if((j||B)&&(K(!!j,H.message,X.message,lt.max,lt.min),!n))return M(S[p].message),S}if((c||u)&&!E&&(Ye(g)||o&&Array.isArray(g))){const j=Tn(c),B=Tn(u),H=!Me(j.value)&&g.length>+j.value,X=!Me(B.value)&&g.length<+B.value;if((H||X)&&(K(H,j.message,B.message),!n))return M(S[p].message),S}if(f&&!E&&Ye(g)){const{value:j,message:B}=Tn(f);if(Co(j)&&!g.match(j)&&(S[p]={type:lt.pattern,message:B,ref:i,...q(lt.pattern,B)},!n))return M(B),S}if(h){if(Ct(h)){const j=await h(g,t),B=Dd(j,w);if(B&&(S[p]={...B,...q(lt.validate,B.message)},!n))return M(B.message),S}else if(fe(h)){let j={};for(const B in h){if(!Oe(j)&&!n)break;const H=Dd(await h[B](g,t),w,B);H&&(j={...H,...q(B,H.message)},M(H.message),n&&(S[p]=j))}if(!Oe(j)&&(S[p]={ref:w,...j},!n))return S}}return M(!0),S};function Bb(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=ie(e)?r++:e[t[r++]];return e}function jb(e){for(const t in e)if(e.hasOwnProperty(t)&&!ie(e[t]))return!1;return!0}function ye(e,t){const n=Array.isArray(t)?t:Bs(t)?[t]:Pd(t),r=n.length===1?e:Bb(e,n),o=n.length-1,i=n[o];return r&&delete r[i],o!==0&&(fe(r)&&Oe(r)||Array.isArray(r)&&jb(r))&&ye(e,n.slice(0,-1)),e}function Us(){let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}}var Ao=e=>Me(e)||!Cd(e);function Yt(e,t){if(Ao(e)||Ao(t))return e===t;if(Mn(e)&&Mn(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const i=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const s=t[o];if(Mn(i)&&Mn(s)||fe(i)&&fe(s)||Array.isArray(i)&&Array.isArray(s)?!Yt(i,s):i!==s)return!1}}return!0}var Bd=e=>e.type==="select-multiple",Hb=e=>Hs(e)||lr(e),Xs=e=>Mo(e)&&e.isConnected,jd=e=>{for(const t in e)if(Ct(e[t]))return!0;return!1};function Po(e,t={}){const n=Array.isArray(e);if(fe(e)||n)for(const r in e)Array.isArray(e[r])||fe(e[r])&&!jd(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Po(e[r],t[r])):Me(e[r])||(t[r]=!0);return t}function Hd(e,t,n){const r=Array.isArray(e);if(fe(e)||r)for(const o in e)Array.isArray(e[o])||fe(e[o])&&!jd(e[o])?ie(t)||Ao(n[o])?n[o]=Array.isArray(e[o])?Po(e[o],[]):{...Po(e[o])}:Hd(e[o],Me(t)?{}:t[o],n[o]):n[o]=!Yt(e[o],t[o]);return n}var qs=(e,t)=>Hd(e,t,Po(t)),Ud=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>ie(e)?e:t?e===""?NaN:e&&+e:n&&Ye(e)?new Date(e):r?r(e):e;function Ws(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return js(t)?t.files:Hs(t)?Fd(e.refs).value:Bd(t)?[...t.selectedOptions].map(({value:n})=>n):lr(t)?Rd(e.refs).value:Ud(ie(t.value)?e.ref.value:t.value,e)}var Ub=(e,t,n,r)=>{const o={};for(const i of e){const s=O(t,i);s&&Q(o,i,s._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},dr=e=>ie(e)?e:Co(e)?e.source:fe(e)?Co(e.value)?e.value.source:e.value:e,Xb=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Xd(e,t,n){const r=O(e,n);if(r||Bs(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const i=o.join("."),s=O(t,i),a=O(e,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(a&&a.type)return{name:i,error:a};o.pop()}return{name:n}}var qb=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,Wb=(e,t)=>!ur(O(e,t)).length&&ye(e,t);const Kb={mode:ze.onSubmit,reValidateMode:ze.onChange,shouldFocusError:!0};function Yb(e={},t){let n={...Kb,...e},r={submitCount:0,isDirty:!1,isLoading:Ct(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{},disabled:!1},o={},i=fe(n.defaultValues)||fe(n.values)?ct(n.defaultValues||n.values)||{}:{},s=n.shouldUnregister?{}:ct(i),a={action:!1,mount:!1,watch:!1},c={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,d=0;const l={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:Us(),array:Us(),state:Us()},h=e.resetOptions&&e.resetOptions.keepDirtyValues,p=Vd(n.mode),m=Vd(n.reValidateMode),y=n.criteriaMode===ze.all,x=v=>_=>{clearTimeout(d),d=setTimeout(v,_)},g=async v=>{if(l.isValid||v){const _=n.resolver?Oe((await E()).errors):await K(o,!0);_!==r.isValid&&f.state.next({isValid:_})}},w=v=>l.isValidating&&f.state.next({isValidating:v}),M=(v,_=[],k,L,P=!0,T=!0)=>{if(L&&k){if(a.action=!0,T&&Array.isArray(O(o,v))){const F=k(O(o,v),L.argA,L.argB);P&&Q(o,v,F)}if(T&&Array.isArray(O(r.errors,v))){const F=k(O(r.errors,v),L.argA,L.argB);P&&Q(r.errors,v,F),Wb(r.errors,v)}if(l.touchedFields&&T&&Array.isArray(O(r.touchedFields,v))){const F=k(O(r.touchedFields,v),L.argA,L.argB);P&&Q(r.touchedFields,v,F)}l.dirtyFields&&(r.dirtyFields=qs(i,s)),f.state.next({name:v,isDirty:B(v,_),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Q(s,v,_)},S=(v,_)=>{Q(r.errors,v,_),f.state.next({errors:r.errors})},I=(v,_,k,L)=>{const P=O(o,v);if(P){const T=O(s,v,ie(k)?O(i,v):k);ie(T)||L&&L.defaultChecked||_?Q(s,v,_?T:Ws(P._f)):re(v,T),a.mount&&g()}},N=(v,_,k,L,P)=>{let T=!1,F=!1;const ee={name:v};if(!k||L){l.isDirty&&(F=r.isDirty,r.isDirty=ee.isDirty=B(),T=F!==ee.isDirty);const le=Yt(O(i,v),_);F=O(r.dirtyFields,v),le?ye(r.dirtyFields,v):Q(r.dirtyFields,v,!0),ee.dirtyFields=r.dirtyFields,T=T||l.dirtyFields&&F!==!le}if(k){const le=O(r.touchedFields,v);le||(Q(r.touchedFields,v,k),ee.touchedFields=r.touchedFields,T=T||l.touchedFields&&le!==k)}return T&&P&&f.state.next(ee),T?ee:{}},C=(v,_,k,L)=>{const P=O(r.errors,v),T=l.isValid&&Tt(_)&&r.isValid!==_;if(e.delayError&&k?(u=x(()=>S(v,k)),u(e.delayError)):(clearTimeout(d),u=null,k?Q(r.errors,v,k):ye(r.errors,v)),(k?!Yt(P,k):P)||!Oe(L)||T){const F={...L,...T&&Tt(_)?{isValid:_}:{},errors:r.errors,name:v};r={...r,...F},f.state.next(F)}w(!1)},E=async v=>n.resolver(s,n.context,Ub(v||c.mount,o,n.criteriaMode,n.shouldUseNativeValidation)),q=async v=>{const{errors:_}=await E(v);if(v)for(const k of v){const L=O(_,k);L?Q(r.errors,k,L):ye(r.errors,k)}else r.errors=_;return _},K=async(v,_,k={valid:!0})=>{for(const L in v){const P=v[L];if(P){const{_f:T,...F}=P;if(T){const ee=c.array.has(T.name),le=await zd(P,s,y,n.shouldUseNativeValidation&&!_,ee);if(le[T.name]&&(k.valid=!1,_))break;!_&&(O(le,T.name)?ee?zb(r.errors,le,T.name):Q(r.errors,T.name,le[T.name]):ye(r.errors,T.name))}F&&await K(F,_,k)}}return k.valid},j=()=>{for(const v of c.unMount){const _=O(o,v);_&&(_._f.refs?_._f.refs.every(k=>!Xs(k)):!Xs(_._f.ref))&&Ze(v)}c.unMount=new Set},B=(v,_)=>(v&&_&&Q(s,v,_),!Yt(Re(),i)),H=(v,_,k)=>Db(v,c,{...a.mount?s:ie(_)?i:Ye(v)?{[v]:_}:_},k,_),X=v=>ur(O(a.mount?s:i,v,e.shouldUnregister?O(i,v,[]):[])),re=(v,_,k={})=>{const L=O(o,v);let P=_;if(L){const T=L._f;T&&(!T.disabled&&Q(s,v,Ud(_,T)),P=Mo(T.ref)&&Me(_)?"":_,Bd(T.ref)?[...T.ref.options].forEach(F=>F.selected=P.includes(F.value)):T.refs?lr(T.ref)?T.refs.length>1?T.refs.forEach(F=>(!F.defaultChecked||!F.disabled)&&(F.checked=Array.isArray(P)?!!P.find(ee=>ee===F.value):P===F.value)):T.refs[0]&&(T.refs[0].checked=!!P):T.refs.forEach(F=>F.checked=F.value===P):js(T.ref)?T.ref.value="":(T.ref.value=P,T.ref.type||f.values.next({name:v,values:{...s}})))}(k.shouldDirty||k.shouldTouch)&&N(v,P,k.shouldTouch,k.shouldDirty,!0),k.shouldValidate&&Y(v)},se=(v,_,k)=>{for(const L in _){const P=_[L],T=`${v}.${L}`,F=O(o,T);(c.array.has(v)||!Ao(P)||F&&!F._f)&&!Mn(P)?se(T,P,k):re(T,P,k)}},Le=(v,_,k={})=>{const L=O(o,v),P=c.array.has(v),T=ct(_);Q(s,v,T),P?(f.array.next({name:v,values:{...s}}),(l.isDirty||l.dirtyFields)&&k.shouldDirty&&f.state.next({name:v,dirtyFields:qs(i,s),isDirty:B(v,T)})):L&&!L._f&&!Me(T)?se(v,T,k):re(v,T,k),Od(v,c)&&f.state.next({...r}),f.values.next({name:v,values:{...s}}),!a.mount&&t()},Ne=async v=>{const _=v.target;let k=_.name,L=!0;const P=O(o,k),T=()=>_.type?Ws(P._f):Vb(v),F=ee=>{L=Number.isNaN(ee)||ee===O(s,k,ee)};if(P){let ee,le;const Lo=T(),Cn=v.type===Ad.BLUR||v.type===Ad.FOCUS_OUT,xy=!Xb(P._f)&&!n.resolver&&!O(r.errors,k)&&!P._f.deps||qb(Cn,O(r.touchedFields,k),r.isSubmitted,m,p),Ks=Od(k,c,Cn);Q(s,k,Lo),Cn?(P._f.onBlur&&P._f.onBlur(v),u&&u(0)):P._f.onChange&&P._f.onChange(v);const Ys=N(k,Lo,Cn,!1),ky=!Oe(Ys)||Ks;if(!Cn&&f.values.next({name:k,type:v.type,values:{...s}}),xy)return l.isValid&&g(),ky&&f.state.next({name:k,...Ks?{}:Ys});if(!Cn&&Ks&&f.state.next({...r}),w(!0),n.resolver){const{errors:ef}=await E([k]);if(F(Lo),L){const $y=Xd(r.errors,o,k),tf=Xd(ef,o,$y.name||k);ee=tf.error,k=tf.name,le=Oe(ef)}}else ee=(await zd(P,s,y,n.shouldUseNativeValidation))[k],F(Lo),L&&(ee?le=!1:l.isValid&&(le=await K(o,!0)));L&&(P._f.deps&&Y(P._f.deps),C(k,le,ee,Ys))}},ut=(v,_)=>{if(O(r.errors,_)&&v.focus)return v.focus(),1},Y=async(v,_={})=>{let k,L;const P=zs(v);if(w(!0),n.resolver){const T=await q(ie(v)?v:P);k=Oe(T),L=v?!P.some(F=>O(T,F)):k}else v?(L=(await Promise.all(P.map(async T=>{const F=O(o,T);return await K(F&&F._f?{[T]:F}:F)}))).every(Boolean),!(!L&&!r.isValid)&&g()):L=k=await K(o);return f.state.next({...!Ye(v)||l.isValid&&k!==r.isValid?{}:{name:v},...n.resolver||!v?{isValid:k}:{},errors:r.errors,isValidating:!1}),_.shouldFocus&&!L&&So(o,ut,v?P:c.mount),L},Re=v=>{const _={...i,...a.mount?s:{}};return ie(v)?_:Ye(v)?O(_,v):v.map(k=>O(_,k))},At=(v,_)=>({invalid:!!O((_||r).errors,v),isDirty:!!O((_||r).dirtyFields,v),isTouched:!!O((_||r).touchedFields,v),error:O((_||r).errors,v)}),Pt=v=>{v&&zs(v).forEach(_=>ye(r.errors,_)),f.state.next({errors:v?r.errors:{}})},Gt=(v,_,k)=>{const L=(O(o,v,{_f:{}})._f||{}).ref;Q(r.errors,v,{..._,ref:L}),f.state.next({name:v,errors:r.errors,isValid:!1}),k&&k.shouldFocus&&L&&L.focus&&L.focus()},Ge=(v,_)=>Ct(v)?f.values.subscribe({next:k=>v(H(void 0,_),k)}):H(v,_,!0),Ze=(v,_={})=>{for(const k of v?zs(v):c.mount)c.mount.delete(k),c.array.delete(k),_.keepValue||(ye(o,k),ye(s,k)),!_.keepError&&ye(r.errors,k),!_.keepDirty&&ye(r.dirtyFields,k),!_.keepTouched&&ye(r.touchedFields,k),!n.shouldUnregister&&!_.keepDefaultValue&&ye(i,k);f.values.next({values:{...s}}),f.state.next({...r,..._.keepDirty?{isDirty:B()}:{}}),!_.keepIsValid&&g()},Vo=({disabled:v,name:_,field:k,fields:L,value:P})=>{if(Tt(v)){const T=v?void 0:ie(P)?Ws(k?k._f:O(L,_)._f):P;Q(s,_,T),N(_,T,!1,!1,!0)}},Zt=(v,_={})=>{let k=O(o,v);const L=Tt(_.disabled);return Q(o,v,{...k||{},_f:{...k&&k._f?k._f:{ref:{name:v}},name:v,mount:!0,..._}}),c.mount.add(v),k?Vo({field:k,disabled:_.disabled,name:v}):I(v,!0,_.value),{...L?{disabled:_.disabled}:{},...n.progressive?{required:!!_.required,min:dr(_.min),max:dr(_.max),minLength:dr(_.minLength),maxLength:dr(_.maxLength),pattern:dr(_.pattern)}:{},name:v,onChange:Ne,onBlur:Ne,ref:P=>{if(P){Zt(v,_),k=O(o,v);const T=ie(P.value)&&P.querySelectorAll&&P.querySelectorAll("input,select,textarea")[0]||P,F=Hb(T),ee=k._f.refs||[];if(F?ee.find(le=>le===T):T===k._f.ref)return;Q(o,v,{_f:{...k._f,...F?{refs:[...ee.filter(Xs),T,...Array.isArray(O(i,v))?[{}]:[]],ref:{type:T.type,name:v}}:{ref:T}}}),I(v,!1,void 0,T)}else k=O(o,v,{}),k._f&&(k._f.mount=!1),(n.shouldUnregister||_.shouldUnregister)&&!(Lb(c.array,v)&&a.action)&&c.unMount.add(v)}}},Jt=()=>n.shouldFocusError&&So(o,ut,c.mount),dt=v=>{Tt(v)&&(f.state.next({disabled:v}),So(o,_=>{_.disabled=v},0,!1))},fr=(v,_)=>async k=>{k&&(k.preventDefault&&k.preventDefault(),k.persist&&k.persist());let L=ct(s);if(f.state.next({isSubmitting:!0}),n.resolver){const{errors:P,values:T}=await E();r.errors=P,L=T}else await K(o);ye(r.errors,"root"),Oe(r.errors)?(f.state.next({errors:{}}),await v(L,k)):(_&&await _({...r.errors},k),Jt(),setTimeout(Jt)),f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Oe(r.errors),submitCount:r.submitCount+1,errors:r.errors})},Oo=(v,_={})=>{O(o,v)&&(ie(_.defaultValue)?Le(v,O(i,v)):(Le(v,_.defaultValue),Q(i,v,_.defaultValue)),_.keepTouched||ye(r.touchedFields,v),_.keepDirty||(ye(r.dirtyFields,v),r.isDirty=_.defaultValue?B(v,O(i,v)):B()),_.keepError||(ye(r.errors,v),l.isValid&&g()),f.state.next({...r}))},Jd=(v,_={})=>{const k=v?ct(v):i,L=ct(k),P=v&&!Oe(v)?L:i;if(_.keepDefaultValues||(i=k),!_.keepValues){if(_.keepDirtyValues||h)for(const T of c.mount)O(r.dirtyFields,T)?Q(P,T,O(s,T)):Le(T,O(P,T));else{if(Ds&&ie(v))for(const T of c.mount){const F=O(o,T);if(F&&F._f){const ee=Array.isArray(F._f.refs)?F._f.refs[0]:F._f.ref;if(Mo(ee)){const le=ee.closest("form");if(le){le.reset();break}}}}o={}}s=e.shouldUnregister?_.keepDefaultValues?ct(i):{}:ct(P),f.array.next({values:{...P}}),f.values.next({values:{...P}})}c={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!a.mount&&t(),a.mount=!l.isValid||!!_.keepIsValid,a.watch=!!e.shouldUnregister,f.state.next({submitCount:_.keepSubmitCount?r.submitCount:0,isDirty:_.keepDirty?r.isDirty:!!(_.keepDefaultValues&&!Yt(v,i)),isSubmitted:_.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:_.keepDirtyValues?r.dirtyFields:_.keepDefaultValues&&v?qs(i,v):{},touchedFields:_.keepTouched?r.touchedFields:{},errors:_.keepErrors?r.errors:{},isSubmitSuccessful:_.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},Qd=(v,_)=>Jd(Ct(v)?v(s):v,_);return{control:{register:Zt,unregister:Ze,getFieldState:At,handleSubmit:fr,setError:Gt,_executeSchema:E,_getWatch:H,_getDirty:B,_updateValid:g,_removeUnmounted:j,_updateFieldArray:M,_updateDisabledField:Vo,_getFieldArray:X,_reset:Jd,_resetDefaultValues:()=>Ct(n.defaultValues)&&n.defaultValues().then(v=>{Qd(v,n.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:v=>{r={...r,...v}},_disableForm:dt,_subjects:f,_proxyFormState:l,get _fields(){return o},get _formValues(){return s},get _state(){return a},set _state(v){a=v},get _defaultValues(){return i},get _names(){return c},set _names(v){c=v},get _formState(){return r},set _formState(v){r=v},get _options(){return n},set _options(v){n={...n,...v}}},trigger:Y,register:Zt,handleSubmit:fr,watch:Ge,setValue:Le,getValues:Re,reset:Qd,resetField:Oo,clearErrors:Pt,unregister:Ze,setError:Gt,setFocus:(v,_={})=>{const k=O(o,v),L=k&&k._f;if(L){const P=L.refs?L.refs[0]:L.ref;P.focus&&(P.focus(),_.shouldSelect&&P.select())}},getFieldState:At}}function qd(e={}){const t=De.useRef(),n=De.useRef(),[r,o]=De.useState({isDirty:!1,isValidating:!1,isLoading:Ct(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},disabled:!1,defaultValues:Ct(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Yb(e,()=>o(s=>({...s}))),formState:r});const i=t.current.control;return i._options=e,Fb({subject:i._subjects.state,next:s=>{Ib(s,i._proxyFormState,i._updateFormState,!0)&&o({...i._formState})}}),De.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),De.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==r.isDirty&&i._subjects.state.next({isDirty:s})}},[i,r.isDirty]),De.useEffect(()=>{e.values&&!Yt(e.values,n.current)?(i._reset(e.values,i._options.resetOptions),n.current=e.values):i._resetDefaultValues()},[e.values,i]),De.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=Rb(r,i),t.current}var Wd=function(e,t,n){if(e&&"reportValidity"in e){var r=O(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Gb=function(e,t){var n=function(o){var i=t.fields[o];i&&i.ref&&"reportValidity"in i.ref?Wd(i.ref,o,e):i.refs&&i.refs.forEach(function(s){return Wd(s,o,e)})};for(var r in t.fields)n(r)},Zb=function(e,t){t.shouldUseNativeValidation&&Gb(e,t);var n={};for(var r in e){var o=O(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(Qb(t.names||Object.keys(e),r)){var s=Object.assign({},Jb(O(n,r)));Q(s,"root",i),Q(n,r,s)}else Q(n,r,i)}return n},Jb=function(e){return Array.isArray(e)?e.filter(Boolean):[]},Qb=function(e,t){return e.some(function(n){return n.startsWith(t+".")})},ey=function(e,t){for(var n={};e.issues.length;){var r=e.issues[0];if(r.path){var o=r.path.map(function(a){return a.key}).join(".");if(n[o]||(n[o]={message:r.message,type:r.validation}),t){var i=n[o].types,s=i&&i[r.validation];n[o]=Ed(o,t,n,r.validation,s?[].concat(s,r.message):r.message)}e.issues.shift()}}return n},Kd=function(e,t,n){return n===void 0&&(n={}),function(r,o,i){try{return Promise.resolve(function(s,a){try{var c=function(){function u(l){return{values:n.raw?r:l,errors:{}}}var d=Object.assign({},{abortEarly:!1,abortPipeEarly:!1},t);return n.mode==="sync"?u(rs(e,r,d)):Promise.resolve(og(e,r,d)).then(u)}()}catch(u){return a(u)}return c&&c.then?c.then(void 0,a):c}(0,function(s){if(s instanceof so)return{values:{},errors:Zb(ey(s,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}}};const ty=e=>{const t=Object.fromEntries(new FormData(e).entries());Object.keys(t).length&&e.dispatchEvent(new Event("submit",{bubbles:!0}))},ny=ts("multiple-choice"),ry=e=>{const t={min:e.minSelected??0,max:e.maxSelected??e.options.length};return Kd(bn({checked:ku(rg(Zv()),n=>Object.entries(n).filter(([r,o])=>o).map(([r,o])=>r),[ag(t.max,`Please select at most ${t.max} option${t.max!==1?"s":""}`),$u(t.min,`Please select at least ${t.min} option${t.min!==1?"s":""}`)])}))},oy=({input:e,onSubmitSuccess:t,onHeightChange:n})=>{var u,d;const r=e.key?(u=ne.current$.value.application)==null?void 0:u.data.submissions[e.key]:void 0,{register:o,handleSubmit:i,formState:{errors:s}}=qd({defaultValues:{checked:ny(r)?Object.fromEntries(r.value.map(l=>[l,!0])):{}},resolver:ry(e.config)}),a=Is(),c=e.config.minSelected===1&&e.config.maxSelected===1;return b("form",{noValidate:!0,class:"flex flex-col gap-1",onChange:l=>{c&&ty(l.currentTarget)},onSubmit:i(l=>{const f=l.checked;t(f)}),children:[b("div",{class:"flex items-center gap-2",children:[b("div",{class:Xt("flex w-full flex-1 flex-wrap gap-3 p-1",{"justify-center":e.config.options.length===1}),children:e.config.options.map((l,f)=>{const h=`checked.${l.value}`,{ref:p,...m}=o(h);return b("div",{children:[b("input",{autoFocus:f===0,ref:y=>{y&&f===0&&(a.current=y),p(y)},id:h,...m,class:"peer sr-only",type:"checkbox"}),b("label",{class:"bg-lowest peer-focus-visible:ring-accent-7 active:outline-neutral-10 ease-expo-out outline-neutral-12/5 text-neutral-11 peer-checked:outline-accent-7 peer-checked:bg-accent-2 peer-checked:text-accent-9 duration-snappy block rounded-2xl px-2.5 py-1 outline outline-2 ring-0 ring-transparent transition-all selection:bg-transparent peer-focus-visible:ring-4 peer-focus-visible:ring-offset-2",htmlFor:h,children:l.label})]},l.value)})}),!c&&b(ko,{})]}),b(Fs,{onAnimationComplete:n,error:(d=s.checked)==null?void 0:d.root})]})},Eo={email:"That doesn’t look like a valid email address",phone:"That doesn’t look like a valid phone number"},iy=We(Eo.phone,[cg(/^\+?[0-9 -]+$/,Eo.phone)]),sy={email:We(Eo.email,[sg(Eo.email)]),phone:ku(iy,e=>e.replace(/[^0-9]/g,"")),text:We([$u(1,"Please enter some text")]),url:We([lg("That doesn’t look like a valid URL")])},ay={email:{type:"email",inputMode:"email",formNoValidate:!0},phone:{type:"tel",inputMode:"tel"},text:{type:"text",inputMode:"text"},url:{type:"url",inputMode:"url",formNoValidate:!0}},cy=ts("text"),ly=e=>Kd(bn({text:sy[e.format]})),uy=({input:e,onSubmitSuccess:t,onHeightChange:n})=>{var d;const r=e.key?(d=ne.current$.value.application)==null?void 0:d.data.submissions[e.key]:void 0,{register:o,handleSubmit:i,formState:{errors:s}}=qd({defaultValues:{text:cy(r)?r.value:""},resolver:ly(e.config)}),{ref:a,...c}=o("text",{required:!0}),u=U();return Be(()=>{u.current&&(u.current.focus(),u.current.select())},[]),b("form",{noValidate:!0,class:"flex flex-col gap-1",onSubmit:i(l=>{t(l.text)}),children:[b("div",{class:"flex items-center gap-2",children:[b("input",{id:"chat-input",...c,...ay[e.config.format],autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:l=>{l&&(u.current=l),a(l)},class:"outline-neutral-12/5 ease-expo-out placeholder:text-neutral-5 focus-visible:outline-accent-7 caret-accent-9 duration-snappy flex-grow rounded-full px-3 py-1 text-base outline outline-2 transition-all",placeholder:e.config.placeholder}),b(ko,{})]}),b(Fs,{onAnimationComplete:n,error:s.text})]})},dy=({onSubmit:e,onInputChange:t,input:n})=>{const r=U(null),o=me(()=>{r.current&&(ns.value=r.current.getBoundingClientRect().height)},[]);G(()=>{o(),t(n==null?void 0:n.type)},[n==null?void 0:n.type,t,o]);const i=s=>a=>e({type:s,value:a});return b(Kn.div,{initial:{height:0},animate:{height:ns.value},exit:{height:0,opacity:0},class:"bg-neutral-2/80 absolute bottom-0 w-full overflow-hidden rounded-b-3xl backdrop-blur-md backdrop-saturate-150",children:b("div",{ref:r,class:"border-neutral-12/5 border-t p-2.5",children:nt({application:ne,input:n,onHeightChange:o}).with({input:Ae.nullish},()=>b("div",{class:"flex items-center gap-2",children:[b("input",{"aria-hidden":"true",id:"chat-input",class:"outline-neutral-12/5 placeholder:text-neutral-4 focus-visible:outline-accent-9 caret-accent-9 flex-grow rounded-full px-3 py-1 text-base outline outline-2",disabled:!0}),b(ko,{disabled:!0,"aria-hidden":"true",tabIndex:-1})]})).with({input:{type:"text"}},s=>b(uy,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"multiple-choice"}},s=>b(oy,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"boolean"}},s=>b(Mb,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"file"}},s=>b(Eb,{onSubmitSuccess:i(s.input.type),...s})).exhaustive()})})},Yd=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,Gd=Xt,Zd=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Gd(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(u=>{const d=n==null?void 0:n[u],l=i==null?void 0:i[u];if(d===null)return null;const f=Yd(d)||Yd(l);return o[u][f]}),a=n&&Object.entries(n).reduce((u,d)=>{let[l,f]=d;return f===void 0||(u[l]=f),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:l,className:f,...h}=d;return Object.entries(h).every(p=>{let[m,y]=p;return Array.isArray(y)?y.includes({...i,...a}[m]):{...i,...a}[m]===y})?[...u,l,f]:u},[]);return Gd(e,s,c,n==null?void 0:n.class,n==null?void 0:n.className)},fy=Zd("max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink-1 min-w-[2rem] text-md py-2 px-3 rounded-[18px] min-h-[36px] break-words",{variants:{side:{left:"bg-lowest text-neutral-12 shadow-surface-sm outline outline-1 outline-neutral-11/[.08] rounded-bl-md",right:"ml-auto bg-accent-7 text-lowest rounded-br-md bubble-right"},transitionState:{entering:"opacity-0 translate-y-8",entered:"opacity-100 translate-y-0",exiting:"opacity-0 scale-0",exited:""}},defaultVariants:{side:"left"}}),hy={hidden:{y:"100%",scale:.75},shown:{y:0,scale:1}},py=({children:e,className:t,transitionState:n,side:r,...o})=>b(Kn.p,{variants:hy,initial:"hidden",animate:"shown",transition:{type:"spring",damping:25,stiffness:500},"data-transition":n,style:{transformOrigin:r==="left"?"0% 50%":"100% 50%"},class:fy({className:t,side:r,transitionState:n}),...o,children:e}),my=({className:e,...t})=>b("div",{"aria-label":"Typing…",class:Xt("flex gap-1 p-4",e),...t,children:Array.from({length:3},(n,r)=>b("div",{class:"bg-accent-7 h-1.5 w-1.5 animate-bounce rounded-full",style:{animationDelay:`${-r*200}ms`}}))}),vy={bot:"left",user:"right"},gy=Zd("w-full select-none py-2 text-center text-[10px] uppercase tracking-widest drop-shadow-[0_1.5px_white]",{variants:{variant:{info:"text-neutral-8",warning:"text-[#FFC107]",error:"text-error-9",success:"text-[#4CAF50]"}}}),by=({messages:e,isBotTyping:t})=>b("ol",{"aria-label":"Chat messages",class:"flex flex-grow flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",children:[b(to,{initial:!1,children:e.map((n,r)=>b("li",{class:"flex",children:nt(n).with({type:"system"},o=>b("p",{class:gy({variant:o.variant}),children:o.text})).with({type:"text",author:Ae.union("bot","user")},o=>b(py,{side:vy[o.author],children:o.text},r)).with({type:"link"},o=>b("div",{class:"bg-accent-8/5 flex w-full items-center justify-center overflow-hidden rounded-xl py-2",children:b("a",{class:"bg-lowest shadow-surface-sm ring-accent-8/20 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 flex items-center gap-1.5 truncate rounded-full py-2 pl-4 pr-2.5 no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",target:"_blank",href:o.href,children:[o.text,b("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:b("path",{d:"M3.64645 11.3536C3.45118 11.1583 3.45118 10.8417 3.64645 10.6465L10.2929 4L6 4C5.72386 4 5.5 3.77614 5.5 3.5C5.5 3.22386 5.72386 3 6 3L11.5 3C11.6326 3 11.7598 3.05268 11.8536 3.14645C11.9473 3.24022 12 3.36739 12 3.5L12 9.00001C12 9.27615 11.7761 9.50001 11.5 9.50001C11.2239 9.50001 11 9.27615 11 9.00001V4.70711L4.35355 11.3536C4.15829 11.5488 3.84171 11.5488 3.64645 11.3536Z",fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"})})]})})).with({type:"image"},o=>b("img",{class:"shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",src:o.url,style:{aspectRatio:o.width/o.height}})).with({type:"file"},o=>b(Pb,{class:o.author==="bot"?"":"ml-auto",file:{name:o.fileName,sizeKb:o.fileSizeKb}})).exhaustive()},r))}),b("aside",{"aria-hidden":!0,children:t&&b(my,{})})]}),yy=25,wy=()=>{const e=U(null),[t,n]=ae(!1),[r,o]=ae(()=>()=>{}),i=de(()=>a=>{var c;return(c=e.current)==null?void 0:c.scrollTo({top:e.current.scrollHeight,...a})},[e]),s=de(()=>({send:async({message:a,signal:c,groupId:u})=>{if(await nt(a).with({author:"bot",type:"text"},async d=>{if(c!=null&&c.aborted)throw new Jn;n(!0);const l=Math.min(Math.max(20,d.text.length),100)*yy;await new Promise(f=>setTimeout(f,l,{signal:c})),n(!1)}).otherwise(async()=>{}),c!=null&&c.aborted)throw new Jn;ne.addMessage(a,u)},input:async({input:a,signal:c})=>{if(c!=null&&c.aborted)throw new Jn;return ne.setInput(a),await new Promise(u=>{const d=l=>{if(c!=null&&c.aborted)throw new Jn;ne.setInput(void 0),a.key&&ne.setSubmission(a.key,l),u(l)};o(()=>d)})}}),[]);return{chatRef:e,chatService:s,isBotTyping:t,onSubmitSuccessFn:r,scrollToEnd:i}},_y=Object.freeze(Object.defineProperty({__proto__:null,JobApplicationContent:({currentApplication:e,logger:t,apiClient:n,analytics:r})=>{const{chatRef:o,chatService:i,isBotTyping:s,onSubmitSuccessFn:a,scrollToEnd:c}=wy(),u=rt.value,d=e.flow,l=e.job;return Be(()=>{u==="maximised"&&c({behavior:"instant"})},[c,u]),G(()=>{c({behavior:"smooth"})},[e.data.messages,c]),Be(()=>{const{state:f,application:h}=ne.current$.peek();if(f!=="loaded")throw new Error(Vv.invalid_state);const p=h.data.currentNodeId;if(c({behavior:"instant"}),ne.setInput(void 0),h.data.isFinished)return;ne.removeLastGroupMessagesById(p);const{interpret:m,abort:y}=lb({context:{jobId:l.id,flowId:d.id},analytics:r,apiClient:n,logger:t,flow:d.nodes,chatService:i,getSubmissions:()=>{var x;return(x=ne.current$.peek().application)==null?void 0:x.data.submissions},onInterpret:(x,g)=>{const w=ne.current$.peek().application;rn(w),w.data.sequence=w.data.sequence+1,r.log({event:"FLOW_NODE",properties:{flow_id:d.id,flow_version:d.version,job_id:l.id,from_node_id:g?g.id:null,to_node_id:x.id,sequence:w.data.sequence,flow_session_id:w.data.flowSessionId}}),ne.setCurrentNodeId(x.id)},onFlowEnd:async()=>{ne.markAsFinished()}});return m(p),y},[r,n,i,t,c,d,l.id,e.startedAt]),b(ue,{children:[b("div",{ref:o,className:"hide-scrollbars relative flex max-w-full flex-grow flex-col overflow-y-scroll",style:{WebkitOverflowScrolling:"touch",paddingBottom:ns.value},children:b(to,{children:b(by,{isBotTyping:s,messages:e.data.messages})})}),b(dy,{input:e.data.currentInput,onInputChange:()=>c({behavior:"smooth"}),onSubmit:a})]})}},Symbol.toStringTag,{value:"Module"}))})();
57
+ }`,a1=({_internal_domManager:e=hg(),theme:t})=>Et(({apiClient:n,logger:r,analytics:o})=>{let i=!1;const s=()=>{if(typeof window>"u")return;const a=e.getOrCreateChatbotElement();e.addStyle(fg,"inploi-chatbot-style");const c=s1([{name:"a",colors:xd(t)},{name:"n",colors:xd({hue:t.hue,chroma:.1})}]);e.addStyle(c,"inploi-chatbot-theme"),en(R(Hv,{apiClient:n,logger:r,analytics:o}),a),i=!0};return{prepare:async()=>{if(!(typeof window>"u"))try{if(i)return;s(),r.info("Chatbot plugin prepared")}catch(a){console.error(a),r.error("Error preparing chatbot plugin",a)}},startApplication:async({jobId:a})=>{if(!(typeof window>"u"))try{ne.cancel(),pf(()=>{rt.value="maximised",ne.current$.value={state:"loading"}}),dg({jobId:a,apiClient:n,logger:r}).then(async c=>{c.ok?(await o.log({event:"APPLY_START",attributionKey:`job_${a}`,properties:{job_id:a,flow_id:c.value.flow.id}}).catch(r.error),ne.start(c.value)):ne.current$.value={state:"error",error:c.error}}),i||s()}catch(c){console.error(c),r.error("Error starting application",c)}},closeApplication:async()=>{typeof window>"u"||(r.info("Closing application from an external source"),ne.cancel())}}});if(!window.inploi)throw new Error("Please insert the SDK script tag above the plugins.");window.inploi.chatbotPlugin=a1;const kd=({node:e,nodes:t,stopWhen:n})=>{if((n==null?void 0:n(e))===!0)return e;const r=e.nextId?t.find(o=>o.id===e.nextId):void 0;if(r)return kd({node:r,nodes:t,stopWhen:n})},c1=({childNode:e,nodes:t})=>{const r=t.filter(o=>o.type==="if-block").find(o=>{if(!o.branchId)return!1;const i=t.find(a=>a.id===o.branchId);if(!i)return!1;const s=kd({node:i,nodes:t,stopWhen:a=>a.id===e.id});return!(!s||s.id!==e.id)});if(r!=null&&r.nextId)return t.find(o=>o.id===r.nextId)},l1=({flow:e,analytics:t,logger:n,context:r,apiClient:o,getSubmissions:i,chatService:s,onFlowEnd:a,onInterpret:c})=>{const u=new AbortController,d=async(l,f)=>{const h=i();c==null||c(l,f);try{await u1({analytics:t,logger:n,apiClient:o,context:r,node:l,submissions:h,chat:{sendMessage:async p=>s.send({groupId:l.id,message:p,signal:u.signal}),userInput:async p=>s.input({input:p,signal:u.signal})},next:p=>{const m=p?e.find(y=>y.id===p):c1({childNode:l,nodes:e});return m?d(m,l):a==null?void 0:a(l)},end:()=>a==null?void 0:a(l)})}catch(p){if(p instanceof Jn)return;throw p}};return{interpret:async l=>{const f=e.find(h=>h.id===l)??vu(e);return d(f)},abort:()=>{u.abort()}}};async function u1(e){return await nt(e).with({node:{type:"text"}},p1).with({node:{type:"image"}},m1).with({node:{type:"question-text"}},v1).with({node:{type:"question-enum"}},b1).with({node:{type:"question-number"}},g1).with({node:{type:"question-boolean"}},y1).with({node:{type:"question-file"}},_1).with({node:{type:"question-address"}},w1).with({node:{type:"end-flow"}},x1).with({node:{type:"if-block"}},h1).with({node:{type:"jump"}},({node:t,next:n})=>n(t.data.targetId)).with({node:{type:"link"}},f1).with({node:{type:"integration-application-submit"}},d1).with({node:{type:"integration-workflow-get"}},()=>Error("Unreachable")).exhaustive()}async function d1({chat:e,next:t,node:n,logger:r,apiClient:o,submissions:i,context:s,analytics:a}){await e.userInput({type:"multiple-choice",key:void 0,config:{options:[{label:"Submit my application",value:"submit"}],maxSelected:1,minSelected:1}});const c=()=>{const d=typeof s.jobId=="string"?s.jobId:void 0,l=typeof s.flowId=="string"?s.flowId:void 0;rn(d),rn(l),d&&a.log({event:"APPLY_COMPLETE",attributionKey:`job_${d}`,properties:{job_id:d,flow_id:l}})};await e.sendMessage({type:"system",variant:"info",text:"Submitting your application…"});const u=await o.fetch("/flow/apply",{method:"POST",body:JSON.stringify({...s,type:n.data.type,ats:n.data.ats,integration_id:n.data.integrationId,anonymous_id:a.getAnonymousId(),submissions:Nv(i||{})})}).catch(d=>d);await nt(u).with({ats_data:{redirect_url:Ae.string}},async d=>{await e.sendMessage({type:"text",author:"bot",text:"Almost there! Please finalise your application on our partner’s website."});const l=a.getAnonymousId(),f=new URL(d.ats_data.redirect_url);l&&!f.searchParams.has("anonymous_id")&&f.searchParams.set("anonymous_id",l),c(),await e.sendMessage({type:"link",href:f.toString(),text:"Finalise application on partner"})}).with({success:!0},async()=>{c(),await e.sendMessage({type:"system",variant:"success",text:"Application submitted"}),t(n.nextId)}).otherwise(async d=>{r.error(d),await e.sendMessage({type:"system",variant:"error",text:"Failed to submit application"}),t(n.id)})}async function f1({chat:e,next:t,node:n}){await e.sendMessage({type:"link",href:n.data.href,text:n.data.cta}),t(n.nextId)}async function h1({submissions:e,next:t,node:n}){const r=k1(n,e)?n.branchId:n.nextId;t(r)}async function p1({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"text",text:n.data.text}),t(n.nextId)}async function m1({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"image",url:n.data.url,height:n.data.height,width:n.data.width}),t(n.nextId)}async function v1({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"text",text:n.data.question});const r=await e.userInput({key:n.data.key,type:"text",config:{placeholder:n.data.placeholder,format:n.data.format}});await e.sendMessage({author:"user",type:"text",text:r.value}),t(n.nextId)}async function g1({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"text",text:n.data.question});const r=await e.userInput({key:n.data.key,type:"text",config:{placeholder:n.data.placeholder,format:"text"}});await e.sendMessage({author:"user",type:"text",text:r.value}),t(n.nextId)}async function b1({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"text",text:n.data.question});const r=await e.userInput({key:n.data.key,type:"multiple-choice",config:n.data});await e.sendMessage({author:"user",type:"text",text:n.data.options.filter(o=>r.value.includes(o.value)).map(o=>o.label).join(", ")}),t(n.nextId)}async function y1({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"text",text:n.data.question});const o=(await e.userInput({key:n.data.key,type:"boolean",config:{labels:{true:n.data.trueLabel,false:n.data.falseLabel}}})).value,i={true:n.data.trueLabel,false:n.data.falseLabel};await e.sendMessage({author:"user",type:"text",text:i[o]}),t(n.nextId)}async function w1({chat:e,next:t,node:n}){await e.sendMessage({author:"bot",type:"text",text:"Address questions are not implemented yet"}),t(n.nextId)}async function _1({node:e,chat:t,next:n}){await t.sendMessage({author:"bot",type:"text",text:e.data.question});const r=await t.userInput({key:e.data.key,type:"file",config:{extensions:e.data.extensions,fileSizeLimitKib:e.data.maxSizeKb??10*1024,allowMultiple:e.data.multiple===!0}});for await(const o of r.value)await t.sendMessage({author:"user",type:"file",fileName:o.name,fileSizeKb:o.sizeKb});n(e.nextId)}async function x1({chat:e,end:t,node:n}){await e.sendMessage({type:"system",variant:"info",text:n.data.systemMessage||"Conversation finished"}),t()}const $d=Ae.union(Ae.string,Ae.array(Ae.string)),k1=(e,t)=>{const n=t==null?void 0:t[e.data.compareKey];return n?nt({...e.data,answer:n}).with({compare:"equals"},({compareValue:r})=>typeof n.value=="string"||typeof n.value=="boolean"?r===n.value.toString():!1).with({compare:"notEquals"},({compareValue:r})=>typeof n.value=="string"||typeof n.value=="boolean"?r!==n.value.toString():!1).with({compare:"contains",answer:{value:$d}},({compareValue:r,answer:o})=>o.value.includes(r)).with({compare:"notContains",answer:{value:$d}},({compareValue:r,answer:o})=>!o.value.includes(r)).with({answer:{type:"file"}},()=>!1).exhaustive():!1},ko=({class:e,...t})=>b("button",{class:Xt("bg-accent-7 active:bg-accent-10 active:text-accent-2 text-lowest pointer-coarse:touch-hitbox focus-visible:ring-accent-7/50 flex-shrink-0 rounded-full p-2 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:b("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",children:[b("title",{children:"Send"}),b("path",{d:"M3.5 7.5L8 3L12.5 7.5"}),b("path",{d:"M8 4V13"})]})}),Is=()=>{const e=U(null);return G(()=>{var t;(t=e.current)==null||t.focus()},[]),e},Sd=["true","false"],$1=eg(Sd),S1="answer",M1=({input:e,onSubmitSuccess:t,onHeightChange:n})=>{const r=Is();return n(),b("form",{noValidate:!0,class:"flex items-center gap-2",onSubmit:o=>{o.preventDefault();const i=nt(o).with({nativeEvent:{submitter:Ae.select(Ae.union(Ae.instanceOf(HTMLButtonElement),Ae.instanceOf(HTMLInputElement)))}},a=>a.value).otherwise(()=>{throw new Error("invalid form")}),s=rs($1,i);t(s)},children:Sd.map((o,i)=>b("button",{ref:i===0?r:null,type:"submit",name:S1,value:o,class:"bg-lowest ease-expo-out ring-neutral-12/5 text-neutral-12 active:ring-accent-7 active:bg-accent-2 active:text-accent-11 fr duration-snappy block flex-1 overflow-hidden rounded-2xl px-2.5 py-2.5 ring-2 transition-all selection:bg-transparent",children:b("p",{class:"truncate text-center text-base",children:e.config.labels[o]})}))})},Fs=({error:e,onAnimationComplete:t})=>b(to,{children:e&&b(Kn.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},onAnimationComplete:t,role:"alert",class:"text-error-11 flex max-w-full items-center gap-1 overflow-hidden rounded-full p-0.5 px-1 opacity-0",children:[b("svg",{class:"text-error-10",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b("circle",{cx:"8",cy:"8",r:"6.3",stroke:"currentColor","stroke-width":"1.4"}),b("rect",{x:"7",y:"4",width:"2",height:"5",fill:"currentColor"}),b("rect",{x:"7",y:"10",width:"2",height:"2",fill:"currentColor"})]}),b("p",{class:"truncate pr-1 text-sm",children:e.message})]})}),T1=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>r.result?t(r.result.toString()):n("No result from reader"),r.onerror=n}),$o=e=>nt(e).with(Ae.number.lte(1e3),()=>`${Math.round(e)}KB`).with(Ae.number.lt(1e3*10),()=>`${(e/1e3).toFixed(1)}MB`).otherwise(()=>`${Math.round(e/1e3)}MB`),C1=e=>e.reduce((t,n)=>t+n.sizeKb,0),A1=ts("file"),Md=3,P1=({file:e,class:t,...n})=>{const r=e.name.split(".").pop(),o=e.name.replace(new RegExp(`.${r}$`),"");return b("div",{class:Xt("bg-accent-1 outline-neutral-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline",t),...n,children:[b("p",{"aria-label":"File name",class:"text-accent-12 flex flex-grow overflow-hidden",children:[b("span",{class:"block truncate",children:o}),b("span",{children:[".",r]})]}),b("p",{"aria-label":"File size",class:"text-neutral-10",children:$o(e.sizeKb)})]})},Td=({class:e,...t})=>b("li",{class:Xt("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1",e),...t}),E1=({input:e,onSubmitSuccess:t,onHeightChange:n})=>{var l;const r=(l=ne.current$.value.application)==null?void 0:l.data.submissions[e.key],[o,i]=ae(A1(r)?r.value:[]),[s,a]=ae(),c=o.length-Md,u=C1(o),d=Is();return b("form",{class:"flex flex-col gap-1",onSubmit:f=>(f.preventDefault(),a(void 0),o.length===0?a({type:"required",message:"Please select a file"}):e.config.fileSizeLimitKib&&u>e.config.fileSizeLimitKib?a({type:"max",message:`File size exceeds limit of ${$o(e.config.fileSizeLimitKib)}`}):e.config.allowMultiple===!1&&o.length>1?a({type:"invalid",message:"Only one file is allowed"}):t(o)),children:[b("div",{class:"flex items-center gap-2",children:[b("label",{ref:d,for:"dropzone-file",class:"border-neutral-8 bg-neutral-2 flex h-48 w-full cursor-pointer flex-col items-center justify-center overflow-hidden rounded-2xl border border-dashed p-4",children:[o.length>0?b(ue,{children:[b("ul",{class:"flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",children:[o.slice(0,Md).map(f=>{const h=f.name.split(".").pop(),p=f.name.replace(new RegExp(`.${h}$`),"");return b(Td,{class:"flex overflow-hidden",children:[b("span",{class:"block truncate",children:p}),b("span",{children:[".",h]})]})}),c>0?b(Td,{children:["+",c," file",c!==1?"s":""]}):null]}),b("p",{class:"text-neutral-11 text-xs",children:[$o(u)," ",o.length>1?"total":""]})]}):b("div",{class:"flex flex-col justify-center gap-4 pb-6 pt-5",children:[b("header",{class:"flex flex-col items-center gap-0",children:[b("svg",{class:"text-neutral-11 mb-1 h-8 w-8","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 16",children:b("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"})}),b("p",{class:"text-neutral-12 tracking-[-0.01em] dark:text-gray-400",children:[e.config.allowMultiple?"Select files":"Select a file"," to upload"]}),e.config.fileSizeLimitKib?b("p",{class:"text-neutral-10 text-xs",children:["(max ",$o(e.config.fileSizeLimitKib),")"]}):null]}),b("aside",{class:"flex flex-col items-center gap-2",children:[b("p",{id:"accepted-filetypes",class:"sr-only",children:"Accepted file extensions"}),b("ul",{"aria-describedby":"accepted-filetypes",class:"flex flex-wrap justify-center gap-2",children:e.config.extensions.map(f=>b("li",{class:"ring-lowest outline-neutral-6 text-neutral-9 bg-neutral-1 rounded-md px-1 py-0.5 text-[11px] uppercase tracking-wide outline outline-1 ring-2",children:f.replace(".","")}))})]})]}),b("input",{id:"dropzone-file",onInput:async f=>{rn(f.target instanceof HTMLInputElement);const h=f.target.files?Array.from(f.target.files):[],p=await Promise.allSettled(h.map(async y=>{const x=await T1(y);return{name:y.name,data:x,sizeKb:y.size/1e3}}));if(p.some(({status:y})=>y==="rejected"))return a({type:"invalid",message:"Invalid file"});const m=p.map(y=>y.status==="fulfilled"?y.value:null).filter(Boolean);i(m)},multiple:e.config.allowMultiple,type:"file",class:"sr-only"})]}),b(ko,{disabled:o.length===0})]}),s&&b(Fs,{onAnimationComplete:n,error:s})]})};var lr=e=>e.type==="checkbox",Mn=e=>e instanceof Date,Me=e=>e==null;const Cd=e=>typeof e=="object";var fe=e=>!Me(e)&&!Array.isArray(e)&&Cd(e)&&!Mn(e),V1=e=>fe(e)&&e.target?lr(e.target)?e.target.checked:e.target.value:e,O1=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,L1=(e,t)=>e.has(O1(t)),N1=e=>{const t=e.constructor&&e.constructor.prototype;return fe(t)&&t.hasOwnProperty("isPrototypeOf")},Ds=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ct(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Ds&&(e instanceof Blob||e instanceof FileList))&&(n||fe(e)))if(t=n?[]:{},!n&&!N1(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=ct(e[r]));else return e;return t}var ur=e=>Array.isArray(e)?e.filter(Boolean):[],ie=e=>e===void 0,O=(e,t,n)=>{if(!t||!fe(e))return n;const r=ur(t.split(/[,[\].]+?/)).reduce((o,i)=>Me(o)?o:o[i],e);return ie(r)||r===e?ie(e[t])?n:e[t]:r},Tt=e=>typeof e=="boolean";const Ad={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ze={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},lt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};De.createContext(null);var R1=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const s=i;return t._proxyFormState[s]!==ze.all&&(t._proxyFormState[s]=!r||ze.all),n&&(n[s]=!0),e[s]}});return o},Oe=e=>fe(e)&&!Object.keys(e).length,I1=(e,t,n,r)=>{n(e);const{name:o,...i}=e;return Oe(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!r||ze.all))},zs=e=>Array.isArray(e)?e:[e];function F1(e){const t=De.useRef(e);t.current=e,De.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}var Ye=e=>typeof e=="string",D1=(e,t,n,r,o)=>Ye(e)?(r&&t.watch.add(e),O(n,e,o)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),O(n,i))):(r&&(t.watchAll=!0),n),Bs=e=>/^\w*$/.test(e),Pd=e=>ur(e.replace(/["|']|\]/g,"").split(/\.|\[/));function Q(e,t,n){let r=-1;const o=Bs(t)?[t]:Pd(t),i=o.length,s=i-1;for(;++r<i;){const a=o[r];let c=n;if(r!==s){const u=e[a];c=fe(u)||Array.isArray(u)?u:isNaN(+o[r+1])?{}:[]}e[a]=c,e=e[a]}return e}var Ed=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},Vd=e=>({isOnSubmit:!e||e===ze.onSubmit,isOnBlur:e===ze.onBlur,isOnChange:e===ze.onChange,isOnAll:e===ze.all,isOnTouch:e===ze.onTouched}),Od=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const So=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const i=O(e,o);if(i){const{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],o)&&!r)break;if(s.ref&&t(s.ref,s.name)&&!r)break}else fe(a)&&So(a,t)}}};var z1=(e,t,n)=>{const r=ur(O(e,n));return Q(r,"root",t[n]),Q(e,n,r),e},js=e=>e.type==="file",Ct=e=>typeof e=="function",Mo=e=>{if(!Ds)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},To=e=>Ye(e),Hs=e=>e.type==="radio",Co=e=>e instanceof RegExp;const Ld={value:!1,isValid:!1},Nd={value:!0,isValid:!0};var Rd=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ie(e[0].attributes.value)?ie(e[0].value)||e[0].value===""?Nd:{value:e[0].value,isValid:!0}:Nd:Ld}return Ld};const Id={isValid:!1,value:null};var Fd=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Id):Id;function Dd(e,t,n="validate"){if(To(e)||Array.isArray(e)&&e.every(To)||Tt(e)&&!e)return{type:n,message:To(e)?e:"",ref:t}}var Tn=e=>fe(e)&&!Co(e)?e:{value:e,message:""},zd=async(e,t,n,r,o)=>{const{ref:i,refs:s,required:a,maxLength:c,minLength:u,min:d,max:l,pattern:f,validate:h,name:p,valueAsNumber:m,mount:y,disabled:x}=e._f,g=O(t,p);if(!y||x)return{};const w=s?s[0]:i,M=j=>{r&&w.reportValidity&&(w.setCustomValidity(Tt(j)?"":j||""),w.reportValidity())},S={},I=Hs(i),N=lr(i),C=I||N,E=(m||js(i))&&ie(i.value)&&ie(g)||Mo(i)&&i.value===""||g===""||Array.isArray(g)&&!g.length,q=Ed.bind(null,p,n,S),K=(j,B,H,X=lt.maxLength,re=lt.minLength)=>{const se=j?B:H;S[p]={type:j?X:re,message:se,ref:i,...q(j?X:re,se)}};if(o?!Array.isArray(g)||!g.length:a&&(!C&&(E||Me(g))||Tt(g)&&!g||N&&!Rd(s).isValid||I&&!Fd(s).isValid)){const{value:j,message:B}=To(a)?{value:!!a,message:a}:Tn(a);if(j&&(S[p]={type:lt.required,message:B,ref:w,...q(lt.required,B)},!n))return M(B),S}if(!E&&(!Me(d)||!Me(l))){let j,B;const H=Tn(l),X=Tn(d);if(!Me(g)&&!isNaN(g)){const re=i.valueAsNumber||g&&+g;Me(H.value)||(j=re>H.value),Me(X.value)||(B=re<X.value)}else{const re=i.valueAsDate||new Date(g),se=ut=>new Date(new Date().toDateString()+" "+ut),Le=i.type=="time",Ne=i.type=="week";Ye(H.value)&&g&&(j=Le?se(g)>se(H.value):Ne?g>H.value:re>new Date(H.value)),Ye(X.value)&&g&&(B=Le?se(g)<se(X.value):Ne?g<X.value:re<new Date(X.value))}if((j||B)&&(K(!!j,H.message,X.message,lt.max,lt.min),!n))return M(S[p].message),S}if((c||u)&&!E&&(Ye(g)||o&&Array.isArray(g))){const j=Tn(c),B=Tn(u),H=!Me(j.value)&&g.length>+j.value,X=!Me(B.value)&&g.length<+B.value;if((H||X)&&(K(H,j.message,B.message),!n))return M(S[p].message),S}if(f&&!E&&Ye(g)){const{value:j,message:B}=Tn(f);if(Co(j)&&!g.match(j)&&(S[p]={type:lt.pattern,message:B,ref:i,...q(lt.pattern,B)},!n))return M(B),S}if(h){if(Ct(h)){const j=await h(g,t),B=Dd(j,w);if(B&&(S[p]={...B,...q(lt.validate,B.message)},!n))return M(B.message),S}else if(fe(h)){let j={};for(const B in h){if(!Oe(j)&&!n)break;const H=Dd(await h[B](g,t),w,B);H&&(j={...H,...q(B,H.message)},M(H.message),n&&(S[p]=j))}if(!Oe(j)&&(S[p]={ref:w,...j},!n))return S}}return M(!0),S};function B1(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=ie(e)?r++:e[t[r++]];return e}function j1(e){for(const t in e)if(e.hasOwnProperty(t)&&!ie(e[t]))return!1;return!0}function ye(e,t){const n=Array.isArray(t)?t:Bs(t)?[t]:Pd(t),r=n.length===1?e:B1(e,n),o=n.length-1,i=n[o];return r&&delete r[i],o!==0&&(fe(r)&&Oe(r)||Array.isArray(r)&&j1(r))&&ye(e,n.slice(0,-1)),e}function Us(){let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}}var Ao=e=>Me(e)||!Cd(e);function Yt(e,t){if(Ao(e)||Ao(t))return e===t;if(Mn(e)&&Mn(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const i=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const s=t[o];if(Mn(i)&&Mn(s)||fe(i)&&fe(s)||Array.isArray(i)&&Array.isArray(s)?!Yt(i,s):i!==s)return!1}}return!0}var Bd=e=>e.type==="select-multiple",H1=e=>Hs(e)||lr(e),Xs=e=>Mo(e)&&e.isConnected,jd=e=>{for(const t in e)if(Ct(e[t]))return!0;return!1};function Po(e,t={}){const n=Array.isArray(e);if(fe(e)||n)for(const r in e)Array.isArray(e[r])||fe(e[r])&&!jd(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Po(e[r],t[r])):Me(e[r])||(t[r]=!0);return t}function Hd(e,t,n){const r=Array.isArray(e);if(fe(e)||r)for(const o in e)Array.isArray(e[o])||fe(e[o])&&!jd(e[o])?ie(t)||Ao(n[o])?n[o]=Array.isArray(e[o])?Po(e[o],[]):{...Po(e[o])}:Hd(e[o],Me(t)?{}:t[o],n[o]):n[o]=!Yt(e[o],t[o]);return n}var qs=(e,t)=>Hd(e,t,Po(t)),Ud=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>ie(e)?e:t?e===""?NaN:e&&+e:n&&Ye(e)?new Date(e):r?r(e):e;function Ws(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return js(t)?t.files:Hs(t)?Fd(e.refs).value:Bd(t)?[...t.selectedOptions].map(({value:n})=>n):lr(t)?Rd(e.refs).value:Ud(ie(t.value)?e.ref.value:t.value,e)}var U1=(e,t,n,r)=>{const o={};for(const i of e){const s=O(t,i);s&&Q(o,i,s._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},dr=e=>ie(e)?e:Co(e)?e.source:fe(e)?Co(e.value)?e.value.source:e.value:e,X1=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Xd(e,t,n){const r=O(e,n);if(r||Bs(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const i=o.join("."),s=O(t,i),a=O(e,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(a&&a.type)return{name:i,error:a};o.pop()}return{name:n}}var q1=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,W1=(e,t)=>!ur(O(e,t)).length&&ye(e,t);const K1={mode:ze.onSubmit,reValidateMode:ze.onChange,shouldFocusError:!0};function Y1(e={},t){let n={...K1,...e},r={submitCount:0,isDirty:!1,isLoading:Ct(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{},disabled:!1},o={},i=fe(n.defaultValues)||fe(n.values)?ct(n.defaultValues||n.values)||{}:{},s=n.shouldUnregister?{}:ct(i),a={action:!1,mount:!1,watch:!1},c={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,d=0;const l={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:Us(),array:Us(),state:Us()},h=e.resetOptions&&e.resetOptions.keepDirtyValues,p=Vd(n.mode),m=Vd(n.reValidateMode),y=n.criteriaMode===ze.all,x=v=>_=>{clearTimeout(d),d=setTimeout(v,_)},g=async v=>{if(l.isValid||v){const _=n.resolver?Oe((await E()).errors):await K(o,!0);_!==r.isValid&&f.state.next({isValid:_})}},w=v=>l.isValidating&&f.state.next({isValidating:v}),M=(v,_=[],k,L,P=!0,T=!0)=>{if(L&&k){if(a.action=!0,T&&Array.isArray(O(o,v))){const F=k(O(o,v),L.argA,L.argB);P&&Q(o,v,F)}if(T&&Array.isArray(O(r.errors,v))){const F=k(O(r.errors,v),L.argA,L.argB);P&&Q(r.errors,v,F),W1(r.errors,v)}if(l.touchedFields&&T&&Array.isArray(O(r.touchedFields,v))){const F=k(O(r.touchedFields,v),L.argA,L.argB);P&&Q(r.touchedFields,v,F)}l.dirtyFields&&(r.dirtyFields=qs(i,s)),f.state.next({name:v,isDirty:B(v,_),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Q(s,v,_)},S=(v,_)=>{Q(r.errors,v,_),f.state.next({errors:r.errors})},I=(v,_,k,L)=>{const P=O(o,v);if(P){const T=O(s,v,ie(k)?O(i,v):k);ie(T)||L&&L.defaultChecked||_?Q(s,v,_?T:Ws(P._f)):re(v,T),a.mount&&g()}},N=(v,_,k,L,P)=>{let T=!1,F=!1;const ee={name:v};if(!k||L){l.isDirty&&(F=r.isDirty,r.isDirty=ee.isDirty=B(),T=F!==ee.isDirty);const le=Yt(O(i,v),_);F=O(r.dirtyFields,v),le?ye(r.dirtyFields,v):Q(r.dirtyFields,v,!0),ee.dirtyFields=r.dirtyFields,T=T||l.dirtyFields&&F!==!le}if(k){const le=O(r.touchedFields,v);le||(Q(r.touchedFields,v,k),ee.touchedFields=r.touchedFields,T=T||l.touchedFields&&le!==k)}return T&&P&&f.state.next(ee),T?ee:{}},C=(v,_,k,L)=>{const P=O(r.errors,v),T=l.isValid&&Tt(_)&&r.isValid!==_;if(e.delayError&&k?(u=x(()=>S(v,k)),u(e.delayError)):(clearTimeout(d),u=null,k?Q(r.errors,v,k):ye(r.errors,v)),(k?!Yt(P,k):P)||!Oe(L)||T){const F={...L,...T&&Tt(_)?{isValid:_}:{},errors:r.errors,name:v};r={...r,...F},f.state.next(F)}w(!1)},E=async v=>n.resolver(s,n.context,U1(v||c.mount,o,n.criteriaMode,n.shouldUseNativeValidation)),q=async v=>{const{errors:_}=await E(v);if(v)for(const k of v){const L=O(_,k);L?Q(r.errors,k,L):ye(r.errors,k)}else r.errors=_;return _},K=async(v,_,k={valid:!0})=>{for(const L in v){const P=v[L];if(P){const{_f:T,...F}=P;if(T){const ee=c.array.has(T.name),le=await zd(P,s,y,n.shouldUseNativeValidation&&!_,ee);if(le[T.name]&&(k.valid=!1,_))break;!_&&(O(le,T.name)?ee?z1(r.errors,le,T.name):Q(r.errors,T.name,le[T.name]):ye(r.errors,T.name))}F&&await K(F,_,k)}}return k.valid},j=()=>{for(const v of c.unMount){const _=O(o,v);_&&(_._f.refs?_._f.refs.every(k=>!Xs(k)):!Xs(_._f.ref))&&Ze(v)}c.unMount=new Set},B=(v,_)=>(v&&_&&Q(s,v,_),!Yt(Re(),i)),H=(v,_,k)=>D1(v,c,{...a.mount?s:ie(_)?i:Ye(v)?{[v]:_}:_},k,_),X=v=>ur(O(a.mount?s:i,v,e.shouldUnregister?O(i,v,[]):[])),re=(v,_,k={})=>{const L=O(o,v);let P=_;if(L){const T=L._f;T&&(!T.disabled&&Q(s,v,Ud(_,T)),P=Mo(T.ref)&&Me(_)?"":_,Bd(T.ref)?[...T.ref.options].forEach(F=>F.selected=P.includes(F.value)):T.refs?lr(T.ref)?T.refs.length>1?T.refs.forEach(F=>(!F.defaultChecked||!F.disabled)&&(F.checked=Array.isArray(P)?!!P.find(ee=>ee===F.value):P===F.value)):T.refs[0]&&(T.refs[0].checked=!!P):T.refs.forEach(F=>F.checked=F.value===P):js(T.ref)?T.ref.value="":(T.ref.value=P,T.ref.type||f.values.next({name:v,values:{...s}})))}(k.shouldDirty||k.shouldTouch)&&N(v,P,k.shouldTouch,k.shouldDirty,!0),k.shouldValidate&&Y(v)},se=(v,_,k)=>{for(const L in _){const P=_[L],T=`${v}.${L}`,F=O(o,T);(c.array.has(v)||!Ao(P)||F&&!F._f)&&!Mn(P)?se(T,P,k):re(T,P,k)}},Le=(v,_,k={})=>{const L=O(o,v),P=c.array.has(v),T=ct(_);Q(s,v,T),P?(f.array.next({name:v,values:{...s}}),(l.isDirty||l.dirtyFields)&&k.shouldDirty&&f.state.next({name:v,dirtyFields:qs(i,s),isDirty:B(v,T)})):L&&!L._f&&!Me(T)?se(v,T,k):re(v,T,k),Od(v,c)&&f.state.next({...r}),f.values.next({name:v,values:{...s}}),!a.mount&&t()},Ne=async v=>{const _=v.target;let k=_.name,L=!0;const P=O(o,k),T=()=>_.type?Ws(P._f):V1(v),F=ee=>{L=Number.isNaN(ee)||ee===O(s,k,ee)};if(P){let ee,le;const Lo=T(),Cn=v.type===Ad.BLUR||v.type===Ad.FOCUS_OUT,xy=!X1(P._f)&&!n.resolver&&!O(r.errors,k)&&!P._f.deps||q1(Cn,O(r.touchedFields,k),r.isSubmitted,m,p),Ks=Od(k,c,Cn);Q(s,k,Lo),Cn?(P._f.onBlur&&P._f.onBlur(v),u&&u(0)):P._f.onChange&&P._f.onChange(v);const Ys=N(k,Lo,Cn,!1),ky=!Oe(Ys)||Ks;if(!Cn&&f.values.next({name:k,type:v.type,values:{...s}}),xy)return l.isValid&&g(),ky&&f.state.next({name:k,...Ks?{}:Ys});if(!Cn&&Ks&&f.state.next({...r}),w(!0),n.resolver){const{errors:ef}=await E([k]);if(F(Lo),L){const $y=Xd(r.errors,o,k),tf=Xd(ef,o,$y.name||k);ee=tf.error,k=tf.name,le=Oe(ef)}}else ee=(await zd(P,s,y,n.shouldUseNativeValidation))[k],F(Lo),L&&(ee?le=!1:l.isValid&&(le=await K(o,!0)));L&&(P._f.deps&&Y(P._f.deps),C(k,le,ee,Ys))}},ut=(v,_)=>{if(O(r.errors,_)&&v.focus)return v.focus(),1},Y=async(v,_={})=>{let k,L;const P=zs(v);if(w(!0),n.resolver){const T=await q(ie(v)?v:P);k=Oe(T),L=v?!P.some(F=>O(T,F)):k}else v?(L=(await Promise.all(P.map(async T=>{const F=O(o,T);return await K(F&&F._f?{[T]:F}:F)}))).every(Boolean),!(!L&&!r.isValid)&&g()):L=k=await K(o);return f.state.next({...!Ye(v)||l.isValid&&k!==r.isValid?{}:{name:v},...n.resolver||!v?{isValid:k}:{},errors:r.errors,isValidating:!1}),_.shouldFocus&&!L&&So(o,ut,v?P:c.mount),L},Re=v=>{const _={...i,...a.mount?s:{}};return ie(v)?_:Ye(v)?O(_,v):v.map(k=>O(_,k))},At=(v,_)=>({invalid:!!O((_||r).errors,v),isDirty:!!O((_||r).dirtyFields,v),isTouched:!!O((_||r).touchedFields,v),error:O((_||r).errors,v)}),Pt=v=>{v&&zs(v).forEach(_=>ye(r.errors,_)),f.state.next({errors:v?r.errors:{}})},Gt=(v,_,k)=>{const L=(O(o,v,{_f:{}})._f||{}).ref;Q(r.errors,v,{..._,ref:L}),f.state.next({name:v,errors:r.errors,isValid:!1}),k&&k.shouldFocus&&L&&L.focus&&L.focus()},Ge=(v,_)=>Ct(v)?f.values.subscribe({next:k=>v(H(void 0,_),k)}):H(v,_,!0),Ze=(v,_={})=>{for(const k of v?zs(v):c.mount)c.mount.delete(k),c.array.delete(k),_.keepValue||(ye(o,k),ye(s,k)),!_.keepError&&ye(r.errors,k),!_.keepDirty&&ye(r.dirtyFields,k),!_.keepTouched&&ye(r.touchedFields,k),!n.shouldUnregister&&!_.keepDefaultValue&&ye(i,k);f.values.next({values:{...s}}),f.state.next({...r,..._.keepDirty?{isDirty:B()}:{}}),!_.keepIsValid&&g()},Vo=({disabled:v,name:_,field:k,fields:L,value:P})=>{if(Tt(v)){const T=v?void 0:ie(P)?Ws(k?k._f:O(L,_)._f):P;Q(s,_,T),N(_,T,!1,!1,!0)}},Zt=(v,_={})=>{let k=O(o,v);const L=Tt(_.disabled);return Q(o,v,{...k||{},_f:{...k&&k._f?k._f:{ref:{name:v}},name:v,mount:!0,..._}}),c.mount.add(v),k?Vo({field:k,disabled:_.disabled,name:v}):I(v,!0,_.value),{...L?{disabled:_.disabled}:{},...n.progressive?{required:!!_.required,min:dr(_.min),max:dr(_.max),minLength:dr(_.minLength),maxLength:dr(_.maxLength),pattern:dr(_.pattern)}:{},name:v,onChange:Ne,onBlur:Ne,ref:P=>{if(P){Zt(v,_),k=O(o,v);const T=ie(P.value)&&P.querySelectorAll&&P.querySelectorAll("input,select,textarea")[0]||P,F=H1(T),ee=k._f.refs||[];if(F?ee.find(le=>le===T):T===k._f.ref)return;Q(o,v,{_f:{...k._f,...F?{refs:[...ee.filter(Xs),T,...Array.isArray(O(i,v))?[{}]:[]],ref:{type:T.type,name:v}}:{ref:T}}}),I(v,!1,void 0,T)}else k=O(o,v,{}),k._f&&(k._f.mount=!1),(n.shouldUnregister||_.shouldUnregister)&&!(L1(c.array,v)&&a.action)&&c.unMount.add(v)}}},Jt=()=>n.shouldFocusError&&So(o,ut,c.mount),dt=v=>{Tt(v)&&(f.state.next({disabled:v}),So(o,_=>{_.disabled=v},0,!1))},fr=(v,_)=>async k=>{k&&(k.preventDefault&&k.preventDefault(),k.persist&&k.persist());let L=ct(s);if(f.state.next({isSubmitting:!0}),n.resolver){const{errors:P,values:T}=await E();r.errors=P,L=T}else await K(o);ye(r.errors,"root"),Oe(r.errors)?(f.state.next({errors:{}}),await v(L,k)):(_&&await _({...r.errors},k),Jt(),setTimeout(Jt)),f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Oe(r.errors),submitCount:r.submitCount+1,errors:r.errors})},Oo=(v,_={})=>{O(o,v)&&(ie(_.defaultValue)?Le(v,O(i,v)):(Le(v,_.defaultValue),Q(i,v,_.defaultValue)),_.keepTouched||ye(r.touchedFields,v),_.keepDirty||(ye(r.dirtyFields,v),r.isDirty=_.defaultValue?B(v,O(i,v)):B()),_.keepError||(ye(r.errors,v),l.isValid&&g()),f.state.next({...r}))},Jd=(v,_={})=>{const k=v?ct(v):i,L=ct(k),P=v&&!Oe(v)?L:i;if(_.keepDefaultValues||(i=k),!_.keepValues){if(_.keepDirtyValues||h)for(const T of c.mount)O(r.dirtyFields,T)?Q(P,T,O(s,T)):Le(T,O(P,T));else{if(Ds&&ie(v))for(const T of c.mount){const F=O(o,T);if(F&&F._f){const ee=Array.isArray(F._f.refs)?F._f.refs[0]:F._f.ref;if(Mo(ee)){const le=ee.closest("form");if(le){le.reset();break}}}}o={}}s=e.shouldUnregister?_.keepDefaultValues?ct(i):{}:ct(P),f.array.next({values:{...P}}),f.values.next({values:{...P}})}c={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!a.mount&&t(),a.mount=!l.isValid||!!_.keepIsValid,a.watch=!!e.shouldUnregister,f.state.next({submitCount:_.keepSubmitCount?r.submitCount:0,isDirty:_.keepDirty?r.isDirty:!!(_.keepDefaultValues&&!Yt(v,i)),isSubmitted:_.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:_.keepDirtyValues?r.dirtyFields:_.keepDefaultValues&&v?qs(i,v):{},touchedFields:_.keepTouched?r.touchedFields:{},errors:_.keepErrors?r.errors:{},isSubmitSuccessful:_.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},Qd=(v,_)=>Jd(Ct(v)?v(s):v,_);return{control:{register:Zt,unregister:Ze,getFieldState:At,handleSubmit:fr,setError:Gt,_executeSchema:E,_getWatch:H,_getDirty:B,_updateValid:g,_removeUnmounted:j,_updateFieldArray:M,_updateDisabledField:Vo,_getFieldArray:X,_reset:Jd,_resetDefaultValues:()=>Ct(n.defaultValues)&&n.defaultValues().then(v=>{Qd(v,n.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:v=>{r={...r,...v}},_disableForm:dt,_subjects:f,_proxyFormState:l,get _fields(){return o},get _formValues(){return s},get _state(){return a},set _state(v){a=v},get _defaultValues(){return i},get _names(){return c},set _names(v){c=v},get _formState(){return r},set _formState(v){r=v},get _options(){return n},set _options(v){n={...n,...v}}},trigger:Y,register:Zt,handleSubmit:fr,watch:Ge,setValue:Le,getValues:Re,reset:Qd,resetField:Oo,clearErrors:Pt,unregister:Ze,setError:Gt,setFocus:(v,_={})=>{const k=O(o,v),L=k&&k._f;if(L){const P=L.refs?L.refs[0]:L.ref;P.focus&&(P.focus(),_.shouldSelect&&P.select())}},getFieldState:At}}function qd(e={}){const t=De.useRef(),n=De.useRef(),[r,o]=De.useState({isDirty:!1,isValidating:!1,isLoading:Ct(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},disabled:!1,defaultValues:Ct(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Y1(e,()=>o(s=>({...s}))),formState:r});const i=t.current.control;return i._options=e,F1({subject:i._subjects.state,next:s=>{I1(s,i._proxyFormState,i._updateFormState,!0)&&o({...i._formState})}}),De.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),De.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==r.isDirty&&i._subjects.state.next({isDirty:s})}},[i,r.isDirty]),De.useEffect(()=>{e.values&&!Yt(e.values,n.current)?(i._reset(e.values,i._options.resetOptions),n.current=e.values):i._resetDefaultValues()},[e.values,i]),De.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=R1(r,i),t.current}var Wd=function(e,t,n){if(e&&"reportValidity"in e){var r=O(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},G1=function(e,t){var n=function(o){var i=t.fields[o];i&&i.ref&&"reportValidity"in i.ref?Wd(i.ref,o,e):i.refs&&i.refs.forEach(function(s){return Wd(s,o,e)})};for(var r in t.fields)n(r)},Z1=function(e,t){t.shouldUseNativeValidation&&G1(e,t);var n={};for(var r in e){var o=O(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(Q1(t.names||Object.keys(e),r)){var s=Object.assign({},J1(O(n,r)));Q(s,"root",i),Q(n,r,s)}else Q(n,r,i)}return n},J1=function(e){return Array.isArray(e)?e.filter(Boolean):[]},Q1=function(e,t){return e.some(function(n){return n.startsWith(t+".")})},ey=function(e,t){for(var n={};e.issues.length;){var r=e.issues[0];if(r.path){var o=r.path.map(function(a){return a.key}).join(".");if(n[o]||(n[o]={message:r.message,type:r.validation}),t){var i=n[o].types,s=i&&i[r.validation];n[o]=Ed(o,t,n,r.validation,s?[].concat(s,r.message):r.message)}e.issues.shift()}}return n},Kd=function(e,t,n){return n===void 0&&(n={}),function(r,o,i){try{return Promise.resolve(function(s,a){try{var c=function(){function u(l){return{values:n.raw?r:l,errors:{}}}var d=Object.assign({},{abortEarly:!1,abortPipeEarly:!1},t);return n.mode==="sync"?u(rs(e,r,d)):Promise.resolve(og(e,r,d)).then(u)}()}catch(u){return a(u)}return c&&c.then?c.then(void 0,a):c}(0,function(s){if(s instanceof so)return{values:{},errors:Z1(ey(s,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}}};const ty=e=>{const t=Object.fromEntries(new FormData(e).entries());Object.keys(t).length&&e.dispatchEvent(new Event("submit",{bubbles:!0}))},ny=ts("multiple-choice"),ry=e=>{const t={min:e.minSelected??0,max:e.maxSelected??e.options.length};return Kd(bn({checked:ku(rg(Zv()),n=>Object.entries(n).filter(([r,o])=>o).map(([r,o])=>r),[ag(t.max,`Please select at most ${t.max} option${t.max!==1?"s":""}`),$u(t.min,`Please select at least ${t.min} option${t.min!==1?"s":""}`)])}))},oy=({input:e,onSubmitSuccess:t,onHeightChange:n})=>{var u,d;const r=e.key?(u=ne.current$.value.application)==null?void 0:u.data.submissions[e.key]:void 0,{register:o,handleSubmit:i,formState:{errors:s}}=qd({defaultValues:{checked:ny(r)?Object.fromEntries(r.value.map(l=>[l,!0])):{}},resolver:ry(e.config)}),a=Is(),c=e.config.minSelected===1&&e.config.maxSelected===1;return b("form",{noValidate:!0,class:"flex flex-col gap-1",onChange:l=>{c&&ty(l.currentTarget)},onSubmit:i(l=>{const f=l.checked;t(f)}),children:[b("div",{class:"flex items-center gap-2",children:[b("div",{class:Xt("flex w-full flex-1 flex-wrap gap-3 p-1",{"justify-center":e.config.options.length===1}),children:e.config.options.map((l,f)=>{const h=`checked.${l.value}`,{ref:p,...m}=o(h);return b("div",{children:[b("input",{autoFocus:f===0,ref:y=>{y&&f===0&&(a.current=y),p(y)},id:h,...m,class:"peer sr-only",type:"checkbox"}),b("label",{class:"bg-lowest peer-focus-visible:ring-accent-7 active:outline-neutral-10 ease-expo-out outline-neutral-12/5 text-neutral-11 peer-checked:outline-accent-7 peer-checked:bg-accent-2 peer-checked:text-accent-9 duration-snappy block rounded-2xl px-2.5 py-1 outline outline-2 ring-0 ring-transparent transition-all selection:bg-transparent peer-focus-visible:ring-4 peer-focus-visible:ring-offset-2",htmlFor:h,children:l.label})]},l.value)})}),!c&&b(ko,{})]}),b(Fs,{onAnimationComplete:n,error:(d=s.checked)==null?void 0:d.root})]})},Eo={email:"That doesn’t look like a valid email address",phone:"That doesn’t look like a valid phone number"},iy=We(Eo.phone,[cg(/^\+?[0-9 -]+$/,Eo.phone)]),sy={email:We(Eo.email,[sg(Eo.email)]),phone:ku(iy,e=>e.replace(/[^0-9]/g,"")),text:We([$u(1,"Please enter some text")]),url:We([lg("That doesn’t look like a valid URL")])},ay={email:{type:"email",inputMode:"email",formNoValidate:!0},phone:{type:"tel",inputMode:"tel"},text:{type:"text",inputMode:"text"},url:{type:"url",inputMode:"url",formNoValidate:!0}},cy=ts("text"),ly=e=>Kd(bn({text:sy[e.format]})),uy=({input:e,onSubmitSuccess:t,onHeightChange:n})=>{var d;const r=e.key?(d=ne.current$.value.application)==null?void 0:d.data.submissions[e.key]:void 0,{register:o,handleSubmit:i,formState:{errors:s}}=qd({defaultValues:{text:cy(r)?r.value:""},resolver:ly(e.config)}),{ref:a,...c}=o("text",{required:!0}),u=U();return Be(()=>{u.current&&(u.current.focus(),u.current.select())},[]),b("form",{noValidate:!0,class:"flex flex-col gap-1",onSubmit:i(l=>{t(l.text)}),children:[b("div",{class:"flex items-center gap-2",children:[b("input",{id:"chat-input",...c,...ay[e.config.format],autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:l=>{l&&(u.current=l),a(l)},class:"outline-neutral-12/5 ease-expo-out placeholder:text-neutral-5 focus-visible:outline-accent-7 caret-accent-9 duration-snappy flex-grow rounded-full px-3 py-1 text-base outline outline-2 transition-all",placeholder:e.config.placeholder}),b(ko,{})]}),b(Fs,{onAnimationComplete:n,error:s.text})]})},dy=({onSubmit:e,onInputChange:t,input:n})=>{const r=U(null),o=me(()=>{r.current&&(ns.value=r.current.getBoundingClientRect().height)},[]);G(()=>{o(),t(n==null?void 0:n.type)},[n==null?void 0:n.type,t,o]);const i=s=>a=>e({type:s,value:a});return b(Kn.div,{initial:{height:0},animate:{height:ns.value},exit:{height:0,opacity:0},class:"bg-neutral-2/80 absolute bottom-0 w-full overflow-hidden rounded-b-3xl backdrop-blur-md backdrop-saturate-150",children:b("div",{ref:r,class:"border-neutral-12/5 border-t p-2.5",children:nt({application:ne,input:n,onHeightChange:o}).with({input:Ae.nullish},()=>b("div",{class:"flex items-center gap-2",children:[b("input",{"aria-hidden":"true",id:"chat-input",class:"outline-neutral-12/5 placeholder:text-neutral-4 focus-visible:outline-accent-9 caret-accent-9 flex-grow rounded-full px-3 py-1 text-base outline outline-2",disabled:!0}),b(ko,{disabled:!0,"aria-hidden":"true",tabIndex:-1})]})).with({input:{type:"text"}},s=>b(uy,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"multiple-choice"}},s=>b(oy,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"boolean"}},s=>b(M1,{onSubmitSuccess:i(s.input.type),...s})).with({input:{type:"file"}},s=>b(E1,{onSubmitSuccess:i(s.input.type),...s})).exhaustive()})})},Yd=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,Gd=Xt,Zd=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Gd(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(u=>{const d=n==null?void 0:n[u],l=i==null?void 0:i[u];if(d===null)return null;const f=Yd(d)||Yd(l);return o[u][f]}),a=n&&Object.entries(n).reduce((u,d)=>{let[l,f]=d;return f===void 0||(u[l]=f),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:l,className:f,...h}=d;return Object.entries(h).every(p=>{let[m,y]=p;return Array.isArray(y)?y.includes({...i,...a}[m]):{...i,...a}[m]===y})?[...u,l,f]:u},[]);return Gd(e,s,c,n==null?void 0:n.class,n==null?void 0:n.className)},fy=Zd("max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink-1 min-w-[2rem] text-md py-2 px-3 rounded-[18px] min-h-[36px] break-words",{variants:{side:{left:"bg-lowest text-neutral-12 shadow-surface-sm outline outline-1 outline-neutral-11/[.08] rounded-bl-md",right:"ml-auto bg-accent-7 text-lowest rounded-br-md bubble-right"},transitionState:{entering:"opacity-0 translate-y-8",entered:"opacity-100 translate-y-0",exiting:"opacity-0 scale-0",exited:""}},defaultVariants:{side:"left"}}),hy={hidden:{y:"100%",scale:.75},shown:{y:0,scale:1}},py=({children:e,className:t,transitionState:n,side:r,...o})=>b(Kn.p,{variants:hy,initial:"hidden",animate:"shown",transition:{type:"spring",damping:25,stiffness:500},"data-transition":n,style:{transformOrigin:r==="left"?"0% 50%":"100% 50%"},class:fy({className:t,side:r,transitionState:n}),...o,children:e}),my=({className:e,...t})=>b("div",{"aria-label":"Typing…",class:Xt("flex gap-1 p-4",e),...t,children:Array.from({length:3},(n,r)=>b("div",{class:"bg-accent-7 h-1.5 w-1.5 animate-bounce rounded-full",style:{animationDelay:`${-r*200}ms`}}))}),vy={bot:"left",user:"right"},gy=Zd("w-full select-none py-2 text-center text-[10px] uppercase tracking-widest drop-shadow-[0_1.5px_white]",{variants:{variant:{info:"text-neutral-8",warning:"text-[#FFC107]",error:"text-error-9",success:"text-[#4CAF50]"}}}),by=({messages:e,isBotTyping:t})=>b("ol",{"aria-label":"Chat messages",class:"flex flex-grow flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",children:[b(to,{initial:!1,children:e.map((n,r)=>b("li",{class:"flex",children:nt(n).with({type:"system"},o=>b("p",{class:gy({variant:o.variant}),children:o.text})).with({type:"text",author:Ae.union("bot","user")},o=>b(py,{side:vy[o.author],children:o.text},r)).with({type:"link"},o=>b("div",{class:"bg-accent-8/5 flex w-full items-center justify-center overflow-hidden rounded-xl py-2",children:b("a",{class:"bg-lowest shadow-surface-sm ring-accent-8/20 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 flex items-center gap-1.5 truncate rounded-full py-2 pl-4 pr-2.5 no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",target:"_blank",href:o.href,children:[o.text,b("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:b("path",{d:"M3.64645 11.3536C3.45118 11.1583 3.45118 10.8417 3.64645 10.6465L10.2929 4L6 4C5.72386 4 5.5 3.77614 5.5 3.5C5.5 3.22386 5.72386 3 6 3L11.5 3C11.6326 3 11.7598 3.05268 11.8536 3.14645C11.9473 3.24022 12 3.36739 12 3.5L12 9.00001C12 9.27615 11.7761 9.50001 11.5 9.50001C11.2239 9.50001 11 9.27615 11 9.00001V4.70711L4.35355 11.3536C4.15829 11.5488 3.84171 11.5488 3.64645 11.3536Z",fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"})})]})})).with({type:"image"},o=>b("img",{class:"shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",src:o.url,style:{aspectRatio:o.width/o.height}})).with({type:"file"},o=>b(P1,{class:o.author==="bot"?"":"ml-auto",file:{name:o.fileName,sizeKb:o.fileSizeKb}})).exhaustive()},r))}),b("aside",{"aria-hidden":!0,children:t&&b(my,{})})]}),yy=25,wy=()=>{const e=U(null),[t,n]=ae(!1),[r,o]=ae(()=>()=>{}),i=de(()=>a=>{var c;return(c=e.current)==null?void 0:c.scrollTo({top:e.current.scrollHeight,...a})},[e]),s=de(()=>({send:async({message:a,signal:c,groupId:u})=>{if(await nt(a).with({author:"bot",type:"text"},async d=>{if(c!=null&&c.aborted)throw new Jn;n(!0);const l=Math.min(Math.max(20,d.text.length),100)*yy;await new Promise(f=>setTimeout(f,l,{signal:c})),n(!1)}).otherwise(async()=>{}),c!=null&&c.aborted)throw new Jn;ne.addMessage(a,u)},input:async({input:a,signal:c})=>{if(c!=null&&c.aborted)throw new Jn;return ne.setInput(a),await new Promise(u=>{const d=l=>{if(c!=null&&c.aborted)throw new Jn;ne.setInput(void 0),a.key&&ne.setSubmission(a.key,l),u(l)};o(()=>d)})}}),[]);return{chatRef:e,chatService:s,isBotTyping:t,onSubmitSuccessFn:r,scrollToEnd:i}},_y=Object.freeze(Object.defineProperty({__proto__:null,JobApplicationContent:({currentApplication:e,logger:t,apiClient:n,analytics:r})=>{const{chatRef:o,chatService:i,isBotTyping:s,onSubmitSuccessFn:a,scrollToEnd:c}=wy(),u=rt.value,d=e.flow,l=e.job;return Be(()=>{u==="maximised"&&c({behavior:"instant"})},[c,u]),G(()=>{c({behavior:"smooth"})},[e.data.messages,c]),Be(()=>{const{state:f,application:h}=ne.current$.peek();if(f!=="loaded")throw new Error(Vv.invalid_state);const p=h.data.currentNodeId;if(c({behavior:"instant"}),ne.setInput(void 0),h.data.isFinished)return;ne.removeLastGroupMessagesById(p);const{interpret:m,abort:y}=l1({context:{jobId:l.id,flowId:d.id},analytics:r,apiClient:n,logger:t,flow:d.nodes,chatService:i,getSubmissions:()=>{var x;return(x=ne.current$.peek().application)==null?void 0:x.data.submissions},onInterpret:(x,g)=>{const w=ne.current$.peek().application;rn(w),w.data.sequence=w.data.sequence+1,r.log({event:"FLOW_NODE",attributionKey:`job_${l.id}`,properties:{flow_id:d.id,flow_version:d.version,job_id:l.id,from_node_id:g?g.id:null,to_node_id:x.id,sequence:w.data.sequence,flow_session_id:w.data.flowSessionId}}),ne.setCurrentNodeId(x.id)},onFlowEnd:async()=>{ne.markAsFinished()}});return m(p),y},[r,n,i,t,c,d,l.id,e.startedAt]),b(ue,{children:[b("div",{ref:o,className:"hide-scrollbars relative flex max-w-full flex-grow flex-col overflow-y-scroll",style:{WebkitOverflowScrolling:"touch",paddingBottom:ns.value},children:b(to,{children:b(by,{isBotTyping:s,messages:e.data.messages})})}),b(dy,{input:e.data.currentInput,onInputChange:()=>c({behavior:"smooth"}),onSubmit:a})]})}},Symbol.toStringTag,{value:"Module"}))})();
@@ -8298,7 +8298,7 @@ const ChatbotHeader = ({
8298
8298
  })]
8299
8299
  });
8300
8300
  };
8301
- const JobApplicationContent = M$1(() => Promise.resolve().then(() => require("./job-application-content-c6f67504.cjs")).then((module2) => module2.JobApplicationContent));
8301
+ const JobApplicationContent = M$1(() => Promise.resolve().then(() => require("./job-application-content-ff6165e9.cjs")).then((module2) => module2.JobApplicationContent));
8302
8302
  const MotionProvider = ({
8303
8303
  children
8304
8304
  }) => {
@@ -12263,6 +12263,7 @@ const chatbotPlugin = ({
12263
12263
  if (res.ok) {
12264
12264
  await analytics.log({
12265
12265
  event: "APPLY_START",
12266
+ attributionKey: `job_${jobId}`,
12266
12267
  properties: {
12267
12268
  job_id: jobId,
12268
12269
  flow_id: res.value.flow.id
@@ -8297,7 +8297,7 @@ const ChatbotHeader = ({
8297
8297
  })]
8298
8298
  });
8299
8299
  };
8300
- const JobApplicationContent = M$1(() => import("./job-application-content-cad50c16.js").then((module) => module.JobApplicationContent));
8300
+ const JobApplicationContent = M$1(() => import("./job-application-content-425367df.js").then((module) => module.JobApplicationContent));
8301
8301
  const MotionProvider = ({
8302
8302
  children
8303
8303
  }) => {
@@ -12262,6 +12262,7 @@ const chatbotPlugin = ({
12262
12262
  if (res.ok) {
12263
12263
  await analytics.log({
12264
12264
  event: "APPLY_START",
12265
+ attributionKey: `job_${jobId}`,
12265
12266
  properties: {
12266
12267
  job_id: jobId,
12267
12268
  flow_id: res.value.flow.id
@@ -1,4 +1,4 @@
1
- import { _, g as getHeadOrThrow, A as AbortedError, N, a as getApplicationSubmissionsPayload, i as invariant, o as o$1, c as clsx, b as _$1, p, d as parse, e as picklist, m, f as AnimatePresence, h as application, j as h, k, l as isSubmissionOfType, C as Cn, n as parseAsync, V as ValiError, q as object, t as transform, r as maxLength, s as minLength, u as record, v as boolean, w as string, x as email, y as url, z as regex, B as y, T, D as inputHeight, F, E as viewState, G as ERROR_MESSAGES } from "./index-9c04d32c.js";
1
+ import { _, g as getHeadOrThrow, A as AbortedError, N, a as getApplicationSubmissionsPayload, i as invariant, o as o$1, c as clsx, b as _$1, p, d as parse, e as picklist, m, f as AnimatePresence, h as application, j as h, k, l as isSubmissionOfType, C as Cn, n as parseAsync, V as ValiError, q as object, t as transform, r as maxLength, s as minLength, u as record, v as boolean, w as string, x as email, y as url, z as regex, B as y, T, D as inputHeight, F, E as viewState, G as ERROR_MESSAGES } from "./index-873a3e2d.js";
2
2
  import "@inploi/sdk";
3
3
  const followNodes = ({
4
4
  node,
@@ -193,6 +193,7 @@ async function interpretSubmitNode({
193
193
  if (contextJobId) {
194
194
  analytics.log({
195
195
  event: "APPLY_COMPLETE",
196
+ attributionKey: `job_${contextJobId}`,
196
197
  properties: {
197
198
  job_id: contextJobId,
198
199
  flow_id: contextFlowId
@@ -2897,6 +2898,7 @@ const JobApplicationContent = ({
2897
2898
  currentState.data.sequence = currentState.data.sequence + 1;
2898
2899
  analytics.log({
2899
2900
  event: "FLOW_NODE",
2901
+ attributionKey: `job_${job.id}`,
2900
2902
  properties: {
2901
2903
  flow_id: flow.id,
2902
2904
  flow_version: flow.version,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-014d41e2.cjs");
3
+ const index = require("./index-7659d6f8.cjs");
4
4
  require("@inploi/sdk");
5
5
  const followNodes = ({
6
6
  node,
@@ -195,6 +195,7 @@ async function interpretSubmitNode({
195
195
  if (contextJobId) {
196
196
  analytics.log({
197
197
  event: "APPLY_COMPLETE",
198
+ attributionKey: `job_${contextJobId}`,
198
199
  properties: {
199
200
  job_id: contextJobId,
200
201
  flow_id: contextFlowId
@@ -2899,6 +2900,7 @@ const JobApplicationContent = ({
2899
2900
  currentState.data.sequence = currentState.data.sequence + 1;
2900
2901
  analytics.log({
2901
2902
  event: "FLOW_NODE",
2903
+ attributionKey: `job_${job.id}`,
2902
2904
  properties: {
2903
2905
  flow_id: flow.id,
2904
2906
  flow_version: flow.version,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-014d41e2.cjs");
3
+ const index = require("./index-7659d6f8.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { H } from "./index-9c04d32c.js";
1
+ import { H } from "./index-873a3e2d.js";
2
2
  import "@inploi/sdk";
3
3
  export {
4
4
  H as chatbotPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-chatbot",
3
- "version": "3.6.1",
3
+ "version": "3.6.2",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",
@@ -58,7 +58,7 @@
58
58
  "tailwindcss-touch": "^1.0.1",
59
59
  "ts-pattern": "^5.0.6",
60
60
  "ts-toolbelt": "^9.6.0",
61
- "typescript": "^5.3.2",
61
+ "typescript": "^5.3.0",
62
62
  "valibot": "^0.21.0",
63
63
  "vite": "^4.4.5",
64
64
  "vite-plugin-dts": "^3.7.0",