@opengovsg/confetti 0.5.1 → 0.6.0
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/build/Button-uM2fAs2N.js +7 -0
- package/build/{Confetti-ClwOwSrM.d.ts → Confetti-fis-IO5o.d.ts} +1 -1
- package/build/{DefaultConfettiTrigger-DFJBQ35H.js → DefaultConfettiTrigger-CxIyRNHv.js} +1 -1
- package/build/Embed-CtGEGKcw.js +1 -0
- package/build/ModalContainer-jzFfmvRQ.js +5 -0
- package/build/{RecordingReplayer-BvU_CHwb.js → RecordingReplayer-DNYXhses.js} +8 -8
- package/build/client-internals.js +1 -1
- package/build/components.d.ts +10 -4
- package/build/components.js +1 -1
- package/build/confetti.css +7 -2
- package/build/index.d.ts +2 -2
- package/build/index.js +1 -1
- package/build/internals-Cc32ucML.js +1 -0
- package/build/internals.d.ts +5 -5
- package/build/internals.js +1 -1
- package/build/record--U99gpCM.js +53 -0
- package/build/{snapdom-BQZEILL6.js → snapdom-BbRa4ZYv.js} +2 -2
- package/build/static.d.ts +2 -2
- package/build/static.js +1 -1
- package/build/types-NMQZur7D.d.ts +345 -0
- package/package.json +9 -11
- package/build/Button-giwEer5K.js +0 -7
- package/build/Embed-J5cfWjpk.js +0 -1
- package/build/ModalContainer-B-WGlRn4.js +0 -5
- package/build/internals-B5GhpjgM.js +0 -1
- package/build/record-BZwNFiEW.js +0 -53
- package/build/types-C-q5VrLk.d.ts +0 -333
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e,{createContext as t,forwardRef as n,useCallback as r,useContext as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";import l from"ky";import{z as u}from"zod";import d from"clsx";import"react-dom";const f=l.create({prefixUrl:`https://confetti.gov.sg`,retry:{limit:3,methods:[`get`,`head`]},timeout:6e4});function p({publishableKey:e,apiBaseUrl:t}){return o(()=>{let n={headers:{"x-cfti-pk":e}};return t&&(n.prefixUrl=t),f.extend(n)},[t,e])}const m=u.object({type:u.literal(`next`)}),h=u.object({type:u.literal(`end`)}),g=u.object({type:u.literal(`jump`),target:u.number({error:`Target question is required`})}),_=u.discriminatedUnion(`type`,[m,g,h]),v=u.object({type:u.literal(`value`),value:u.union([u.string().check(u.trim(),u.minLength(1,{error:`Value is required`})),u.number({error:`Value is required`})])}),y=u.object({type:u.literal(`binary-operator`),operator:u.union([u.literal(`equal`),u.literal(`not-equal`),u.literal(`greater`),u.literal(`greater-or-equal`),u.literal(`less`),u.literal(`less-or-equal`),u.literal(`contains`),u.literal(`not-contains`)]),value:v,target:_}),b=u.object({type:u.literal(`switch`),cases:u.array(y),default:_}),x=u.object({type:u.literal(`always`),target:_}),S=u.discriminatedUnion(`type`,[x,b]),C=u.string().check(u.trim(),u.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),w=u.optional(u.string().check(u.trim(),u.maxLength(50))),T=u.object({value:u.string().check(u.trim(),u.minLength(1,{error:`Value is required`})),description:u.optional(u.string().check(u.trim()))}),E=u.nullable(u.object({label:u.string().check(u.trim(),u.minLength(1,{error:`Value is required`})),max:u.number(),description:u.optional(u.string().check(u.trim()))})),D=u.optional(u.boolean()),ee=u.object({type:u.literal(`rating`),buttonLabel:w,shouldAutoProgress:D,scale:u.number().check(u.gte(2),u.lte(10)),labels:u.optional(u.object({lower:u.optional(u.pipe(u.string().check(u.trim()),u.transform(e=>e===``?void 0:e))),upper:u.optional(u.pipe(u.string().check(u.trim()),u.transform(e=>e===``?void 0:e)))})),display:u.optional(u.literal([`star`,`emoji`,`number`]))}),O=u.object({type:u.literal(`open-ended`),placeholder:u.optional(u.string()),buttonLabel:w,max:u.number()}),te=u.object({type:u.literal(`single-select`),shouldAutoProgress:D,options:u.array(T),buttonLabel:w,editable:E}),ne=u.object({type:u.literal(`multi-select`),buttonLabel:w,options:u.array(T),editable:E,max:u.optional(u.number()),display:u.optional(u.literal([`checkbox`,`tag`]))}),re=u.object({type:u.literal(`statement`),buttonLabel:w,buttonUrl:u.optional(C)}),ie=u.object({type:u.literal(`bug-report`),placeholder:u.optional(u.string()),buttonLabel:w,enableScreenshot:u.boolean(),enableRecording:u.boolean(),detailsLabel:u.string().check(u.trim(),u.minLength(1,{error:`Label is required`}),u.maxLength(128)),detailsPlaceholder:u.optional(u.string()),redactClasses:u.optional(u.array(u.string()))}),ae=u.discriminatedUnion(`type`,[ee,te,O,ne,re,ie]),oe=`__CONFETTI_CHECKBOX_Others`,se=`__CONFETTI_RADIO_Others`,ce=u.optional(u.looseObject({userAgent:u.string().check(u.trim(),u.maxLength(1e3)),screenResolution:u.string().check(u.trim(),u.maxLength(100)),viewportSize:u.string().check(u.trim(),u.maxLength(100)),pageUrl:u.string(),pageTitle:u.string().check(u.trim(),u.maxLength(1e3)),referrer:u.string(),datadogTraceId:u.optional(u.string()),datadogSessionId:u.optional(u.string()),datadogSessionReplayLink:u.optional(u.string())}).partial().catchall(u.optional(u.string())));u.cuid2();const le=u.looseObject({type:u.literal([0,1,2,3,4,5,6]),data:u.unknown(),timestamp:u.number(),delay:u.optional(u.number())});u.array(le);const ue=u.array(le),de=u.string().check(u.refine(e=>{try{return ue.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),fe=u.string().check(u.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),pe=e=>u.object({title:u.string().check(u.trim(),...e?[u.minLength(1,{error:`Title is required`})]:[],u.maxLength(256)),description:u.optional(u.string().check(u.trim(),u.maxLength(4096))),screenshotDataUrl:u.optional(fe),recordingEventsJson:u.optional(de),metadata:ce}),me=pe(!0),he=(e,{required:t})=>pe(t),ge=e=>u.number({error:`Please select a rating`}).check(u.int(),u.gte(1),u.lte(e)),_e=({scale:e},{required:t})=>{let n=ge(e);return t?n:u.optional(n)},ve=({maxLength:e},{required:t})=>u.string().check(u.trim(),...t?[u.minLength(1,{error:`This field is required`})]:[],u.maxLength(e??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),ye=(e,t)=>u.string({error:`Please select an option`}).check(u.trim(),...t?[u.minLength(1,{error:`This field is required`})]:[],u.maxLength(e??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),u.refine(e=>e!==se,{error:`Please fill out the free text field`})),be=({maxLength:e},{required:t})=>{let n=ye(e,t);return t?n:u.optional(n)},xe=({maxSelected:e,maxLength:t},{required:n})=>u.array(u.string().check(u.trim(),...n?[u.minLength(1,{error:`This field is required`})]:[],u.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),u.refine(e=>e!==oe,{error:`Please fill out the free text field`}))).check(...n?[u.minLength(1,{error:`Please select at least one option`})]:[],u.maxLength(e??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),Se=()=>u.optional(u.string()),k=u.cuid2(),Ce=u.object({title:u.string().check(u.trim()),description:u.string().check(u.trim()),buttonText:u.string().check(u.trim())}),we=u.object({id:u.string(),title:u.string(),description:u.nullable(u.string()),position:u.number(),required:u.boolean(),properties:ae,routingLogic:S}),Te=u.object({title:u.string(),description:u.nullable(u.string()),questions:u.array(we),confirmation:Ce});u.object({cursor:u.optional(u.string().check(u.minLength(1),u.maxLength(100))),limit:u.optional(u.number().check(u.int(),u.gte(1),u.lte(100)))});const Ee=u.object({id:u.string(),title:u.string(),description:u.nullable(u.string()),status:u.enum([`active`,`inactive`]),createdAt:u.date(),updatedAt:u.date()});u.object({data:u.array(Ee),nextCursor:u.nullable(u.string()),limit:u.number(),links:u.object({self:u.string(),next:u.nullable(u.string())})}),u.object({surveyId:k});const De=we;u.object({data:u.object({...Ee.shape,questions:u.array(De)})}),u.object({surveyId:k,responseId:u.union([u.cuid2(),u.uuid()])});const Oe=u.catch(u.object({type:u.enum([`embedded`,`popover`,`modal`]),version:u.string().check(u.trim(),u.minLength(1),u.maxLength(50)),build:u.string().check(u.trim(),u.minLength(1),u.maxLength(50))}).partial(),{}),ke=u.record(u.string(),u.union([u.string().check(u.trim(),u.maxLength(2048)),u.number(),u.array(u.string().check(u.trim(),u.maxLength(2048))).check(u.maxLength(1024)),me])),Ae=u.string().check(u.trim(),u.maxLength(1e3)),je=u.record(Ae,Ae).check(u.refine(e=>Object.keys(e).length<=20,`At most 20 metadata entries are allowed.`));u.object({respondent:u.string().check(u.trim(),u.minLength(1),u.maxLength(2048)),data:ke,metadata:je,telemetry:u.optional(Oe)}),u.object({id:u.string(),createdAt:u.date()}),u.object({surveyId:k,respondent:u.string().check(u.trim(),u.minLength(1),u.maxLength(2048))}),u.object({surveyId:k,respondent:u.string().check(u.trim(),u.minLength(1),u.maxLength(2048))}),u.object({surveyId:k});const Me=u.object({lastRespondedAt:u.nullable(u.union([u.iso.datetime(),u.date()])),lastViewedAt:u.nullable(u.union([u.iso.datetime(),u.date()])),lastDismissedAt:u.nullable(u.union([u.iso.datetime(),u.date()]))});u.object({type:u.enum([`view`,`dismiss`])}),u.object({}),u.object({surveyId:k}),u.object({respondent:u.optional(u.string().check(u.trim(),u.minLength(1),u.maxLength(255))),after:u.optional(u.iso.datetime({offset:!0,local:!0})),before:u.optional(u.iso.datetime({offset:!0,local:!0})),cursor:u.optional(u.string().check(u.minLength(1),u.maxLength(100))),limit:u.optional(u.number().check(u.int(),u.gte(1),u.lte(100)))});const Ne=u.object({id:u.string(),respondent:u.string(),data:ke,clientMetadata:u.record(u.string(),u.string()),createdAt:u.date()});u.object({data:u.array(Ne),nextCursor:u.nullable(u.string()),limit:u.number(),links:u.object({self:u.string(),next:u.nullable(u.string())})});const A=u.number().check(u.int(),u.gte(0));u.object({data:u.object({totalViews:A,uniqueViewers:A,totalDismissals:A,uniqueDismissers:A,totalResponses:A,uniqueResponders:A})}),u.object({questionIds:u.array(u.string()).check(u.minLength(1)),timeRange:u.union([u.enum([`last-7-days`,`last-30-days`]),u.string().check(u.regex(/^q[1-4]-\d{4}$/)),u.string().check(u.regex(/^custom_\d{4}-\d{2}-\d{2}_\d{4}-\d{2}-\d{2}$/))])});const Pe=u.record(u.string(),u.record(u.string(),u.number()));u.object({data:u.object({current:Pe,previousQuarter:u.nullable(Pe)})});function Fe(e){if(typeof window>`u`||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function Ie(e){return typeof window<`u`&&window.navigator!=null&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function j(e){let t=null;return()=>(t??=e(),t)}const M=j(function(){return Ie(/^Mac/i)}),Le=j(function(){return Ie(/^iPhone/i)}),Re=j(function(){return Ie(/^iPad/i)||M()&&navigator.maxTouchPoints>1}),ze=j(function(){return Le()||Re()}),Be=j(function(){return Fe(/AppleWebKit/i)&&!Ve()}),Ve=j(function(){return Fe(/Chrome/i)}),He=j(function(){return Fe(/Android/i)}),Ue=j(function(){return Fe(/Firefox/i)});function N(e){if(We())e.focus({preventScroll:!0});else{let t=Ge(e);e.focus(),Ke(t)}}let P=null;function We(){if(P==null){P=!1;try{document.createElement(`div`).focus({get preventScroll(){return P=!0,!0}})}catch{}}return P}function Ge(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function Ke(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function F(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}=t;Ue()&&window.event?.type?.startsWith(`key`)&&e.target===`_blank`&&(M()?r=!0:i=!0);let s=Be()&&M()&&!Re()?new KeyboardEvent(`keydown`,{keyIdentifier:`Enter`,metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}):new MouseEvent(`click`,{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o,detail:1,bubbles:!0,cancelable:!0});F.isOpening=n,N(e),e.dispatchEvent(s),F.isOpening=!1}F.isOpening=!1;const I=typeof document<`u`?e.useLayoutEffect:()=>{},qe={prefix:String(Math.round(Math.random()*1e10)),current:0},Je=e.createContext(qe),Ye=e.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let Xe=new WeakMap;function Ze(t=!1){let n=i(Je),r=s(null);if(r.current===null&&!t){let t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(t){let e=Xe.get(t);e==null?Xe.set(t,{id:n.current,state:t.memoizedState}):t.memoizedState!==e.state&&(n.current=e.id,Xe.delete(t))}r.current=++n.current}return r.current}function Qe(e){let t=i(Je),n=Ze(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function $e(t){let n=e.useId(),[r]=c(it()),i=r?`react-aria`:`react-aria${qe.prefix}`;return t||`${i}-${n}`}const et=typeof e.useId==`function`?$e:Qe;function tt(){return!1}function nt(){return!0}function rt(e){return()=>{}}function it(){return typeof e.useSyncExternalStore==`function`?e.useSyncExternalStore(rt,tt,nt):i(Ye)}function at(e){let[t,n]=c(e),i=s(t),a=s(null),o=s(()=>{if(!a.current)return;let e=a.current.next();if(e.done){a.current=null;return}i.current===e.value?o.current():n(e.value)});return I(()=>{i.current=t,a.current&&o.current()}),[t,r(e=>{a.current=e(i.current),o.current()},[o])]}let ot=!!(typeof window<`u`&&window.document&&window.document.createElement),L=new Map,R;typeof FinalizationRegistry<`u`&&(R=new FinalizationRegistry(e=>{L.delete(e)}));function st(e){let[t,n]=c(e),r=s(null),i=et(t),o=s(null);if(R&&R.register(o,i),ot){let e=L.get(i);e&&!e.includes(r)?e.push(r):L.set(i,[r])}return I(()=>{let e=i;return()=>{R&&R.unregister(o),L.delete(e)}},[i]),a(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function ct(e,t){if(e===t)return e;let n=L.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=L.get(t);return r?(r.forEach(t=>t.current=e),e):t}function lt(e=[]){let t=st(),[n,i]=at(t),a=r(()=>{i(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,i]);return I(a,[t,a,...e]),n}function ut(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}const z=e=>e?.ownerDocument??document,B=e=>e&&`window`in e&&e.window===e?e:z(e).defaultView||window;function dt(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function ft(e){return dt(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function pt(){return!1}function V(e,t){if(!pt())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n=n.tagName===`SLOT`&&n.assignedSlot?n.assignedSlot.parentNode:ft(n)?n.host:n.parentNode}return!1}const H=(e=document)=>{if(!pt())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function U(e){if(pt()&&e.target instanceof Element&&e.target.shadowRoot){if(`composedPath`in e)return e.composedPath()[0]??null;if(`composedPath`in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}function mt(e){if(!e)return!1;let t=e.getRootNode(),n=B(e);if(!(t instanceof n.Document||t instanceof n.ShadowRoot))return!1;let r=t.activeElement;return r!=null&&e.contains(r)}function ht(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=gt(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():gt(e[n],null)})}}}function gt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function W(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let e in r){let n=t[e],i=r[e];typeof n==`function`&&typeof i==`function`&&e[0]===`o`&&e[1]===`n`&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90?t[e]=ut(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=d(n,i):e===`id`&&n&&i?t.id=ct(n,i):e===`ref`&&n&&i?t.ref=ht(n,i):t[e]=i===void 0?n:i}}return t}const _t=new Set([`id`]),vt=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),yt=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),bt=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),xt=new Set(`onClick.onAuxClick.onContextMenu.onDoubleClick.onMouseDown.onMouseEnter.onMouseLeave.onMouseMove.onMouseOut.onMouseOver.onMouseUp.onTouchCancel.onTouchEnd.onTouchMove.onTouchStart.onPointerDown.onPointerMove.onPointerUp.onPointerCancel.onPointerEnter.onPointerLeave.onPointerOver.onPointerOut.onGotPointerCapture.onLostPointerCapture.onScroll.onWheel.onAnimationStart.onAnimationEnd.onAnimationIteration.onTransitionCancel.onTransitionEnd.onTransitionRun.onTransitionStart`.split(`.`)),St=/^(data-.*)$/;function Ct(e,t={}){let{labelable:n,isLink:r,global:i,events:a=i,propNames:o}=t,s={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(_t.has(t)||n&&vt.has(t)||r&&yt.has(t)||i&&bt.has(t)||a&&(xt.has(t)||t.endsWith(`Capture`)&&xt.has(t.slice(0,-7)))||o?.has(t)||St.test(t))&&(s[t]=e[t]);return s}let G=new Map,wt=new Set;function Tt(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{let r=U(t);if(!e(t)||!r)return;let i=G.get(r);i||(i=new Set,G.set(r,i),r.addEventListener(`transitioncancel`,n,{once:!0})),i.add(t.propertyName)},n=t=>{let r=U(t);if(!e(t)||!r)return;let i=G.get(r);if(i&&(i.delete(t.propertyName),i.size===0&&(r.removeEventListener(`transitioncancel`,n),G.delete(r)),G.size===0)){for(let e of wt)e();wt.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,Tt):Tt());function Et(){for(let[e]of G)`isConnected`in e&&!e.isConnected&&G.delete(e)}function Dt(e){requestAnimationFrame(()=>{Et(),G.size===0?e():wt.add(e)})}function Ot(){let e=s(new Map),t=r((t,n,r,i)=>{let a=i?.once?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:a,options:i}),t.addEventListener(n,a,i)},[]),n=r((t,n,r,i)=>{let a=e.current.get(r)?.fn||r;t.removeEventListener(n,a,i),e.current.delete(r)},[]),i=r(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return a(()=>i,[i]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:i}}function kt(e){let t=s(null),n=s(void 0),i=r(t=>{if(typeof e==`function`){let n=e,r=n(t);return()=>{typeof r==`function`?r():n(null)}}else if(e)return e.current=t,()=>{e.current=null}},[e]);return o(()=>({get current(){return t.current},set current(e){t.current=e,n.current&&=(n.current(),void 0),e!=null&&(n.current=i(e))}}),[i])}const At=e.useInsertionEffect??I;function jt(e){let t=s(null);return At(()=>{t.current=e},[e]),r((...e)=>{let n=t.current;return n?.(...e)},[])}function Mt(e,t){I(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function Nt(e){return e.pointerType===``&&e.isTrusted?!0:He()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Pt(e){return!He()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}const Ft=typeof Element<`u`&&`checkVisibility`in Element.prototype;function It(e){let t=B(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:r}=e.style,i=n!==`none`&&r!==`hidden`&&r!==`collapse`;if(i){let{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:r}=t(e);i=n!==`none`&&r!==`hidden`&&r!==`collapse`}return i}function Lt(e,t){return!e.hasAttribute(`hidden`)&&!e.hasAttribute(`data-react-aria-prevent-focus`)&&(e.nodeName===`DETAILS`&&t&&t.nodeName!==`SUMMARY`?e.hasAttribute(`open`):!0)}function Rt(e,t){return Ft?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&It(e)&&Lt(e,t)&&(!e.parentElement||Rt(e.parentElement,e))}const zt=[`input:not([disabled]):not([type=hidden])`,`select:not([disabled])`,`textarea:not([disabled])`,`button:not([disabled])`,`a[href]`,`area[href]`,`summary`,`iframe`,`object`,`embed`,`audio[controls]`,`video[controls]`,`[contenteditable]:not([contenteditable^="false"])`,`permission`],Bt=zt.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;zt.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const Vt=zt.join(`:not([hidden]):not([tabindex="-1"]),`);function Ht(e,t){return e.matches(Bt)&&!Wt(e)&&(t?.skipVisibilityCheck||Rt(e))}function Ut(e){return e.matches(Vt)&&Rt(e)&&!Wt(e)}function Wt(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}function Gt(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let Kt=new WeakMap;function qt(e){let t=e??(typeof document<`u`?document:void 0);if(!t)return Gt(t);if(Kt.has(t))return Kt.get(t);let n=t.querySelector(`meta[property="csp-nonce"]`),r=n&&n instanceof B(n).HTMLMetaElement&&(n.nonce||n.content)||Gt(t)||void 0;return r!==void 0&&Kt.set(t,r),r}const Jt=Symbol(`default`);function Yt({values:t,children:n}){for(let[r,i]of t)n=e.createElement(r.Provider,{value:i},n);return n}function Xt(e){let{className:t,style:n,children:r,defaultClassName:i,defaultChildren:a,defaultStyle:s,values:c,render:l}=e;return o(()=>{let e,o,u;return e=typeof t==`function`?t({...c,defaultClassName:i}):t,o=typeof n==`function`?n({...c,defaultStyle:s||{}}):n,u=typeof r==`function`?r({...c,defaultChildren:a}):r??a,{className:e??i,style:o||s?{...s,...o}:void 0,children:u??a,"data-rac":``,render:l?e=>l(e,c):void 0}},[t,n,r,i,a,s,c,l])}function Zt(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function Qt(e,t){let n=i(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||Jt;if(!n.slots[e]){let e=new Intl.ListFormat().format(Object.keys(n.slots).map(e=>`"${e}"`)),r=t?`Invalid slot "${t}".`:`A slot prop is required.`;throw Error(`${r} Valid slot names are ${e}.`)}return n.slots[e]}return n}function $t(e,t,n){let{ref:r,...i}=Qt(n,e.slot)||{},a=kt(o(()=>ht(t,r),[t,r])),s=W(i,e);return`style`in i&&i.style&&`style`in e&&e.style&&(typeof i.style==`function`||typeof e.style==`function`?s.style=t=>{let n=typeof i.style==`function`?i.style(t):i.style,r={...t.defaultStyle,...n},a=typeof e.style==`function`?e.style({...t,defaultStyle:r}):e.style;return{...r,...a}}:s.style={...i.style,...e.style}),[s,a]}function en(e=!0){let[t,n]=c(e),i=s(!1),a=r(e=>{i.current=!0,n(!!e)},[]);return I(()=>{i.current||n(!1)},[]),[a,t]}function tn(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}function nn(t,n,r){let{render:i,...a}=n,c=s(null),l=o(()=>ht(r,c),[r,c]);I(()=>{},[t,i]);let u={...a,ref:l};return i?i(u,void 0):e.createElement(t,u)}const rn={},an=new Proxy({},{get(e,t){if(typeof t!=`string`)return;let r=rn[t];return r||(r=n(nn.bind(null,t)),rn[t]=r),r}});function on(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function sn(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function cn(e){let t=s({isFocused:!1,observer:null});return I(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),r(n=>{let r=U(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let n=r;n.addEventListener(`focusout`,r=>{if(t.current.isFocused=!1,n.disabled){let t=on(r);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&n.disabled){t.current.observer?.disconnect();let e=n===H()?null:H();n.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:e})),n.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:e}))}}),t.current.observer.observe(n,{attributes:!0,attributeFilter:[`disabled`]})}},[e])}let ln=!1;function un(e){for(;e&&!Ht(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=B(e),n=t.document.activeElement;if(!n||n===e)return;ln=!0;let r=!1,i=e=>{(U(e)===n||r)&&e.stopImmediatePropagation()},a=t=>{(U(t)===n||r)&&(t.stopImmediatePropagation(),!e&&!r&&(r=!0,N(n),c()))},o=t=>{(U(t)===e||r)&&t.stopImmediatePropagation()},s=t=>{(U(t)===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,N(n),c()))};t.addEventListener(`blur`,i,!0),t.addEventListener(`focusout`,a,!0),t.addEventListener(`focusin`,s,!0),t.addEventListener(`focus`,o,!0);let c=()=>{cancelAnimationFrame(l),t.removeEventListener(`blur`,i,!0),t.removeEventListener(`focusout`,a,!0),t.removeEventListener(`focusin`,s,!0),t.removeEventListener(`focus`,o,!0),ln=!1,r=!1},l=requestAnimationFrame(c);return c}let K=`default`,dn=``,fn=new WeakMap;function pn(e){if(ze()){if(K==="default"){let t=z(e);dn=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}K=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;fn.set(e,e.style[t]),e.style[t]=`none`}}function mn(e){if(ze()){if(K!==`disabled`)return;K=`restoring`,setTimeout(()=>{Dt(()=>{if(K===`restoring`){let t=z(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=dn||``),dn=``,K=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&fn.has(e)){let t=fn.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),fn.delete(e)}}const hn=e.createContext({register:()=>{}});hn.displayName=`PressResponderContext`;function gn(e){let t=i(hn);if(t){let{register:n,ref:r,...i}=t;e=W(i,e),n()}return Mt(t,e.ref),e}var _n=class{#e;constructor(e,t,n,r){this.#e=!0;let i=(r?.target??n.currentTarget)?.getBoundingClientRect(),a,o=0,s,c=null;n.clientX!=null&&n.clientY!=null&&(s=n.clientX,c=n.clientY),i&&(s!=null&&c!=null?(a=s-i.left,o=c-i.top):(a=i.width/2,o=i.height/2)),this.type=e,this.pointerType=t,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.x=a,this.y=o,this.key=n.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}};const vn=Symbol(`linkClicked`),yn=`react-aria-pressable-style`,bn=`data-react-aria-pressable`;function xn(e){let{onPress:t,onPressChange:n,onPressStart:i,onPressEnd:l,onPressUp:u,onClick:d,isDisabled:f,isPressed:p,preventFocusOnPress:m,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:g,ref:_,...v}=gn(e),[y,b]=c(!1),x=s({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:S,removeAllGlobalListeners:C}=Ot(),w=r((e,t)=>{let r=x.current;if(f||r.didFirePressStart)return!1;let a=!0;if(r.isTriggeringEvent=!0,i){let n=new _n(`pressstart`,t,e);i(n),a=n.shouldStopPropagation}return n&&n(!0),r.isTriggeringEvent=!1,r.didFirePressStart=!0,b(!0),a},[f,i,n]),T=r((e,r,i=!0)=>{let a=x.current;if(!a.didFirePressStart)return!1;a.didFirePressStart=!1,a.isTriggeringEvent=!0;let o=!0;if(l){let t=new _n(`pressend`,r,e);l(t),o=t.shouldStopPropagation}if(n&&n(!1),b(!1),t&&i&&!f){let n=new _n(`press`,r,e);t(n),o&&=n.shouldStopPropagation}return a.isTriggeringEvent=!1,o},[f,l,n,t]),E=jt(T),D=jt(r((e,t)=>{let n=x.current;if(f)return!1;if(u){n.isTriggeringEvent=!0;let r=new _n(`pressup`,t,e);return u(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[f,u])),ee=r(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&T(q(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,C(),g||mn(t.target);for(let e of t.disposables)e();t.disposables=[]}},[g,C,T]),O=jt(ee),te=r(e=>{h&&ee(e)},[h,ee]),ne=r(e=>{f||d?.(e)},[f,d]),re=r((e,t)=>{if(!f&&d){let n=new MouseEvent(`click`,e);sn(n,t),d(on(n))}},[f,d]),ie=o(()=>{let e=x.current,t={onKeyDown(t){if(Cn(t.nativeEvent,t.currentTarget)&&V(t.currentTarget,U(t))){Tn(U(t),t.key)&&t.preventDefault();let r=!0;!e.isPressed&&!t.repeat&&(e.target=t.currentTarget,e.isPressed=!0,e.pointerType=`keyboard`,r=w(t,`keyboard`));let i=t.currentTarget;S(z(t.currentTarget),`keyup`,ut(t=>{Cn(t,i)&&!t.repeat&&V(i,U(t))&&e.target&&D(q(e.target,t),`keyboard`)},n),!0),r&&t.stopPropagation(),t.metaKey&&M()&&e.metaKeyEvents?.set(t.key,t.nativeEvent)}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!V(t.currentTarget,U(t)))&&t&&t.button===0&&!e.isTriggeringEvent&&!F.isOpening){let n=!0;if(f&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||Nt(t.nativeEvent))){let e=w(t,`virtual`),r=D(t,`virtual`),i=E(t,`virtual`);ne(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=D(q(t.currentTarget,t),r),a=E(q(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,ne(t),O(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{if(e.isPressed&&e.target&&Cn(t,e.target)){Tn(U(t),t.key)&&t.preventDefault();let n=U(t),r=V(e.target,n);E(q(e.target,t),`keyboard`,r),r&&re(t,e.target),C(),t.key!==`Enter`&&Sn(e.target)&&V(e.target,n)&&!t[vn]&&(t[vn]=!0,F(e.target,t,!1)),e.isPressed=!1,e.metaKeyEvents?.delete(t.key)}else if(t.key===`Meta`&&e.metaKeyEvents?.size){let t=e.metaKeyEvents;e.metaKeyEvents=void 0;for(let n of t.values())e.target?.dispatchEvent(new KeyboardEvent(`keyup`,n))}};if(typeof PointerEvent<`u`){t.onPointerDown=t=>{if(t.button!==0||!V(t.currentTarget,U(t)))return;if(Pt(t.nativeEvent)){e.pointerType=`virtual`;return}e.pointerType=t.pointerType;let i=!0;if(!e.isPressed){e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=t.pointerId,e.target=t.currentTarget,g||pn(e.target),i=w(t,e.pointerType);let a=U(t);`releasePointerCapture`in a&&(`hasPointerCapture`in a?a.hasPointerCapture(t.pointerId)&&a.releasePointerCapture(t.pointerId):a.releasePointerCapture(t.pointerId)),S(z(t.currentTarget),`pointerup`,n,!1),S(z(t.currentTarget),`pointercancel`,r,!1)}i&&t.stopPropagation()},t.onMouseDown=t=>{if(V(t.currentTarget,U(t))&&t.button===0){if(m){let n=un(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!V(t.currentTarget,U(t))||e.pointerType===`virtual`||t.button===0&&!e.isPressed&&D(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,w(q(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,E(q(e.target,t),e.pointerType,!1),te(t))};let n=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(V(e.target,U(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?O(t):(N(e.target),e.target.click()))},80);S(t.currentTarget,`click`,()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else O(t);e.isOverTarget=!1}},r=e=>{O(e)};t.onDragStart=e=>{V(e.currentTarget,U(e))&&O(e)}}return t},[S,f,m,C,g,te,w,ne,re]);return a(()=>{if(!_)return;let e=z(_.current);if(!e||!e.head||e.getElementById(yn))return;let t=e.createElement(`style`);t.id=yn;let n=qt(e);n&&(t.nonce=n),t.textContent=`
|
|
2
|
+
@layer {
|
|
3
|
+
[${bn}] {
|
|
4
|
+
touch-action: pan-x pan-y pinch-zoom;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
`.trim(),e.head.prepend(t)},[_]),a(()=>{let e=x.current;return()=>{g||mn(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[g]),{isPressed:p||y,pressProps:W(v,ie,{[bn]:!0})}}function Sn(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function Cn(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof B(i).HTMLInputElement&&!Dn(i,n)||i instanceof B(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&Sn(i))&&n!==`Enter`)}function q(e,t){let n=t.clientX,r=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:n,clientY:r,key:t.key}}function wn(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!Sn(e)}function Tn(e,t){return e instanceof HTMLInputElement?!Dn(e,t):wn(e)}const En=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Dn(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:En.has(e.type)}let J=null;const On=new Set;let Y=new Map,X=!1,kn=!1;const An={Tab:!0,Escape:!0};function jn(e,t){for(let n of On)n(e,t)}function Mn(e){return!(e.metaKey||!M()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Z(e){X=!0,!F.isOpening&&Mn(e)&&(J=`keyboard`,jn(`keyboard`,e))}function Q(e){J=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(X=!0,jn(`pointer`,e))}function Nn(e){!F.isOpening&&Nt(e)&&(X=!0,J=`virtual`)}function Pn(e){let t=B(U(e)),n=z(U(e));U(e)===t||U(e)===n||ln||!e.isTrusted||(!X&&!kn&&(J=`virtual`,jn(`virtual`,e)),X=!1,kn=!1)}function Fn(){ln||(X=!1,kn=!0)}function In(e){if(typeof window>`u`||typeof document>`u`)return;let t=B(e),n=z(e);if(Y.get(t))return;let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){X=!0,r.apply(this,arguments)},n.addEventListener(`keydown`,Z,!0),n.addEventListener(`keyup`,Z,!0),n.addEventListener(`click`,Nn,!0),t.addEventListener(`focus`,Pn,!0),t.addEventListener(`blur`,Fn,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,Q,!0),n.addEventListener(`pointermove`,Q,!0),n.addEventListener(`pointerup`,Q,!0)),t.addEventListener(`beforeunload`,()=>{Ln(e)},{once:!0}),Y.set(t,{focus:r})}const Ln=(e,t)=>{let n=B(e),r=z(e);t&&r.removeEventListener(`DOMContentLoaded`,t),Y.has(n)&&(n.HTMLElement.prototype.focus=Y.get(n).focus,r.removeEventListener(`keydown`,Z,!0),r.removeEventListener(`keyup`,Z,!0),r.removeEventListener(`click`,Nn,!0),n.removeEventListener(`focus`,Pn,!0),n.removeEventListener(`blur`,Fn,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,Q,!0),r.removeEventListener(`pointermove`,Q,!0),r.removeEventListener(`pointerup`,Q,!0)),Y.delete(n))};function Rn(e){let t=z(e),n;return t.readyState===`loading`?(n=()=>{In(e)},t.addEventListener(`DOMContentLoaded`,n)):In(e),()=>Ln(e,n)}typeof document<`u`&&Rn();function zn(){return J!==`pointer`}function Bn(){return J}function Vn(e){J=e,jn(e,null)}const Hn=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Un(e,t,n){let r=n?U(n):void 0,i=z(r),a=B(r),o=a===void 0?HTMLInputElement:a.HTMLInputElement,s=a===void 0?HTMLTextAreaElement:a.HTMLTextAreaElement,c=a===void 0?HTMLElement:a.HTMLElement,l=a===void 0?KeyboardEvent:a.KeyboardEvent,u=H(i);return e=e||u instanceof o&&!Hn.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!An[n.key])}function Wn(e,t,n){In(),a(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{Un(!!n?.isTextInput,t,r)&&e(zn())};return On.add(t),()=>{On.delete(t)}},t)}function Gn(e){if(!e.isConnected)return;let t=z(e);if(Bn()===`virtual`){let n=H(t);Dt(()=>{let r=H(t);(r===n||r===t.body)&&e.isConnected&&N(e)})}else N(e)}function Kn(e){let{isDisabled:t,onFocus:n,onBlur:i,onFocusChange:a}=e,o=r(e=>{if(U(e)===e.currentTarget)return i&&i(e),a&&a(!1),!0},[i,a]),s=cn(o),c=r(e=>{let t=U(e),r=z(t),i=r?H(r):H();t===e.currentTarget&&t===i&&(n&&n(e),a&&a(!0),s(e))},[a,n,s]);return{focusProps:{onFocus:!t&&(n||a||i)?c:void 0,onBlur:!t&&(i||a)?o:void 0}}}function qn(e){if(!e)return;let t=!0;return n=>{e({...n,preventDefault(){n.preventDefault()},isDefaultPrevented(){return n.isDefaultPrevented()},stopPropagation(){t=!0},continuePropagation(){t=!1},isPropagationStopped(){return t}}),t&&n.stopPropagation()}}function Jn(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:qn(e.onKeyDown),onKeyUp:qn(e.onKeyUp)}}}let Yn=e.createContext(null);function Xn(e){let t=i(Yn)||{};Mt(t,e);let{ref:n,...r}=t;return r}function Zn(e,t){let{focusProps:n}=Kn(e),{keyboardProps:r}=Jn(e),i=W(n,r),o=Xn(t),c=e.isDisabled?{}:o,l=s(e.autoFocus);a(()=>{l.current&&t.current&&Gn(t.current),l.current=!1},[t]);let u=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(u=void 0),{focusableProps:W({...i,tabIndex:u},c)}}function Qn(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:i,onFocusWithinChange:a}=e,o=s({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:l}=Ot(),u=r(e=>{V(e.currentTarget,U(e))&&o.current.isFocusWithin&&!V(e.currentTarget,e.relatedTarget)&&(o.current.isFocusWithin=!1,l(),n&&n(e),a&&a(!1))},[n,a,o,l]),d=cn(u),f=r(e=>{if(!V(e.currentTarget,U(e)))return;let t=U(e),n=z(t),r=H(n);if(!o.current.isFocusWithin&&r===t){i&&i(e),a&&a(!0),o.current.isFocusWithin=!0,d(e);let t=e.currentTarget;c(n,`focus`,e=>{let r=U(e);if(o.current.isFocusWithin&&!V(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});sn(e,t);let i=on(e);u(i)}},{capture:!0})}},[i,a,d,c,u]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:u}}}function $n(e={}){let{autoFocus:t=!1,isTextInput:n,within:i}=e,a=s({isFocused:!1,isFocusVisible:t||zn()}),[o,l]=c(!1),[u,d]=c(()=>a.current.isFocused&&a.current.isFocusVisible),f=r(()=>d(a.current.isFocused&&a.current.isFocusVisible),[]),p=r(e=>{a.current.isFocused=e,a.current.isFocusVisible=zn(),l(e),f()},[f]);Wn(e=>{a.current.isFocusVisible=e,f()},[n,o],{enabled:o,isTextInput:n});let{focusProps:m}=Kn({isDisabled:i,onFocusChange:p}),{focusWithinProps:h}=Qn({isDisabled:!i,onFocusWithinChange:p});return{isFocused:o,isFocusVisible:u,focusProps:i?h:m}}let er=!1,tr=0;function nr(){er=!0,setTimeout(()=>{er=!1},500)}function rr(e){e.pointerType===`touch`&&nr()}function ir(){let e=z(null);if(e!==void 0)return tr===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,rr),tr++,()=>{tr--,!(tr>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,rr)}}function ar(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[l,u]=c(!1),d=s({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:``,target:null}).current;a(ir,[]);let{addGlobalListener:f,removeAllGlobalListeners:p}=Ot(),{hoverProps:m,triggerHoverEnd:h}=o(()=>{let e=(e,r)=>{if(d.pointerType=r,i||r===`touch`||d.isHovered||!V(e.currentTarget,U(e)))return;d.isHovered=!0;let o=e.currentTarget;d.target=o,f(z(U(e)),`pointerover`,e=>{d.isHovered&&d.target&&!V(d.target,U(e))&&a(e,e.pointerType)},{capture:!0}),t&&t({type:`hoverstart`,target:o,pointerType:r}),n&&n(!0),u(!0)},a=(e,t)=>{let i=d.target;d.pointerType=``,d.target=null,!(t===`touch`||!d.isHovered||!i)&&(d.isHovered=!1,p(),r&&r({type:`hoverend`,target:i,pointerType:t}),n&&n(!1),u(!1))},o={};return typeof PointerEvent<`u`&&(o.onPointerEnter=t=>{er&&t.pointerType===`mouse`||e(t,t.pointerType)},o.onPointerLeave=e=>{!i&&V(e.currentTarget,U(e))&&a(e,e.pointerType)}),{hoverProps:o,triggerHoverEnd:a}},[t,n,r,i,d,f,p]);return a(()=>{i&&h({currentTarget:d.target},d.pointerType)},[i]),{hoverProps:m,isHovered:l}}typeof HTMLTemplateElement<`u`&&(Object.defineProperty(HTMLTemplateElement.prototype,"firstChild",{configurable:!0,enumerable:!0,get:function(){return this.content.firstChild}}),Object.defineProperty(HTMLTemplateElement.prototype,"appendChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.appendChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"removeChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.removeChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"insertBefore",{configurable:!0,enumerable:!0,value:function(e,t){return this.content.insertBefore(e,t)}}));const or=t(!1);function sr(e){let t=(t,n)=>i(or)?null:e(t,n);return t.displayName=e.displayName||e.name,n(t)}function cr(e,t){let{elementType:n=`button`,isDisabled:r,onPress:i,onPressStart:a,onPressEnd:o,onPressUp:s,onPressChange:c,preventFocusOnPress:l,allowFocusWhenDisabled:u,onClick:d,href:f,target:p,rel:m,type:h=`button`}=e,g;g=n===`button`?{type:h,disabled:r,form:e.form,formAction:e.formAction,formEncType:e.formEncType,formMethod:e.formMethod,formNoValidate:e.formNoValidate,formTarget:e.formTarget,name:e.name,value:e.value}:{role:`button`,href:n===`a`&&!r?f:void 0,target:n===`a`?p:void 0,type:n===`input`?h:void 0,disabled:n===`input`?r:void 0,"aria-disabled":!r||n===`input`?void 0:r,rel:n===`a`?m:void 0};let{pressProps:_,isPressed:v}=xn({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=Zn(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=W(y,_,Ct(e,{labelable:!0}));return{isPressed:v,buttonProps:W(g,b,{"aria-haspopup":e[`aria-haspopup`],"aria-expanded":e[`aria-expanded`],"aria-controls":e[`aria-controls`],"aria-pressed":e[`aria-pressed`],"aria-current":e[`aria-current`],"aria-disabled":e[`aria-disabled`]})}}const lr=t(null),ur=7e3;let $=null;function dr(e,t=`assertive`,n=ur){$?$.announce(e,t,n):($=new fr,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?$.announce(e,t,n):setTimeout(()=>{$?.isAttached()&&$?.announce(e,t,n)},100))}var fr=class{isAttached(){return this.node?.isConnected}createLog(e){let t=document.createElement(`div`);return t.setAttribute(`role`,`log`),t.setAttribute(`aria-live`,e),t.setAttribute(`aria-relevant`,`additions`),t}destroy(){this.node&&=(document.body.removeChild(this.node),null)}announce(e,t=`assertive`,n=ur){var r,i;if(!this.node)return;let a=document.createElement(`div`);typeof e==`object`?(a.setAttribute(`role`,`img`),a.setAttribute(`aria-labelledby`,e[`aria-labelledby`])):a.textContent=e,t===`assertive`?(r=this.assertiveLog)==null||r.appendChild(a):(i=this.politeLog)==null||i.appendChild(a),e!==``&&setTimeout(()=>{a.remove()},n)}clear(e){this.node&&((!e||e===`assertive`)&&this.assertiveLog&&(this.assertiveLog.innerHTML=``),(!e||e===`polite`)&&this.politeLog&&(this.politeLog.innerHTML=``))}constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,typeof document<`u`&&(this.node=document.createElement(`div`),this.node.dataset.liveAnnouncer=`true`,Object.assign(this.node.style,{border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`}),this.assertiveLog=this.createLog(`assertive`),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog(`polite`),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}};const pr=t({}),mr=sr(function(t,n){[t,n]=$t(t,n,pr);let r=t,{isPending:i}=r,{buttonProps:o,isPressed:c}=cr(t,n);o=gr(o,i);let{focusProps:l,isFocused:u,isFocusVisible:d}=$n(t),{hoverProps:f,isHovered:p}=ar({...t,isDisabled:t.isDisabled||i}),m={isHovered:p,isPressed:(r.isPressed||c)&&!i,isFocused:u,isFocusVisible:d,isDisabled:t.isDisabled||!1,isPending:i??!1},h=Xt({...t,values:m,defaultClassName:`react-aria-Button`}),g=st(o.id),_=st(),v=o[`aria-labelledby`];i&&(v?v=`${v} ${_}`:o[`aria-label`]&&(v=`${g} ${_}`));let y=s(i);a(()=>{let e={"aria-labelledby":v||g};(!y.current&&u&&i||y.current&&u&&!i)&&dr(e,`assertive`),y.current=i},[i,u,v,g]);let b=Ct(t,{global:!0});return delete b.onClick,e.createElement(an.button,{...W(b,h,o,l,f),type:o.type===`submit`&&i?`button`:o.type,id:g,ref:n,"aria-labelledby":v,slot:t.slot||void 0,"aria-disabled":i?`true`:o[`aria-disabled`],"data-disabled":t.isDisabled||void 0,"data-pressed":m.isPressed||void 0,"data-hovered":p||void 0,"data-focused":u||void 0,"data-pending":i||void 0,"data-focus-visible":d||void 0},e.createElement(lr.Provider,{value:{id:_}},h.children))}),hr=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function gr(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!hr.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}export{oe as $,V as A,it as B,Ht as C,Ct as D,kt as E,z as F,Me as G,Ve as H,B as I,xe as J,Te as K,ut as L,H as M,U as N,W as O,pt as P,Se as Q,lt as R,qt as S,jt as T,He as U,I as V,ze as W,_e as X,ve as Y,be as Z,Zt as _,$n as a,tn as b,Gn as c,xn as d,se as et,hn as f,en as g,Xt as h,ar as i,mt as j,ht as k,Bn as l,$t as m,mr as n,p as nt,Qn as o,Yt as p,he as q,sr as r,Zn as s,pr as t,C as tt,Vn as u,Jt as v,Ut as w,Qt as x,an as y,st as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as PublicGetSurveyOutput, i as ConfettiState, s as Finishable, t as Answer, u as Question$1 } from "./types-
|
|
1
|
+
import { f as PublicGetSurveyOutput, i as ConfettiState, s as Finishable, t as Answer, u as Question$1 } from "./types-NMQZur7D.js";
|
|
2
2
|
import { PropsWithChildren } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/core/ConfettiController.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{G as e,n as t}from"./Button-uM2fAs2N.js";import{useEffect as n,useState as r}from"react";import{useLocalStorage as i}from"usehooks-ts";import{jsx as a,jsxs as o}from"react/jsx-runtime";import s from"clsx";function c(e,t){return t===void 0?!0:typeof t==`boolean`?t:t(e)}function l({surveyId:e,override:t}){let[r,a]=i(`cfti:${e}:respondent`,``);return n(()=>{r||a(crypto.randomUUID())},[r,a]),t||r}const u={lastRespondedAt:null,lastDismissedAt:null};async function d({client:t,surveyId:n,respondent:r,signal:i}){try{let a=await t.get(`api/v1/cfti/${n}/respondent/${r}`,{signal:i}).json(),o=e.safeParse(a);return o.success?{lastRespondedAt:o.data.lastRespondedAt?new Date(o.data.lastRespondedAt):null,lastDismissedAt:o.data.lastDismissedAt?new Date(o.data.lastDismissedAt):null}:(console.warn(`[confetti] Respondent response failed schema validation`,o.error),u)}catch{return u}}function f({client:e,surveyId:t,respondent:i}){let[a,o]=r(u),[s,c]=r(!1),[l,f]=r({client:e,surveyId:t,respondent:i});return(l.client!==e||l.surveyId!==t||l.respondent!==i)&&(f({client:e,surveyId:t,respondent:i}),o(u),c(!1)),n(()=>{if(!i||typeof window>`u`||typeof document>`u`)return;let n=null,r=()=>{n?.abort(),n=new AbortController;let r=n;d({client:e,surveyId:t,respondent:i,signal:r.signal}).then(e=>{r.signal.aborted||(o(e),c(!0))})};r();let a=()=>{document.visibilityState===`visible`&&r()};return document.addEventListener(`visibilitychange`,a),()=>{n?.abort(),document.removeEventListener(`visibilitychange`,a)}},[e,t,i]),{state:a,isSettled:s}}function p({client:e,surveyId:t}){let[i,a]=r(!1),[o,s]=r(!1),[c,l]=r({client:e,surveyId:t});return(c.client!==e||c.surveyId!==t)&&(l({client:e,surveyId:t}),a(!1),s(!1)),n(()=>{if(typeof window>`u`)return;let n=new AbortController;return e.head(`api/v1/cfti/${t}`,{signal:n.signal}).then(()=>{n.signal.aborted||a(!0)}).catch(()=>{n.signal.aborted||a(!1)}).finally(()=>{n.signal.aborted||s(!0)}),()=>{n.abort()}},[e,t]),{isAvailable:i,isSettled:o}}const m=e=>a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 44 38`,...e,children:o(`g`,{transform:`translate(-2 -2) scale(1.1)`,children:[a(`path`,{d:`M16.8395 3.2139C8.2208 3.9522 1.8331 11.5311 2.5721 20.1416C3.3111 28.7523 10.897 35.134 19.5157 34.3956L27.1631 33.7406C28.9787 33.585 30.6949 33.1248 32.2669 32.4163L38.7663 35.4396C39.3254 35.6994 39.9048 35.1205 39.6447 34.562L37.0707 29.0396C40.1147 25.8995 41.8336 21.5102 41.4304 16.8128C40.6913 8.2022 33.1054 1.8205 24.4867 2.5588L16.8395 3.2139Z`,fill:`#BAE6FD`}),a(`path`,{d:`M19.6764 24.0307C19.6764 24.0307 20.9773 25.4496 23.5438 25.1228C26.1103 24.7959 27.3642 23.0095 27.3642 23.0095`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M18.0861 16.4082C18.0861 16.4082 17.1255 18.619 14.8183 18.9139C12.5111 19.2088 11.1697 17.237 11.1697 17.237`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M32.6296 15.0398C32.6296 15.0398 31.6691 17.2506 29.3619 17.5455C27.0548 17.8404 25.7132 15.8686 25.7132 15.8686`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`})]})}),h=({onClick:e,isWidgetOpen:n,classNames:r,label:i=`Help us improve`})=>n?null:o(t,{onPress:e,className:s(`confetti-trigger`,r?.trigger),children:[a(`span`,{className:s(`confetti-trigger-icon-wrapper`,r?.iconWrapper),"aria-hidden":!0,children:a(m,{className:s(`confetti-trigger-icon`,r?.icon),width:24})}),a(`span`,{className:s(`confetti-trigger-label`,r?.label),children:i})]});export{l as a,f as i,m as n,c as o,p as r,h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,o as n,r}from"./DefaultConfettiTrigger-CxIyRNHv.js";import{$ as i,D as a,E as o,I as s,J as c,N as l,O as u,Q as d,R as f,T as p,V as m,X as h,Y as g,Z as _,_ as v,a as y,b,d as x,g as S,h as C,i as w,k as T,m as E,n as D,nt as O,o as k,p as A,q as j,r as ee,s as te,tt as ne,u as re,x as ie,y as M,z as ae}from"./Button-uM2fAs2N.js";import{d as oe,f as se,h as ce,i as le,l as ue,m as de,p as fe,r as pe,s as me,u as he}from"./ModalContainer-jzFfmvRQ.js";import{a as ge,n as _e,o as ve,r as ye,t as be}from"./internals-Cc32ucML.js";import N,{Suspense as xe,createContext as P,forwardRef as F,lazy as Se,useCallback as I,useContext as L,useEffect as R,useMemo as z,useRef as B,useState as V}from"react";import{useTimeout as Ce}from"usehooks-ts";import{Fragment as H,jsx as U,jsxs as W}from"react/jsx-runtime";import G from"clsx";import"react-dom";function we(e,t,n){let r=p(e=>{n&&!e.defaultPrevented&&n(t)});R(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function Te(e){let{id:t,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:a=`label`}=e;t=ae(t);let o=ae(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=fe({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function Ee(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=Te(e),s=f([!!t,!!n,r,i]),c=f([!!t,!!n,r,i]);return o=u(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}function De(e,t,n){let{validationBehavior:r,focus:i}=e;m(()=>{if(r===`native`&&n?.current&&!n.current.disabled){let e=t.realtimeValidation.isInvalid?t.realtimeValidation.validationErrors.join(` `)||`Invalid value.`:``;n.current.setCustomValidity(e),n.current.hasAttribute(`title`)||(n.current.title=``),t.realtimeValidation.isInvalid||t.updateValidation(ke(n.current))}});let a=B(!1),o=p(()=>{a.current||t.resetValidation()}),s=p(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&Ae(r)===n.current&&(i?i():n.current?.focus(),re(`keyboard`)),e.preventDefault()}),c=p(()=>{t.commitValidation()});R(()=>{let e=n?.current;if(!e)return;let t=e.form,r=t?.reset;return t&&(t.reset=()=>{a.current=!window.event||window.event.type===`message`&&l(window.event)instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,s),e.addEventListener(`change`,c),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,s),e.removeEventListener(`change`,c),t?.removeEventListener(`reset`,o),t&&(t.reset=r)}},[n,r])}function Oe(e){let t=e.validity;return{badInput:t.badInput,customError:t.customError,patternMismatch:t.patternMismatch,rangeOverflow:t.rangeOverflow,rangeUnderflow:t.rangeUnderflow,stepMismatch:t.stepMismatch,tooLong:t.tooLong,tooShort:t.tooShort,typeMismatch:t.typeMismatch,valueMissing:t.valueMissing,valid:t.valid}}function ke(e){return{isInvalid:!e.validity.valid,validationDetails:Oe(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function Ae(e){for(let t=0;t<e.elements.length;t++){let n=e.elements[t];if(n.validity?.valid===!1)return n}return null}const je={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},Me={...je,customError:!0,valid:!1},K={isInvalid:!1,validationDetails:je,validationErrors:[]},Ne=P({}),Pe=`__reactAriaFormValidationState`;function q(e){if(e.__reactAriaFormValidationState){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[Pe];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return Fe(e)}function Fe(e){let{isInvalid:t,validationState:n,name:r,value:i,builtinValidation:a,validate:o,validationBehavior:s=`aria`}=e;n&&(t||=n===`invalid`);let c=t===void 0?null:{isInvalid:t,validationErrors:[],validationDetails:Me},l=z(()=>!o||i==null?null:Re(Le(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=L(Ne),d=z(()=>r?Array.isArray(r)?r.flatMap(e=>Ie(u[e])):Ie(u[r]):[],[u,r]),[f,p]=V(u),[m,h]=V(!1);u!==f&&(p(u),h(!1));let g=z(()=>Re(m?[]:d),[m,d]),_=B(K),[v,y]=V(K),b=B(K),x=()=>{if(!S)return;C(!1);let e=l||a||_.current;ze(e,b.current)||(b.current=e,y(e))},[S,C]=V(!1);return R(x),{realtimeValidation:c||g||l||a||K,displayValidation:s===`native`?c||g||v:c||g||l||a||v,updateValidation(e){s===`aria`&&!ze(v,e)?y(e):_.current=e},resetValidation(){let e=K;ze(e,b.current)||(b.current=e,y(e)),s===`native`&&C(!1),h(!0)},commitValidation(){s===`native`&&C(!0),h(!0)}}}function Ie(e){return e?Array.isArray(e)?e:[e]:[]}function Le(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return Ie(n)}return[]}function Re(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:Me}:null}function ze(e,t){return e===t||!!e&&!!t&&e.isInvalid===t.isInvalid&&e.validationErrors.length===t.validationErrors.length&&e.validationErrors.every((e,n)=>e===t.validationErrors[n])&&Object.entries(e.validationDetails).every(([e,n])=>t.validationDetails[e]===n)}function Be(...e){let t=new Set,n=!1,r={...je};for(let i of e){for(let e of i.validationErrors)t.add(e);n||=i.isInvalid;for(let e in r)r[e]||=i.validationDetails[e]}return r.valid=!n,{isInvalid:n,validationErrors:[...t],validationDetails:r}}function Ve(e,t){let{inputElementType:n=`input`,isDisabled:r=!1,isRequired:i=!1,isReadOnly:o=!1,type:s=`text`,validationBehavior:c=`aria`}=e,[d,f]=he(e.value,e.defaultValue||``,e.onChange),{focusableProps:p}=te(e,t),m=q({...e,value:d}),{isInvalid:h,validationErrors:g,validationDetails:_}=m.displayValidation,{labelProps:v,fieldProps:y,descriptionProps:b,errorMessageProps:x}=Ee({...e,isInvalid:h,errorMessage:e.errorMessage||g}),S=a(e,{labelable:!0}),C={type:s,pattern:e.pattern},[w]=V(d);return we(t,e.defaultValue??w,f),De(e,m,t),{labelProps:v,inputProps:u(S,n===`input`?C:void 0,{disabled:r,readOnly:o,required:i&&c===`native`,"aria-required":i&&c===`aria`||void 0,"aria-invalid":h||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:d,onChange:e=>f(l(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(N.version,10)>=17?`enterKeyHint`:`enterkeyhint`]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...p,...y}),descriptionProps:b,errorMessageProps:x,isInvalid:h,validationErrors:g,validationDetails:_}}function He(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:o,name:s,form:c,children:d,"aria-label":f,"aria-labelledby":p,validationState:m=`valid`,isInvalid:h,onPressStart:g,onPressEnd:_,onPressChange:v,onPress:y,onPressUp:b,onClick:S}=e,C=e=>{e.stopPropagation(),t.setSelected(l(e).checked)},{pressProps:w,isPressed:T}=x({onPressStart:g,onPressEnd:_,onPressChange:v,onPress:y,onPressUp:b,onClick:S,isDisabled:r}),{pressProps:E,isPressed:D}=x({onPressStart:g,onPressEnd:_,onPressChange:v,onPressUp:b,onClick:S,onPress(e){y?.(e),t.toggle(),n.current?.focus()},isDisabled:r||i}),{focusableProps:O}=te(e,n),k=u(w,O),A=a(e,{labelable:!0});return we(n,t.defaultSelected,t.setSelected),{labelProps:u(E,{onClick:e=>e.preventDefault()}),inputProps:u(A,{"aria-invalid":h||m===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,onChange:C,disabled:r,...o==null?{}:{value:o},name:s,form:c,type:`checkbox`,...k}),isSelected:t.isSelected,isPressed:T||D,isDisabled:r,isReadOnly:i,isInvalid:h||m===`invalid`}}function Ue(e,t,n){let r=q({...e,value:t.isSelected}),{isInvalid:i,validationErrors:a,validationDetails:o}=r.displayValidation,{labelProps:s,inputProps:c,isSelected:l,isPressed:d,isDisabled:f,isReadOnly:p}=He({...e,isInvalid:i},t,n);De(e,r,n);let{isIndeterminate:m,isRequired:h,validationBehavior:g=`aria`}=e;R(()=>{n.current&&(n.current.indeterminate=!!m)});let{pressProps:_}=x({isDisabled:f||p,onPress(){let{[Pe]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:u(s,_,z(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...c,checked:l,"aria-required":h&&g===`aria`||void 0,required:h&&g===`native`},isSelected:l,isPressed:d,isDisabled:f,isReadOnly:p,isInvalid:i,validationErrors:a,validationDetails:o}}const We=new WeakMap;function Ge(e,t){let{isDisabled:n,name:r,form:i,validationBehavior:o=`aria`}=e,{isInvalid:s,validationErrors:c,validationDetails:l}=t.displayValidation,{labelProps:d,fieldProps:f,descriptionProps:p,errorMessageProps:m}=Ee({...e,labelElementType:`span`,isInvalid:s,errorMessage:e.errorMessage||c});We.set(t,{name:r,form:i,descriptionId:p.id,errorMessageId:m.id,validationBehavior:o});let h=a(e,{labelable:!0}),{focusWithinProps:g}=k({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:u(h,{role:`group`,"aria-disabled":n||void 0,...f,...g}),labelProps:d,descriptionProps:p,errorMessageProps:m,isInvalid:s,validationErrors:c,validationDetails:l}}function Ke(e={}){let{isReadOnly:t}=e,[n,r]=he(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=V(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function qe(e,t,n){let r=Ke({isReadOnly:e.isReadOnly||t.isReadOnly,isSelected:t.isSelected(e.value),defaultSelected:t.defaultValue.includes(e.value),onChange(n){n?t.addValue(e.value):t.removeValue(e.value),e.onChange&&e.onChange(n)}}),{name:i,form:a,descriptionId:o,errorMessageId:s,validationBehavior:c}=We.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=q({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=B(K),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};R(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=Ue({...e,isReadOnly:e.isReadOnly||t.isReadOnly,isDisabled:e.isDisabled||t.isDisabled,name:e.name||i,form:e.form||a,isRequired:e.isRequired??t.isRequired,validationBehavior:c,[Pe]:{realtimeValidation:f,displayValidation:p,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){u.current=e,d()}}},r,n);return{...m,inputProps:{...m.inputProps,"aria-describedby":[e[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}const Je=new WeakMap;function Ye(e,t,n){let{value:r,children:i,"aria-label":o,"aria-labelledby":s,onPressStart:c,onPressEnd:l,onPressChange:d,onPress:f,onPressUp:p,onClick:m}=e,h=e.isDisabled||t.isDisabled,g=t.selectedValue===r,_=e=>{e.stopPropagation(),t.setSelectedValue(r)},{pressProps:v,isPressed:y}=x({onPressStart:c,onPressEnd:l,onPressChange:d,onPress:f,onPressUp:p,onClick:m,isDisabled:h}),{pressProps:b,isPressed:S}=x({onPressStart:c,onPressEnd:l,onPressChange:d,onPressUp:p,onClick:m,isDisabled:h,onPress(e){f?.(e),t.setSelectedValue(r),n.current?.focus()}}),{focusableProps:C}=te(u(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),w=u(v,C),T=a(e,{labelable:!0}),E=-1;t.selectedValue==null?(t.lastFocusedValue===r||t.lastFocusedValue==null)&&(E=0):t.selectedValue===r&&(E=0),h&&(E=void 0);let{name:D,form:O,descriptionId:k,errorMessageId:A,validationBehavior:j}=Je.get(t);return we(n,t.defaultSelectedValue,t.setSelectedValue),De({validationBehavior:j},t,n),{labelProps:u(b,z(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:u(T,{...w,type:`radio`,name:D,form:O,tabIndex:E,disabled:h,required:t.isRequired&&j===`native`,checked:g,value:r,onChange:_,"aria-describedby":[e[`aria-describedby`],t.isInvalid?A:null,k].filter(Boolean).join(` `)||void 0}),isDisabled:h,isSelected:g,isPressed:y||S}}function Xe(e,t){let{name:n,form:r,isReadOnly:i,isRequired:o,isDisabled:c,orientation:d=`vertical`,validationBehavior:f=`aria`}=e,{direction:p}=se(),{isInvalid:m,validationErrors:h,validationDetails:g}=t.displayValidation,{labelProps:_,fieldProps:v,descriptionProps:y,errorMessageProps:b}=Ee({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||h}),x=a(e,{labelable:!0}),{focusWithinProps:S}=k({onBlurWithin(n){e.onBlur?.(n),t.selectedValue||t.setLastFocusedValue(null)},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange}),C=e=>{let n;switch(e.key){case`ArrowRight`:n=p===`rtl`&&d!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=p===`rtl`&&d!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=oe(e.currentTarget,{from:l(e),accept:e=>e instanceof s(e).HTMLInputElement&&e.type===`radio`}),i;n===`next`?(i=r.nextNode(),i||=(r.currentNode=e.currentTarget,r.firstChild())):(i=r.previousNode(),i||=(r.currentNode=e.currentTarget,r.lastChild())),i&&(i.focus(),t.setSelectedValue(i.value))},w=ae(n);return Je.set(t,{name:w,form:r,descriptionId:y.id,errorMessageId:b.id,validationBehavior:f}),{radioGroupProps:u(x,{role:`radiogroup`,onKeyDown:C,"aria-invalid":t.isInvalid||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-readonly":i||void 0,"aria-required":o||void 0,"aria-disabled":c||void 0,"aria-orientation":d,...v,...S}),labelProps:_,descriptionProps:y,errorMessageProps:b,isInvalid:m,validationErrors:h,validationDetails:g}}const Ze=P({}),J=ee(function(e,t){[e,t]=E(e,t,Ze);let{elementType:n=`label`,...r}=e,i=M[n];return N.createElement(i,{className:`react-aria-Label`,...r,ref:t})}),Qe=P({}),Y=F(function(e,t){[e,t]=E(e,t,Qe);let{elementType:n=`span`,...r}=e,i=M[n];return N.createElement(i,{className:`react-aria-Text`,...r,ref:t})});function $e(e={}){let[t,n]=he(e.value,e.defaultValue||[],e.onChange),[r]=V(t),i=!!e.isRequired&&t.length===0,a=B(new Map),o=q({...e,value:t}),s=o.displayValidation.isInvalid;return{...o,value:t,defaultValue:e.defaultValue??r,setValue(t){e.isReadOnly||e.isDisabled||n(t)},isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isSelected(e){return t.includes(e)},addValue(t){e.isReadOnly||e.isDisabled||n(e=>e.includes(t)?e:e.concat(t))},removeValue(r){e.isReadOnly||e.isDisabled||t.includes(r)&&n(t.filter(e=>e!==r))},toggleValue(r){e.isReadOnly||e.isDisabled||(t.includes(r)?n(t.filter(e=>e!==r)):n(t.concat(r)))},setInvalid(e,t){let n=new Map(a.current);t.isInvalid?n.set(e,t):n.delete(e),a.current=n,o.updateValidation(Be(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}let et=Math.round(Math.random()*1e10),tt=0;function nt(e){let t=z(()=>e.name||`radio-group-${et}-${++tt}`,[e.name]),[n,r]=he(e.value,e.defaultValue??null,e.onChange),[i]=V(n),[a,o]=V(null),s=q({...e,value:n}),c=t=>{!e.isReadOnly&&!e.isDisabled&&(r(t),s.commitValidation())},l=s.displayValidation.isInvalid;return{...s,name:t,selectedValue:n,defaultSelectedValue:e.value===void 0?e.defaultValue??null:i,setSelectedValue:c,lastFocusedValue:a,setLastFocusedValue:o,isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1,validationState:e.validationState||(l?`invalid`:null),isInvalid:l}}const X=P(null),Z=F(function(e,t){return L(X)?.isInvalid?N.createElement(rt,{...e,ref:t}):null}),rt=F((e,t)=>{let n=L(X),r=a(e,{global:!0}),i=C({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return i.children==null?null:N.createElement(Y,{slot:`errorMessage`,...r,...i,ref:t})}),it=P(null),at=P(null),ot=P(null),st=F(function(e,t){[e,t]=E(e,t,at);let{validationBehavior:n}=ie(it)||{},r=e.validationBehavior??n??`native`,i=$e({...e,validationBehavior:r}),[o,s]=S(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:l,descriptionProps:d,errorMessageProps:f,...p}=Ge({...e,label:s,validationBehavior:r},i),m=C({...e,values:{isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:e.isRequired||!1,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-CheckboxGroup`}),h=a(e,{global:!0});return N.createElement(M.div,{...u(h,m,c),ref:t,slot:e.slot||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":i.isInvalid||void 0,"data-disabled":e.isDisabled||void 0},N.createElement(A,{values:[[ot,i],[Ze,{...l,ref:o,elementType:`span`}],[Qe,{slots:{description:d,errorMessage:f}}],[X,p]]},m.children))}),ct=F(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=E(r,t,ce);let{validationBehavior:i}=ie(it)||{},s=e.validationBehavior??i??`native`,c=L(ot),l=o(z(()=>T(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:d,inputProps:f,isSelected:p,isDisabled:m,isReadOnly:h,isPressed:g,isInvalid:_}=c?qe({...b(e),value:e.value,children:typeof e.children==`function`||e.children},c,l):Ue({...b(e),children:typeof e.children==`function`||e.children,validationBehavior:s},Ke(e),l),{isFocused:v,isFocusVisible:x,focusProps:S}=y(),D=m||h,{hoverProps:O,isHovered:k}=w({...e,isDisabled:D}),A=C({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:p,isIndeterminate:e.isIndeterminate||!1,isPressed:g,isHovered:k,isFocused:v,isFocusVisible:x,isDisabled:m,isReadOnly:h,isInvalid:_,isRequired:e.isRequired||!1}}),j=a(e,{global:!0});return delete j.id,delete j.onClick,N.createElement(M.label,{...u(j,d,O,A),ref:t,slot:e.slot||void 0,"data-selected":p||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":g||void 0,"data-hovered":k||void 0,"data-focused":v||void 0,"data-focus-visible":x||void 0,"data-disabled":m||void 0,"data-readonly":h||void 0,"data-invalid":_||void 0,"data-required":e.isRequired||void 0},N.createElement(ue,{elementType:`span`},N.createElement(`input`,{...u(f,S),ref:l})),A.children)}),lt=P({}),ut=P({});let dt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const ft=ee(function(e,t){[e,t]=E(e,t,ut);let{hoverProps:n,isHovered:r}=w({...e,isDisabled:e.disabled}),{isFocused:i,isFocusVisible:a,focusProps:o}=y({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=C({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-Input`});return N.createElement(M.input,{...u(dt(e),o,n),...c,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":s||void 0})}),pt=P(null);function mt(e){let t=B({});return N.createElement(pt.Provider,{value:t},e.children)}const ht=P({isSelected:!1}),gt=P(null),_t=P(null),vt=P(null),yt=F(function(e,t){[e,t]=E(e,t,gt);let{validationBehavior:n}=ie(it)||{},r=e.validationBehavior??n??`native`,i=nt({...e,validationBehavior:r}),[o,s]=S(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:c,labelProps:l,descriptionProps:d,errorMessageProps:f,...p}=Xe({...e,label:s,validationBehavior:r},i),m=C({...e,values:{orientation:e.orientation||`vertical`,isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:i.isRequired,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-RadioGroup`}),h=a(e,{global:!0});return N.createElement(M.div,{...u(h,m,c),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`vertical`,"data-invalid":i.isInvalid||void 0,"data-disabled":i.isDisabled||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":i.isRequired||void 0},N.createElement(A,{values:[[vt,i],[Ze,{...l,ref:o,elementType:`span`}],[Qe,{slots:{description:d,errorMessage:f}}],[X,p]]},N.createElement(mt,null,m.children)))}),bt=F(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=E(r,t,_t);let i=N.useContext(vt),s=o(z(()=>T(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:c,inputProps:l,isSelected:d,isDisabled:f,isPressed:p}=Ye({...b(e),children:typeof e.children==`function`||e.children},i,s),{isFocused:m,isFocusVisible:h,focusProps:g}=y(),_=f||i.isReadOnly,{hoverProps:v,isHovered:x}=w({...e,isDisabled:_}),S=C({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:d,isPressed:p,isHovered:x,isFocused:m,isFocusVisible:h,isDisabled:f,isReadOnly:i.isReadOnly,isInvalid:i.isInvalid,isRequired:i.isRequired}}),D=a(e,{global:!0});return delete D.id,delete D.onClick,N.createElement(M.label,{...u(D,c,v,S),ref:t,"data-selected":d||void 0,"data-pressed":p||void 0,"data-hovered":x||void 0,"data-focused":m||void 0,"data-focus-visible":h||void 0,"data-disabled":f||void 0,"data-readonly":i.isReadOnly||void 0,"data-invalid":i.isInvalid||void 0,"data-required":i.isRequired||void 0},N.createElement(ue,{elementType:`span`},N.createElement(`input`,{...u(l,g),ref:s})),N.createElement(ht.Provider,{value:{isSelected:d}},S.children))}),xt=P({});let St=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Ct=F(function(e,t){[e,t]=E(e,t,xt);let{hoverProps:n,isHovered:r}=w(e),{isFocused:i,isFocusVisible:a,focusProps:o}=y({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=C({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-TextArea`});return N.createElement(M.textarea,{...u(St(e),o,n),...c,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":s||void 0})}),wt=P(null),Tt=ee(function(e,t){[e,t]=E(e,t,wt);let{validationBehavior:n}=ie(it)||{},r=e.validationBehavior??n??`native`,i=B(null);[e,i]=E(e,i,de);let[o,s]=S(!e[`aria-label`]&&!e[`aria-labelledby`]),[c,l]=V(`input`),{labelProps:u,inputProps:d,descriptionProps:f,errorMessageProps:p,...m}=Ve({...b(e),inputElementType:c,label:s,validationBehavior:r},i),h=I(e=>{i.current=e,e&&l(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[i]),g=C({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:m.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),_=a(e,{global:!0});return delete _.id,N.createElement(M.div,{..._,...g,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":m.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},N.createElement(A,{values:[[Ze,{...u,ref:o}],[ut,{...d,ref:h}],[xt,{...d,ref:h}],[lt,{role:`presentation`,isInvalid:m.isInvalid,isDisabled:e.isDisabled||!1}],[Qe,{slots:{description:f,errorMessage:p}}],[X,m]]},g.children))});function Et(e){return e.issues[0]?.message??`Invalid input`}const Q={rating:({scale:e},t)=>h({scale:e},t),"open-ended":({max:e},t)=>g({maxLength:e},t),"single-select":({editable:e},t)=>_({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>c({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>d(),"bug-report":(e,t)=>j({},t)},Dt=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=Q[n];return r(e,t)}case`open-ended`:{let r=Q[n];return r(e,t)}case`single-select`:{let r=Q[n];return r(e,t)}case`multi-select`:{let r=Q[n];return r(e,t)}case`statement`:{let r=Q[n];return r(e,t)}case`bug-report`:{let r=Q[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},Ot=({originalQuestions:e,answers:t,errors:n,pointer:r=-1})=>{if(!e)return{questions:[],currentIndex:-1};let i=e.sort((e,t)=>e.position-t.position).map(e=>{let t={...e},r=n[e.id];return r&&(t.error=r),{...t,visible:!1}});for(let e=0;e<i.length;e++){let n=i[e];if(!n)continue;let a=ve({index:e,questions:i,answers:t});n.visible=r===e||a}let a=i.findIndex((e,n)=>n>r&&e.visible&&t[e.id]===void 0);return a===-1&&(a=i.findLastIndex(e=>!!e.visible)),{questions:i,currentIndex:a}},kt=({questions:e,answers:t})=>{let n=At({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},At=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),jt=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Mt={},Nt=({questions:e,answers:t,errors:n})=>{let r={};for(let i of e){if(!i.visible||!i.required||t[i.id]!==void 0||n[i.id])continue;let e=Dt(i.properties,{required:i.required}).safeParse(void 0);e.success||(r[i.id]=Et(e.error))}return r},Pt=e=>{let t=e.querySelector(`[data-invalid]`);if(!t)return;let n=t.getAttribute(`role`);if(n===`radiogroup`||n===`group`){t.tabIndex=-1,t.focus();return}t.querySelector(`textarea, input`)?.focus()},Ft=({current:e,shouldAutoSubmit:t,onSubmitted:n,onFinished:r,children:i})=>{let{survey:a,submit:o}=me(),[s,c]=V({}),[l,u]=V({}),d=z(()=>Ot({originalQuestions:a?.questions,answers:s,errors:l,pointer:e}),[a?.questions,s,l,e]),[f,p]=V(0),m=f>0,h=B(null),[g,_]=V(!1);R(()=>{f===0||!h.current||Pt(h.current)},[f]);let v=I(({answers:e})=>{o({answers:e}).finally(()=>{r?.()})},[r,o]),y=I(()=>{let e=jt({questions:d.questions,errors:l}),t=Nt({questions:d.questions,answers:s,errors:e}),r=Object.keys(t).length>0;if(Object.keys(e).length>0||r)return r&&u(e=>({...e,...t})),p(e=>e+1),!1;let i=kt({questions:d.questions,answers:s});return v({answers:i}),_(!0),n?.(),!0},[s,l,d.questions,v,n]),b=I(({question:r,answer:i})=>{let o=d.questions.at(r);if(!o)return{error:`Question index is invalid`};let f=Dt(o.properties,{required:o.required}).safeParse(i);if(!f.success){let e=Et(f.error);return u(t=>{if(t[o.id]===e)return t;let n={...t};return n[o.id]=e,n}),c(e=>{if(!(o.id in e))return e;let t={...e};return delete t[o.id],t}),{error:e}}let p={...l};delete p[o.id],u(e=>{if(!e[o.id])return e;let t={...e};return delete t[o.id],t});let m=!o.required&&!i?null:i,h={...s};if(h[o.id]===m)return{next:Ot({originalQuestions:a?.questions,answers:h,errors:l,pointer:e}).currentIndex};h[o.id]=m;let g=Ot({originalQuestions:a?.questions,answers:h,errors:l,pointer:e});h=At({questions:g.questions,answers:h}),c(h);let y=jt({questions:g.questions,errors:p});if(u(y),g.questions.filter(({visible:e})=>!!e).every(({id:e})=>h[e]!==void 0)&&t){let e=kt({questions:g.questions,answers:h});v({answers:e}),_(!0),n?.()}return{next:g.currentIndex}},[d.questions,s,a?.questions,l,t,e,v,n]);return d.questions.length===0?U(H,{}):U(`div`,{ref:h,className:`confetti ${be}`,"data-show-errors":m||void 0,children:i({questions:d.questions,current:e??d.currentIndex,update:b,submit:y,isSubmitted:g,errors:m?l:Mt})})},$=P(null);function It({children:i,surveyId:a,publishableKey:o,apiBaseUrl:s,respondent:c,isSurveyVisible:l}){let u=e({surveyId:a,override:c}),d=O({publishableKey:o,apiBaseUrl:s}),{isAvailable:f,isSettled:p}=r({client:d,surveyId:a}),{state:m,isSettled:h}=t({client:d,surveyId:a,respondent:u}),g=z(()=>({respondent:u}),[u]);return!u||!p||!h||!f||!n(m,l)?null:U($.Provider,{value:g,children:i})}function Lt(e){return L($)?U(H,{children:e.children}):U(It,{...e})}function Rt(){let e=L($);if(!e)throw Error(`useRespondentVisibility must be used within a RespondentVisibilityProvider`);return e}const zt=({children:e,classNames:t,containerProps:n,onDismiss:r,onClose:i,closeOnFinishMs:a=3e3})=>{let{surveyId:o,survey:s,dismiss:c}=me(),[l,u]=V(!1),[d,f]=V(!1),[p,m]=V(!1),[h,g]=V(!1);return Ce(()=>{s&&i?.()},d&&!(p||h)?a:null),W(`div`,{className:G(`confetti-dialog ${be}`,t?.dialog),id:`${o}-popover`,...n,onMouseEnter:e=>{n?.onMouseEnter?.(e),m(!0)},onMouseLeave:e=>{n?.onMouseLeave?.(e),m(!1)},onFocusCapture:e=>{n?.onFocusCapture?.(e),g(!0)},onBlurCapture:e=>{n?.onBlurCapture?.(e),e.currentTarget.contains(e.relatedTarget)||g(!1)},children:[U(pe,{className:G(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{l||(await c(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>u(!0),setIsFinished:()=>f(!0)}):e]})},Bt=3e4,Vt=({maskAllInputs:e}={})=>{let[t,n]=V(null),[r,i]=V(!1),[a,o]=V(null),[s,c]=V(30),l=B(null),u=B(null),d=B(null),f=B([]);R(()=>{let e=new CustomEvent(ye,{detail:{isRecording:r}});document.dispatchEvent(e)},[r]);let p=I(()=>{u.current&&=(clearInterval(u.current),null),d.current&&=(clearTimeout(d.current),null),l.current=null,c(Bt/1e3)},[]),m=I(()=>{l.current?.(),p(),i(!1),n(JSON.stringify(f.current))},[p]);return{recordingEventsJson:t,isRecording:r,recordingError:a,remainingSeconds:s,startRecording:I(async()=>{i(!0),o(null),n(null),f.current=[];try{let{record:t}=await import(`./record--U99gpCM.js`);l.current=t({slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0},sampling:{mousemove:50,scroll:100,input:`last`},emit:e=>{f.current.push(e)},blockClass:`cfti-block`,maskTextClass:`cfti-mask`,maskAllInputs:e})??null;let n=Bt/1e3;c(n),u.current=setInterval(()=>{--n,c(n)},1e3),d.current=setTimeout(()=>{m()},Bt)}catch{o(`Failed to start recording. Please try again.`),i(!1),p()}},[e,m,p]),stopRecording:m,clear:I(()=>{p(),i(!1),n(null),o(null),f.current=[]},[p])}},Ht=e=>e.replace(/\S/g,`*`),Ut=e=>`*`.repeat(e.length),Wt=(e,t)=>{for(let n of Array.from(e.childNodes))n.nodeType===Node.TEXT_NODE?t(n):Wt(n,t)},Gt=e=>{if(e instanceof HTMLInputElement)e.setAttribute(`value`,Ut(e.getAttribute(`value`)??``));else if(e instanceof HTMLTextAreaElement)e.textContent=Ut(e.textContent);else if(e instanceof HTMLSelectElement)for(let t of e.querySelectorAll(`option`))t.textContent=Ut(t.textContent)},Kt=({maskInputs:e})=>({name:`cfti-redact`,afterClone:t=>{let{clone:n}=t;if(n instanceof HTMLElement){for(let e of n.querySelectorAll(`.${_e}`)){Wt(e,e=>{e.data=Ht(e.data)}),Gt(e);for(let t of e.querySelectorAll(`input, textarea, select`))Gt(t)}if(e)for(let e of n.querySelectorAll(`input, textarea, select`))Gt(e)}}}),qt=({maskAllInputs:e}={})=>{let[t,n]=V(null),[r,i]=V(!1),[a,o]=V(null);return{screenshotDataUrl:t,isCapturing:r,captureError:a,capture:I(async()=>{i(!0),o(null);try{let{snapdom:t}=await import(`./snapdom-BbRa4ZYv.js`),r=await(await t(document.documentElement,{embedFonts:!0,exclude:[`.${be}`],excludeMode:`hide`,plugins:[Kt({maskInputs:!!e})],fast:!1})).toCanvas(),i=window.devicePixelRatio||1,a=Math.min(Math.round(window.innerWidth*i),r.width),o=Math.min(Math.round(window.innerHeight*i),r.height),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);if(!c)throw Error(`Failed to get 2D context for cropping`);c.drawImage(r,0,0,a,o,0,0,a,o),n(s.toDataURL(`image/png`))}catch{o(`Failed to capture screenshot. Please try again.`)}finally{i(!1)}},[e]),clear:I(()=>{n(null),o(null)},[])}},Jt=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[U(`circle`,{cx:`12`,cy:`12`,r:`10`}),U(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`})]}),Yt=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[U(`path`,{d:`M10 11v6`}),U(`path`,{d:`M14 11v6`}),U(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),U(`path`,{d:`M3 6h18`}),U(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]});function Xt(){if(window.DD_RUM&&typeof window.DD_RUM?.getInternalContext==`function`&&typeof window.DD_RUM?.getSessionReplayLink==`function`)try{let e=window.DD_RUM?.getInternalContext?.(),t=window.DD_RUM?.getSessionReplayLink?.();return{sessionId:e?.session_id,sessionReplayLink:t}}catch{return null}return null}function Zt(){if(typeof window>`u`||typeof navigator>`u`)return;let e=navigator,t=window.screen,n=Xt();return{userAgent:e.userAgent,screenResolution:`${t.width}x${t.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,pageUrl:window.location.href,pageTitle:document.title,referrer:document.referrer,language:e.language,timestamp:new Date().toISOString(),datadogTraceId:n?.traceId,datadogSessionId:n?.sessionId,datadogSessionReplayLink:n?.sessionReplayLink}}const Qt=Se(()=>import(`./RecordingReplayer-DNYXhses.js`)),$t=({id:e,title:t,description:n,properties:r,onChange:i,required:a,error:o,classNames:s,maskAllInputs:c})=>{let l=z(()=>Zt(),[]),[u,d]=V(``),[f,p]=V(``),{screenshotDataUrl:m,isCapturing:h,captureError:g,capture:_,clear:v}=qt({maskAllInputs:c}),{recordingEventsJson:y,isRecording:b,recordingError:x,remainingSeconds:S,startRecording:C,stopRecording:w,clear:T}=Vt({maskAllInputs:c}),E=z(()=>({title:u,...f?{description:f}:{},...m?{screenshotDataUrl:m}:{},...y?{recordingEventsJson:y}:{},metadata:l}),[f,l,y,m,u]);R(()=>{i(E)},[E,i]),R(()=>()=>{w()},[w]);let O=z(()=>y?JSON.parse(y):[],[y]);return U(H,{children:b?W(D,{className:G(`cf-bug-report-button`,`cf-bug-report-record-button`,s?.button,s?.recordButton),onPress:w,children:[U(Jt,{}),W(`span`,{children:[30-S,`s /`,` `,30,`s`]})]}):W(`div`,{className:G(`cf-bug-report`,s?.base),children:[W(Tt,{isRequired:a,isInvalid:!!o,name:`${e}-title`,value:u,onChange:d,className:G(`cf-question`,s?.question),children:[W(`div`,{className:G(`cf-header`,s?.header),children:[W(J,{className:G(`cf-title`,s?.title),children:[t,!a&&W(`span`,{className:G(`cf-label-optional`,s?.optionalLabel),children:[` `,`(optional)`]})]}),n&&U(Y,{slot:`description`,className:G(`cf-description`,s?.description),children:n})]}),U(ft,{placeholder:r.placeholder||`Brief description of the issue`,className:G(`cf-input`,s?.input)}),U(Z,{className:G(`cf-error`,s?.error),children:o})]}),W(Tt,{name:`${e}-description`,value:f,onChange:p,className:G(`cf-question`,s?.question),children:[U(J,{className:G(`cf-title`,s?.title),children:r.detailsLabel}),U(Ct,{placeholder:r.detailsPlaceholder||`Steps to reproduce, expected vs actual behavior, etc.`,className:G(`cf-textarea`,s?.textArea),rows:4})]}),r.enableScreenshot||r.enableRecording?W(`section`,{className:G(`cf-question`,s?.question),children:[U(J,{className:G(`cf-title`,s?.title),children:`Attachments`}),W(`div`,{className:G(`cf-bug-report-actions`,s?.actions),children:[r.enableScreenshot&&W(`div`,{className:G(`cf-bug-report-screenshot-section`,s?.screenshotSection),children:[m?W(`div`,{className:G(`cf-bug-report-media-preview`,s?.mediaPreview),children:[U(`img`,{src:m,alt:`Screenshot preview`,className:G(`cf-bug-report-screenshot-img`,s?.screenshotImg)}),U(`div`,{className:G(`cf-bug-report-media-actions`,s?.mediaActions),children:U(D,{className:G(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:v,"aria-label":`Remove screenshot`,children:U(Yt,{})})})]}):U(D,{className:G(`cf-bug-report-button`,s?.button),onPress:_,isDisabled:h,children:h?`Capturing...`:`Screenshot`}),g&&U(`div`,{className:G(`cf-error`,s?.error),children:g})]}),r.enableRecording&&W(`div`,{className:G(`cf-bug-report-recording-section`,s?.recordingSection),children:[O.length>0?W(`div`,{className:G(`cf-bug-report-media-preview`,s?.mediaPreview),children:[U(xe,{fallback:U(`span`,{className:G(`cf-bug-report-player-loading`,s?.playerLoading),"aria-label":`Loading recording preview...`}),children:U(Qt,{events:O})}),U(`div`,{className:G(`cf-bug-report-media-actions`,s?.mediaActions),children:U(D,{className:G(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:T,"aria-label":`Remove recording`,children:U(Yt,{})})})]}):U(D,{className:G(`cf-bug-report-button`,s?.button),onPress:C,children:`Record`}),x&&U(`div`,{className:G(`cf-error`,s?.error),children:x})]})]})]}):null]})})},en=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s})=>{let[c,l]=V(``);return R(()=>{i(c)},[i,c]),W(Tt,{isRequired:o,isInvalid:!!s,name:e,className:G(`cf-question`,a?.question),value:c,onChange:e=>{l(e),i(e)},children:[W(`div`,{className:G(`cf-header`,a?.header),children:[W(J,{className:G(`cf-title`,a?.title),children:[t,!o&&W(`span`,{className:G(`cf-label-optional`,a?.optionalLabel),children:[` `,`(optional)`]})]}),n&&U(Y,{slot:`description`,className:G(`cf-description`,a?.description),children:n})]}),U(Ct,{className:G(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||`Start typing...`}),U(Z,{className:G(`cf-error`,a?.error),children:s})]})},tn=({children:e,classNames:t,description:n,...r})=>U(ct,{...r,children:({isIndeterminate:r})=>W(H,{children:[W(`div`,{className:G(`cf-choice-label`,t?.label),children:[U(`div`,{className:G(`cf-checkbox-indicator`,t?.indicator),children:U(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:G(`cf-checkbox-indicator-svg`,t?.svg),children:r?U(`rect`,{x:1,y:7.5,width:16,height:3}):U(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&U(`span`,{className:G(`cf-choice-description`,t?.choiceDescription),children:n})]})}),nn=({children:e,classNames:t,...n})=>U(ct,{...n,children:U(`div`,{className:G(`cf-tag-label`,t?.tagLabel),children:e})}),rn=({title:e,description:t,properties:n,classNames:r,onChange:a,id:o,required:s,error:c})=>{let l=!!n.editable,u=n.display??`checkbox`,[d,f]=V([]),[p,m]=V(``),h=B(null),g=B(null),_=z(()=>{let e=d.indexOf(i);if(e===-1)return d;let t=[...d];return t[e]=p||`__CONFETTI_CHECKBOX_Others`,t},[p,d]),v=u===`tag`;return R(()=>{a(_)},[a,_]),U(st,{isRequired:s,isInvalid:!!c,name:o,value:d,onChange:f,className:G(`cf-question`,r?.question),children:({state:i})=>W(H,{children:[W(`div`,{className:G(`cf-header`,r?.header),children:[W(J,{className:G(`cf-title`,r?.title),children:[e,!s&&W(`span`,{className:G(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&U(Y,{slot:`description`,className:G(`cf-description`,r?.description),children:t})]}),W(`div`,{className:G(`cf-response-choices`,u===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>U(v?nn:tn,{className:G(`cf-choice`,v&&[`cf-tag`,r?.tag],!v&&[`cf-checkbox`,r?.checkbox]),description:e.description,value:e.value,classNames:{tag:r?.tag,tagLabel:r?.tagLabel,choiceDescription:r?.choiceDescription,label:r?.label,indicator:r?.indicator,svg:r?.svg},children:e.value},t)),l&&(v?W(H,{children:[U(nn,{inputRef:h,onChange:e=>{g.current&&e&&requestAnimationFrame(()=>{g.current&&g.current.focus()})},className:G(`cf-choice cf-tag`,r?.tag),value:`__CONFETTI_CHECKBOX_Others`,children:n.editable?.label}),U(ft,{"data-visible":i.value.includes(`__CONFETTI_CHECKBOX_Others`)||void 0,value:p,onChange:e=>{m(e.target.value)},ref:g,className:G(`cf-input cf-tag-input`,r?.othersInput)})]}):W(`div`,{className:G(`cf-choice cf-others-choice`,r?.othersChoice),children:[U(tn,{inputRef:h,onChange:e=>{g.current&&e&&requestAnimationFrame(()=>{g.current&&g.current.focus()})},className:G(`cf-checkbox`,r?.checkbox),value:`__CONFETTI_CHECKBOX_Others`,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:n.editable?.label}),U(ft,{value:p,onChange:e=>{m(e.target.value)},tabIndex:i.value.includes(`__CONFETTI_CHECKBOX_Others`)?0:-1,ref:g,onFocus:()=>{h.current?.checked===!1&&h.current.click()},className:G(`cf-input`,r?.othersInput)})]}))]}),U(Z,{className:G(`cf-error`,r?.error),children:c})]})})},an=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),on=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),sn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),cn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),ln=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[U(`circle`,{cx:12,cy:12,r:10}),U(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),un=e=>U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:U(`path`,{fill:`currentColor`,d:`m6.516 14.323-1.49 6.452a.998.998 0 0 0 1.529 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082a1 1 0 0 0-.59-1.74l-5.701-.454-2.467-5.461a.998.998 0 0 0-1.822 0L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.214 4.107zm2.853-4.326a.998.998 0 0 0 .832-.586L12 5.43l1.799 3.981a.998.998 0 0 0 .832.586l3.972.315-3.271 2.944c-.284.256-.397.65-.293 1.018l1.253 4.385-3.736-2.491a.995.995 0 0 0-1.109 0l-3.904 2.603 1.05-4.546a1 1 0 0 0-.276-.94l-3.038-2.962 4.09-.326z`})}),dn=e=>U(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:U(`path`,{fill:`currentColor`,d:`M21.947 9.179a1.001 1.001 0 0 0-.868-.676l-5.701-.453-2.467-5.461a.998.998 0 0 0-1.822-.001L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.213 4.107-1.49 6.452a1 1 0 0 0 1.53 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082c.297-.268.406-.686.278-1.065z`})}),fn=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return U(`div`,{className:G(`cf-rating-display-star`,n?.ratingDisplayStar),children:Array.from({length:t.scale},(e,t)=>{let i=t+1,a=String(i),o=r&&i<=r;return U(bt,{className:G(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:U(o?dn:un,{})},t)})})},pn=({properties:e,classNames:t})=>U(`div`,{className:G(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return U(bt,{className:G(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),mn=({properties:e,classNames:t,state:n})=>{let r=z(()=>[an,sn,cn,ln,on],[]),i=z(()=>[sn,cn,ln],[]);return z(()=>e.scale===3||e.scale===5,[e.scale])?U(`div`,{className:G(`cf-rating-display-emoji`,t?.ratingDisplayEmoji),children:Array.from({length:e.scale},(n,a)=>{let o=a+1,s=String(o),c=e.scale===5?r[a]:i[a];return U(bt,{className:G(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&U(c,{})},a)})}):U(pn,{properties:e,classNames:t,state:n})},hn=e=>{switch(e.properties.display??`star`){case`emoji`:return U(mn,{...e});case`number`:return U(pn,{...e});case`star`:return U(fn,{...e})}},gn=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s})=>{let[c,l]=V(null),u=z(()=>c?Number(c):void 0,[c]);return R(()=>{i(u)},[i,u]),U(yt,{isRequired:s,isInvalid:!!o,name:a,className:G(`cf-question`,r?.question),value:c,onChange:l,children:({state:i})=>W(H,{children:[W(`div`,{className:G(`cf-header`,r?.header),children:[W(J,{className:G(`cf-title`,r?.title),children:[t,!s&&W(`span`,{className:G(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),n&&U(Y,{slot:`description`,className:G(`cf-description`,r?.description),children:n})]}),W(`div`,{className:G(`cf-rating-section`,r?.ratingSection),children:[U(hn,{state:i,properties:e,classNames:r}),W(`div`,{className:G(`cf-rating-text`,r?.ratingText),children:[U(`span`,{className:G(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),U(`span`,{className:G(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),U(Z,{className:G(`cf-error`,r?.error),children:o})]})})},_n=({classNames:e,className:t,description:n,...r})=>U(bt,{...r,className:G(t,e?.radio),children:v(r.children,t=>W(H,{children:[W(`div`,{className:G(`cf-choice-label`,e?.label),children:[U(`div`,{className:G(`cf-radio-indicator`,e?.indicator)}),t]}),n&&U(`span`,{className:G(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),vn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let[c,l]=V(null),[u,d]=V(``),f=!!n.editable,p=B(null),m=B(null),h=z(()=>c===`__CONFETTI_RADIO_Others`?u||`__CONFETTI_RADIO_Others`:c??void 0,[u,c]);return R(()=>{i(h)},[i,h]),U(yt,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{l(e),e===`__CONFETTI_RADIO_Others`&&requestAnimationFrame(()=>{m.current&&m.current.focus()})},value:c,className:G(`cf-question`,r?.question),children:({state:i})=>W(H,{children:[W(`div`,{className:G(`cf-header`,r?.header),children:[W(J,{className:G(`cf-title`,r?.title),children:[e,!o&&W(`span`,{className:G(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&U(Y,{slot:`description`,className:G(`cf-description`,r?.description),children:t})]}),W(`div`,{className:G(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>U(_n,{classNames:{indicator:r?.indicator,radio:G(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.value},t)),f&&W(`div`,{className:G(`cf-choice cf-others-choice`,r?.othersChoice),children:[U(_n,{inputRef:p,value:`__CONFETTI_RADIO_Others`,classNames:{indicator:r?.indicator,radio:G(`cf-radio`,r?.radio)},description:n.editable?.description,children:n.editable?.label}),U(ft,{tabIndex:i.selectedValue===`__CONFETTI_RADIO_Others`?0:-1,ref:m,value:u,onChange:e=>d(e.target.value),onFocus:()=>{p.current?.checked===!1&&p.current.click()},className:G(`cf-input`,r?.othersInput)})]})]}),U(Z,{className:G(`cf-error`,r?.error),children:s})]})})},yn=({properties:e,title:t,description:n,classNames:r})=>U(`div`,{className:G(`cf-question`,r?.question),children:W(`div`,{className:G(`cf-header`,r?.header),children:[t&&U(`div`,{className:G(`cf-title`,r?.title),children:t}),n&&U(`div`,{className:G(`cf-description`,r?.description),children:n})]})}),bn=({question:e,onChange:t,error:n,maskAllInputs:r})=>{switch(e.properties.type){case`rating`:return U(gn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`open-ended`:return U(en,{...e,properties:e.properties,onChange:t,error:n},e.id);case`single-select`:return U(vn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`multi-select`:return U(rn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`statement`:return U(yn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`bug-report`:return U($t,{...e,properties:e.properties,onChange:t,error:n,maskAllInputs:r},e.id)}return U(`div`,{children:`Unsupported question type`},e.id)},xn=({title:e,description:t,classNames:n,onClose:r})=>{let{survey:i}=me();if(!i)return null;let a=t||i.confirmation.description;return W(H,{children:[U(`div`,{className:G(`cf-question`,n?.question),children:W(`div`,{className:G(`cf-header`,n?.header),children:[U(J,{className:G(`cf-title`,n?.title),children:e||i.confirmation.title||`Feedback submitted!`}),a&&U(Y,{slot:`description`,className:G(`cf-description`,n?.description),children:a})]})}),U(D,{className:`cf-submit-button`,onPress:()=>{r?.()},children:i.confirmation.buttonText||`Close`})]})},Sn=({onPress:e,isDisabled:t,children:n=`Submit`})=>le()?null:U(D,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n}),Cn=e=>{switch(e){case`multi-select`:return[];case`bug-report`:return{title:``};case`statement`:return;default:return``}},wn=e=>e!==void 0&&e!==``&&!(Array.isArray(e)&&e.length===0),Tn=({onSubmit:e,children:t,question:n,isLastQuestion:r})=>{let[i,a]=V(Cn(n.properties.type)),o=z(()=>Dt(n.properties,{required:n.required}),[n.properties,n.required]),s=z(()=>{let e=o.safeParse(i);if(!e.success)return Et(e.error)},[i,o]),c=z(()=>{let e=n.routingLogic;if(e.type!==`always`&&!wn(i)&&n.required)return!0;let t=e.type===`always`?e.target:e.cases.find(e=>ge({answer:i,condition:e}))?.target??e.default;return t.type===`end`?!1:t.type!==`next`||!r},[i,r,n.required,n.routingLogic]),l=z(()=>n.properties.buttonLabel?n.properties.buttonLabel:c?!n.required&&!wn(i)?`Skip`:`Next`:`Submit`,[i,c,n.properties.buttonLabel,n.required]),u=I(()=>{switch(n.properties.type){case`statement`:if(n.properties.buttonUrl&&typeof window<`u`){let e=ne.safeParse(n.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return e(void 0);default:return e(i)}},[i,e,n.properties]),d=z(()=>{switch(n.properties.type){case`rating`:case`single-select`:return!!n.properties.shouldAutoProgress;default:return!1}},[n.properties]);return W(H,{children:[t({onChange:I(t=>{a(t),d&&wn(t)&&o.safeParse(t).success&&e(t)},[d,o,e]),question:n,error:s}),(!d||!n.required)&&U(Sn,{isDisabled:!!s,onPress:u,children:l})]})},En=({onSubmit:e,children:t})=>W(H,{children:[t,U(Sn,{onPress:e})]});export{yn as a,rn as c,$ as d,Lt as f,bn as i,en as l,Ft as m,Tn as n,vn as o,Rt as p,xn as r,gn as s,En as t,zt as u};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,K as c,L as l,M as u,N as d,O as f,P as p,R as m,S as h,T as g,U as _,V as v,W as y,c as ee,f as te,h as ne,j as re,k as ie,l as ae,m as oe,nt as se,o as ce,p as le,t as ue,v as de,w as fe,y as pe,z as me}from"./Button-uM2fAs2N.js";import{i as he,r as ge,t as _e}from"./internals-Cc32ucML.js";import b,{createContext as x,forwardRef as S,useCallback as C,useContext as w,useEffect as T,useMemo as E,useReducer as ve,useRef as D,useState as O}from"react";import{useTimeout as ye}from"usehooks-ts";import{Fragment as be,jsx as k,jsxs as xe}from"react/jsx-runtime";import A from"clsx";import Se,{flushSync as Ce}from"react-dom";const we=x(null);x(null),x(null),x(null),x(null);const Te=x({});x(null);const Ee=x(null);var De=class{constructor(e,t,n,r){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e.shadowRoot;if(t){let e=this._doc.createTreeWalker(t,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(e),NodeFilter.FILTER_ACCEPT}else if(typeof this.filter==`function`)return this.filter(e);else if(this.filter?.acceptNode)return this.filter.acceptNode(e);else if(this.filter===null)return NodeFilter.FILTER_ACCEPT}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=r??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,n,this._acceptNode));let i=t.shadowRoot;if(i){let e=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(e)}}get currentNode(){return this._currentNode}set currentNode(t){if(!e(this.root,t))throw Error(`Cannot set currentNode to a node that is not contained by the root node.`);let n=[],r=t,i=t;for(this._currentNode=t;r&&r!==this.root;)if(r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let e=r,t=this._doc.createTreeWalker(e,this.whatToShow,{acceptNode:this._acceptNode});n.push(t),t.currentNode=i,this._currentSetFor.add(t),r=i=e.host}else r=r.parentNode;let a=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});n.push(a),a.currentNode=i,this._currentSetFor.add(a),this._walkerStack=n}get doc(){return this._doc}firstChild(){let t=this.currentNode,n=this.nextNode();return e(t,n)?(n&&(this.currentNode=n),n):(this.currentNode=t,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let t;if(typeof this.filter==`function`?t=this.filter(e):this.filter?.acceptNode&&(t=this.filter.acceptNode(e)),t===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.nextNode();return e&&(this.currentNode=e),e}else return null}previousNode(){let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e))if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null;return null}let t=e.previousNode();if(t){if(t.shadowRoot){let e;if(typeof this.filter==`function`?e=this.filter(t):this.filter?.acceptNode&&(e=this.filter.acceptNode(t)),e===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let n=this.lastChild();return n&&(this.currentNode=n),n}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}};function Oe(e,t,n,r){return p()?new De(e,t,n,r):e.createTreeWalker(t,n,r)}function ke(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=me(n),i&&r?i=[...new Set([n,...i.trim().split(/\s+/)])].join(` `):i&&=i.trim().split(/\s+/).join(` `),!r&&!i&&t&&(r=t),{id:n,"aria-label":r,"aria-labelledby":i}}function j(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=document.scrollingElement||document.documentElement,i=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return e===r&&n.overflow!==`hidden`&&(i=!0),i&&t&&(i=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),i}function Ae(e,t){let n=e;for(j(n,t)&&(n=n.parentElement);n&&!j(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const je=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function M(e){return e instanceof HTMLInputElement&&!je.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let N=typeof document<`u`&&window.visualViewport;function Me(){let e=t(),[n,r]=O(()=>e?{width:0,height:0}:P());return T(()=>{let e=e=>{r(t=>e.width===t.width&&e.height===t.height?t:e)},t=()=>{N&&N.scale>1||e(P())},n,i=t=>{N&&N.scale>1||M(d(t))&&(n=requestAnimationFrame(()=>{let t=u();(!t||!M(t))&&e({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight})}))};return e(P()),y()&&window.addEventListener(`blur`,i,!0),N?N.addEventListener(`resize`,t):window.addEventListener(`resize`,t),()=>{cancelAnimationFrame(n),y()&&window.removeEventListener(`blur`,i,!0),N?N.removeEventListener(`resize`,t):window.removeEventListener(`resize`,t)}},[]),n}function P(){return{width:N?Math.min(N.width*N.scale,document.documentElement.clientWidth):document.documentElement.clientWidth,height:N?N.height*N.scale:document.documentElement.clientHeight}}function Ne(e,t=!0){let[n,r]=O(!0),i=n&&t;return v(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),Fe(e,i,C(()=>r(!1),[])),i}function Pe(e,t){let[n,r]=O(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`);break}let i=n===`exiting`;return Fe(e,i,C(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function Fe(e,t,n){v(()=>{if(t&&e.current){if(!(`getAnimations`in e.current)){n();return}let t=e.current.getAnimations();if(t.length===0){n();return}let r=!1;return Promise.allSettled(t.map(e=>e.finished)).then(()=>{r||Ce(()=>{n()})}),()=>{r=!0}}},[e,t,n])}const Ie=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;function Le(e){return e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer!==void 0}let F=new WeakMap,I=[];function Re(t,n){let r=s(t?.[0]),i=n instanceof r.Element?{root:n}:n,o=i?.root??document.body,c=i?.shouldUseInert&&Ie,l=new Set(t),u=new Set,d=e=>c&&e instanceof r.HTMLElement?e.inert:e.getAttribute(`aria-hidden`)===`true`,f=(e,t)=>{c&&e instanceof r.HTMLElement?e.inert=t:t?e.setAttribute(`aria-hidden`,`true`):(e.removeAttribute(`aria-hidden`),e instanceof r.HTMLElement&&(e.inert=!1))},m=new Set;if(p())for(let e of t){let t=e;for(;t&&t!==o;){let e=t.getRootNode();`shadowRoot`in e&&m.add(e.shadowRoot),t=e.parentNode}}let h=t=>{for(let e of t.querySelectorAll(`[data-live-announcer], [data-react-aria-top-layer]`))l.add(e);let n=t=>{if(u.has(t)||l.has(t)||t.parentElement&&u.has(t.parentElement)&&t.parentElement.getAttribute(`role`)!==`row`)return NodeFilter.FILTER_REJECT;for(let n of l)if(e(t,n))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},r=Oe(a(t),t,NodeFilter.SHOW_ELEMENT,{acceptNode:n}),i=n(t);if(i===NodeFilter.FILTER_ACCEPT&&g(t),i!==NodeFilter.FILTER_REJECT){let e=r.nextNode();for(;e!=null;)g(e),e=r.nextNode()}},g=e=>{let t=F.get(e)??0;d(e)&&t===0||(t===0&&f(e,!0),u.add(e),F.set(e,t+1))};I.length&&I[I.length-1].disconnect(),h(o);let _=new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){if(n.target.isConnected&&![...l,...u].some(t=>e(t,n.target)))for(let e of n.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Le(e)?l.add(e):e instanceof Element&&h(e);if(p()){for(let e of m)if(!e.isConnected){_.disconnect();break}}}});_.observe(o,{childList:!0,subtree:!0});let v=new Set;if(p())for(let t of m){let n=new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){if(n.target.isConnected&&![...l,...u].some(t=>e(t,n.target)))for(let e of n.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Le(e)?l.add(e):e instanceof Element&&h(e);if(p()){for(let e of m)if(!e.isConnected){_.disconnect();break}}}});n.observe(t,{childList:!0,subtree:!0}),v.add(n)}let y={visibleNodes:l,hiddenNodes:u,observe(){_.observe(o,{childList:!0,subtree:!0})},disconnect(){_.disconnect()}};return I.push(y),()=>{if(_.disconnect(),p())for(let e of v)e.disconnect();for(let e of u){let t=F.get(e);t!=null&&(t===1?(f(e,!1),F.delete(e)):F.set(e,t-1))}y===I[I.length-1]?(I.pop(),I.length&&I[I.length-1].observe()):I.splice(I.indexOf(y),1)}}const ze=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),Be=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function Ve(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),n=typeof t.getTextInfo==`function`?t.getTextInfo():t.textInfo;if(n)return n.direction===`rtl`;if(t.script)return ze.has(t.script)}let t=e.split(`-`)[0];return Be.has(t)}const He=Symbol.for(`react-aria.i18n.locale`);function Ue(){let e=typeof window<`u`&&window[He]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:Ve(e)?`rtl`:`ltr`}}let We=Ue(),L=new Set;function Ge(){We=Ue();for(let e of L)e(We)}function Ke(){let e=t(),[n,r]=O(We);return T(()=>(L.size===0&&window.addEventListener(`languagechange`,Ge),L.add(r),()=>{L.delete(r),L.size===0&&window.removeEventListener(`languagechange`,Ge)}),[]),e?{locale:typeof window<`u`&&window[He]||`en-US`,direction:`ltr`}:n}const qe=b.createContext(null);function Je(){let e=Ke();return w(qe)||e}const Ye=Symbol.for(`react-aria.i18n.locale`),Xe=Symbol.for(`react-aria.i18n.strings`);let R;var Ze=class e{constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}getStringForLocale(e,t){let n=this.getStringsForLocale(t)[e];if(!n)throw Error(`Could not find intl message ${e} in ${t} locale`);return n}getStringsForLocale(e){let t=this.strings[e];return t||(t=Qe(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[Ye];if(R===void 0){let t=window[Xe];if(!t)return null;R={};for(let r in t)R[r]=new e({[n]:t[r]},n)}let r=R?.[t];if(!r)throw Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}};function Qe(e,t,n=`en-US`){if(t[e])return t[e];let r=$e(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function $e(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const et=new Map,tt=new Map;var nt=class{constructor(e,t){this.locale=e,this.strings=t}format(e,t){let n=this.strings.getStringForLocale(e,this.locale);return typeof n==`function`?n(t,this):n}plural(e,t,n=`cardinal`){let r=t[`=`+e];if(r)return typeof r==`function`?r():r;let i=this.locale+`:`+n,a=et.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),et.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=tt.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),tt.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}};const rt=new WeakMap;function it(e){let t=rt.get(e);return t||(t=new Ze(e),rt.set(e,t)),t}function at(e,t){return t&&Ze.getGlobalDictionaryForPackage(t)||it(e)}function ot(e,t){let{locale:n}=Je(),r=at(e,t);return E(()=>new nt(n,r),[n,r])}const st=b.createContext(null),ct=`react-aria-focus-scope-restore`;let z=null;function lt(e){let{children:t,contain:n,restoreFocus:r,autoFocus:i}=e,o=D(null),s=D(null),c=D([]),{parentNode:l}=w(st)||{},d=E(()=>new wt({scopeRef:c}),[c]);v(()=>{let e=l||q.root;if(q.getTreeNode(e.scopeRef)&&z&&!W(z,e.scopeRef)){let t=q.getTreeNode(z);t&&(e=t)}e.addChild(d),q.addNode(d)},[d,l]),v(()=>{let e=q.getTreeNode(c);e&&(e.contain=!!n)},[n]),v(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==s.current;)t.push(e),e.addEventListener(ct,n),e=e.nextSibling;return c.current=t,()=>{for(let e of t)e.removeEventListener(ct,n)}},[t]),yt(c,r,n),pt(c,n),xt(c,r,n),vt(c,i),T(()=>{let e=u(a(c.current?c.current[0]:void 0)),t=null;if(H(e,c.current)){for(let n of q.traverse())n.scopeRef&&H(e,n.scopeRef.current)&&(t=n);t===q.getTreeNode(c)&&(z=t.scopeRef)}},[c]),v(()=>()=>{let e=q.getTreeNode(c)?.parent?.scopeRef??null;(c===z||W(c,z))&&(!e||q.getTreeNode(e))&&(z=e),q.removeTreeNode(c)},[c]);let f=E(()=>ut(c),[]),p=E(()=>({focusManager:f,parentNode:d}),[d,f]);return b.createElement(st.Provider,{value:p},b.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,b.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:s}))}function ut(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:o,accept:s}=t,c=r||u(a(n[0]??void 0)),l=n[0].previousElementSibling,d=K(B(n),{tabbable:i,accept:s},n);d.currentNode=H(c,n)?c:l;let f=d.nextNode();return!f&&o&&(d.currentNode=l,f=d.nextNode()),f&&G(f,!0),f},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:o,accept:s}=t,c=r||u(a(n[0]??void 0)),l=n[n.length-1].nextElementSibling,d=K(B(n),{tabbable:i,accept:s},n);d.currentNode=H(c,n)?c:l;let f=d.previousNode();return!f&&o&&(d.currentNode=l,f=d.previousNode()),f&&G(f,!0),f},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=K(B(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&G(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=K(B(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&G(o,!0),o}}}function B(e){return e[0].parentElement}function V(e){let t=q.getTreeNode(z);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function dt(e){if(!e.form)return Array.from(a(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=s(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function ft(e){if(e.checked)return!0;let t=dt(e);return t.length>0&&!t.some(e=>e.checked)}function pt(e,t){let n=D(void 0),r=D(void 0);v(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let c=a(i?i[0]:void 0),l=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!V(e)||t.isComposing)return;let n=u(c),r=e.current;if(!r||!H(n,r))return;let i=K(B(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let a=t.shiftKey?i.previousNode():i.nextNode();a||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),a&&(G(a,!0),a instanceof s(a).HTMLInputElement&&a.select())},f=t=>{(!z||W(z,e))&&H(d(t),e.current)?(z=e,n.current=d(t)):V(e)&&!U(d(t),e)?n.current?n.current.focus():z&&z.current&&_t(z.current):V(e)&&(n.current=d(t))},p=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=ae(),i=(r===`virtual`||r===null)&&_()&&o(),a=u(c);if(!i&&a&&V(e)&&!U(a,e)){z=e;let r=d(t);r&&r.isConnected?(n.current=r,n.current?.focus()):z.current&&_t(z.current)}})};return c.addEventListener(`keydown`,l,!1),c.addEventListener(`focusin`,f,!1),i?.forEach(e=>e.addEventListener(`focusin`,f,!1)),i?.forEach(e=>e.addEventListener(`focusout`,p,!1)),()=>{c.removeEventListener(`keydown`,l,!1),c.removeEventListener(`focusin`,f,!1),i?.forEach(e=>e.removeEventListener(`focusin`,f,!1)),i?.forEach(e=>e.removeEventListener(`focusout`,p,!1))}},[e,t]),v(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function mt(e){return U(e)}function H(t,n){return!t||!n?!1:n.some(n=>e(n,t))}function U(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of q.traverse(q.getTreeNode(t)))if(n&&H(e,n.current))return!0;return!1}function ht(e){return U(e,z)}function W(e,t){let n=q.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function G(e,t=!1){if(e!=null&&!t)try{ee(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function gt(e,t=!0){let n=e[0].previousElementSibling,r=B(e),i=K(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=B(e),i=K(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function _t(e,t=!0){G(gt(e,t))}function vt(e,t){let n=b.useRef(t);T(()=>{n.current&&(z=e,!H(u(a(e.current?e.current[0]:void 0)),z.current)&&e.current&&_t(e.current)),n.current=!1},[e])}function yt(e,t,n){v(()=>{if(t||n)return;let r=e.current,i=a(r?r[0]:void 0),o=t=>{let n=d(t);H(n,e.current)?z=e:mt(n)||(z=null)};return i.addEventListener(`focusin`,o,!1),r?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{i.removeEventListener(`focusin`,o,!1),r?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,t,n])}function bt(e){let t=q.getTreeNode(z);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function xt(e,t,n){let r=D(typeof document<`u`?u(a(e.current?e.current[0]:void 0)):null);v(()=>{let r=e.current,i=a(r?r[0]:void 0);if(!t||n)return;let o=()=>{(!z||W(z,e))&&H(u(i),e.current)&&(z=e)};return i.addEventListener(`focusin`,o,!1),r?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{i.removeEventListener(`focusin`,o,!1),r?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,n]),v(()=>{let r=a(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!V(e)||t.isComposing)return;let n=r.activeElement;if(!U(n,e)||!bt(e))return;let i=q.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=K(r.body,{tabbable:!0});o.currentNode=n;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!a.isConnected||a===r.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!U(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(U(s,e));t.preventDefault(),t.stopPropagation(),s?G(s,!0):mt(a)?G(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),v(()=>{let n=a(e.current?e.current[0]:void 0);if(!t)return;let i=q.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=q.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=u(n);if(t&&i&&(a&&U(a,e)||a===n.body&&bt(e))){let t=q.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){St(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&q.getTreeNode(n.scopeRef)){St(gt(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function St(e){e.dispatchEvent(new CustomEvent(ct,{bubbles:!0,cancelable:!0}))&&G(e)}function K(t,r,i){let o=r?.tabbable?fe:n,s=a(t?.nodeType===Node.ELEMENT_NODE?t:null),c=Oe(s,t||s,NodeFilter.SHOW_ELEMENT,{acceptNode(t){return e(r?.from,t)||r?.tabbable&&t.tagName===`INPUT`&&t.getAttribute(`type`)===`radio`&&(!ft(t)||c.currentNode.tagName===`INPUT`&&c.currentNode.type===`radio`&&c.currentNode.name===t.name)?NodeFilter.FILTER_REJECT:o(t)&&(!i||H(t,i))&&(!r?.accept||r.accept(t))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return r?.from&&(c.currentNode=r.from),c}var Ct=class e{constructor(){this.fastMap=new Map,this.root=new wt({scopeRef:null}),this.fastMap.set(null,this.root)}get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(t??null);if(!r)return;let i=new wt({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&H(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}},wt=class{constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}};let q=new Ct;const Tt=typeof document<`u`?b.useInsertionEffect??b.useLayoutEffect:()=>{};function Et(e,t,n){let[r,i]=O(e||t),a=D(r),o=D(e!==void 0),s=e!==void 0;T(()=>{o.current,o.current=s},[s]);let c=s?e:r;Tt(()=>{a.current=c});let[,l]=ve(()=>({}),{});return[c,C((e,...t)=>{let r=typeof e==`function`?e(a.current):e;Object.is(a.current,r)||(a.current=r,i(r),l(),n?.(r,...t))},[n])]}function Dt({children:e}){let t=E(()=>({register:()=>{}}),[]);return b.createElement(te.Provider,{value:t},e)}function Ot(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,o=D({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),s=g(e=>{n&&kt(e,t)&&(i&&i(e),o.current.isPointerDown=!0)}),c=g(e=>{n&&n(e)});T(()=>{let e=o.current;if(r)return;let n=t.current,i=a(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&kt(n,t)&&c(n),e.isPointerDown=!1};return i.addEventListener(`pointerdown`,s,!0),i.addEventListener(`click`,n,!0),()=>{i.removeEventListener(`pointerdown`,s,!0),i.removeEventListener(`click`,n,!0)}}},[t,r])}function kt(t,n){if(t.button>0)return!1;let r=d(t);if(r){let t=r.ownerDocument;if(!t||!e(t.documentElement,r)||r.closest(`[data-react-aria-top-layer]`))return!1}return n.current?!t.composedPath().includes(n.current):!1}const At={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function jt(e={}){let{style:t,isFocusable:n}=e,[r,i]=O(!1),{focusWithinProps:a}=ce({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=E(()=>r?t:t?{...At,...t}:At,[r]);return{visuallyHiddenProps:{...a,style:o}}}function Mt(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...a}=e,{visuallyHiddenProps:o}=jt(e);return b.createElement(n,f(a,o),t)}const Nt=x({});function Pt(){return w(Nt)??{}}const Ft=b.createContext(null);function It(e){let n=t(),{portalContainer:r=n?null:document.body,isExiting:i}=e,[a,o]=O(!1),s=E(()=>({contain:a,setContain:o}),[a,o]),{getContainer:c}=Pt();if(!e.portalContainer&&c&&(r=c()),!r)return null;let l=e.children;return e.disableFocusManagement||(l=b.createElement(lt,{restoreFocus:!0,contain:(e.shouldContainFocus||a)&&!i},l)),l=b.createElement(Ft.Provider,{value:s},b.createElement(Dt,null,l)),Se.createPortal(l,r)}function Lt(){let e=w(Ft)?.setContain;v(()=>{e?.(!0)},[e])}function Rt(e,t){let{role:n=`dialog`}=e,i=m();i=e[`aria-label`]?void 0:i;let a=D(!1);return T(()=>{if(t.current&&!re(t.current)){ee(t.current);let e=setTimeout(()=>{(u()===t.current||u()===document.body)&&(a.current=!0,t.current&&(t.current.blur(),ee(t.current)),a.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),Lt(),D(!1),T(()=>{}),{dialogProps:{...r(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||i,onBlur:e=>{a.current&&e.stopPropagation()}},titleProps:{id:i}}}var zt={};zt={dismiss:`تجاهل`};var Bt={};Bt={dismiss:`Отхвърляне`};var Vt={};Vt={dismiss:`Odstranit`};var Ht={};Ht={dismiss:`Luk`};var Ut={};Ut={dismiss:`Schließen`};var Wt={};Wt={dismiss:`Απόρριψη`};var Gt={};Gt={dismiss:`Dismiss`};var Kt={};Kt={dismiss:`Descartar`};var qt={};qt={dismiss:`Lõpeta`};var Jt={};Jt={dismiss:`Hylkää`};var Yt={};Yt={dismiss:`Rejeter`};var Xt={};Xt={dismiss:`התעלם`};var Zt={};Zt={dismiss:`Odbaci`};var Qt={};Qt={dismiss:`Elutasítás`};var $t={};$t={dismiss:`Ignora`};var en={};en={dismiss:`閉じる`};var tn={};tn={dismiss:`무시`};var nn={};nn={dismiss:`Atmesti`};var rn={};rn={dismiss:`Nerādīt`};var an={};an={dismiss:`Lukk`};var on={};on={dismiss:`Negeren`};var sn={};sn={dismiss:`Zignoruj`};var cn={};cn={dismiss:`Descartar`};var ln={};ln={dismiss:`Dispensar`};var un={};un={dismiss:`Revocare`};var dn={};dn={dismiss:`Пропустить`};var fn={};fn={dismiss:`Zrušiť`};var pn={};pn={dismiss:`Opusti`};var mn={};mn={dismiss:`Odbaci`};var hn={};hn={dismiss:`Avvisa`};var gn={};gn={dismiss:`Kapat`};var _n={};_n={dismiss:`Скасувати`};var vn={};vn={dismiss:`取消`};var yn={};yn={dismiss:`關閉`};var bn={};bn={"ar-AE":zt,"bg-BG":Bt,"cs-CZ":Vt,"da-DK":Ht,"de-DE":Ut,"el-GR":Wt,"en-US":Gt,"es-ES":Kt,"et-EE":qt,"fi-FI":Jt,"fr-FR":Yt,"he-IL":Xt,"hr-HR":Zt,"hu-HU":Qt,"it-IT":$t,"ja-JP":en,"ko-KR":tn,"lt-LT":nn,"lv-LV":rn,"nb-NO":an,"nl-NL":on,"pl-PL":sn,"pt-BR":cn,"pt-PT":ln,"ro-RO":un,"ru-RU":dn,"sk-SK":fn,"sl-SI":pn,"sr-SP":mn,"sv-SE":hn,"tr-TR":gn,"uk-UA":_n,"zh-CN":vn,"zh-TW":yn};function xn(e){return e&&e.__esModule?e.default:e}function Sn(e){let{onDismiss:t,...n}=e,r=ke(n,ot(xn(bn),`@react-aria/overlays`).format(`dismiss`)),i=()=>{t&&t()};return b.createElement(Mt,null,b.createElement(`button`,{...r,tabIndex:-1,onClick:i,style:{width:1,height:1}}))}const J=[];function Cn(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:i,isDismissable:a=!1,isKeyboardDismissDisabled:o=!1,shouldCloseOnInteractOutside:s}=e,c=D(void 0);T(()=>{if(i&&!J.includes(t))return J.push(t),()=>{let e=J.indexOf(t);e>=0&&J.splice(e,1)}},[i,t]);let l=()=>{J[J.length-1]===t&&n&&n()},u=e=>{let n=J[J.length-1];c.current=n,(!s||s(d(e)))&&n===t&&e.stopPropagation()},f=e=>{(!s||s(d(e)))&&(J[J.length-1]===t&&e.stopPropagation(),c.current===t&&l()),c.current=void 0},p=e=>{e.key===`Escape`&&!o&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),l())};Ot({ref:t,onInteractOutside:a&&i?f:void 0,onInteractOutsideStart:u});let{focusWithinProps:m}=ce({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||ht(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}});return{overlayProps:{onKeyDown:p,...m},underlayProps:{}}}const Y=typeof document<`u`&&window.visualViewport;let X=0,wn;function Tn(e={}){let{isDisabled:t}=e;v(()=>{if(!t)return X++,X===1&&(wn=y()?Dn():En()),()=>{X--,X===0&&wn()}},[t])}function En(){let e=window.innerWidth-document.documentElement.clientWidth;return l(e>0&&(`scrollbarGutter`in document.documentElement.style?Z(document.documentElement,`scrollbarGutter`,`stable`):Z(document.documentElement,`paddingRight`,`${e}px`)),Z(document.documentElement,`overflow`,`hidden`))}function Dn(){let e=Z(document.documentElement,`overflow`,`hidden`),t,n=!1,r=e=>{let r=d(e);t=j(r)?r:Ae(r,!0),n=!1;let i=r.ownerDocument.defaultView.getSelection();i&&!i.isCollapsed&&i.containsNode(r,!0)&&(n=!0),e.composedPath().some(e=>e instanceof HTMLInputElement&&e.type===`range`)&&(n=!0),`selectionStart`in r&&`selectionEnd`in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(n=!0)},i=document.createElement(`style`),a=h();a&&(i.nonce=a),i.textContent=`@layer {
|
|
2
|
+
* {
|
|
3
|
+
overscroll-behavior: contain;
|
|
4
|
+
}
|
|
5
|
+
}`,document.head.prepend(i);let o=e=>{if(!(e.touches.length===2||n)){if(!t||t===document.documentElement||t===document.body){e.preventDefault();return}t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&e.preventDefault()}},s=e=>{let t=d(e),n=e.relatedTarget;n&&M(n)?(n.focus({preventScroll:!0}),kn(n,M(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},c=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=u(),n=t!=null&&M(t);c.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&kn(this,n)};let f=l(On(document,`touchstart`,r,{passive:!1,capture:!0}),On(document,`touchmove`,o,{passive:!1,capture:!0}),On(document,`blur`,s,!0));return()=>{e(),f(),i.remove(),HTMLElement.prototype.focus=c}}function Z(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function On(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function kn(e,t){t||!Y?An(e):Y.addEventListener(`resize`,()=>An(e),{once:!0})}function An(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=Ae(n);if(e!==document.documentElement&&e!==document.body&&e!==n){let t=e.getBoundingClientRect(),r=n.getBoundingClientRect();if(r.top<t.top||r.bottom>t.top+n.clientHeight){let n=t.bottom;Y&&(n=Math.min(n,Y.offsetTop+Y.height));let i=r.top-t.top-((n-t.top)/2-r.height/2);e.scrollTo({top:Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+i)),behavior:`smooth`})}}n=e.parentElement}}function jn(e,t,n){let{overlayProps:r,underlayProps:i}=Cn({...e,isOpen:t.isOpen,onClose:t.close},n);return Tn({isDisabled:!t.isOpen}),Lt(),T(()=>{if(t.isOpen&&n.current)return Re([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:f(r),underlayProps:i}}function Mn(e){let[t,n]=Et(e.isOpen,e.defaultOpen||!1,e.onOpenChange);return{isOpen:t,setOpen:n,open:C(()=>{n(!0)},[n]),close:C(()=>{n(!1)},[n]),toggle:C(()=>{n(!t)},[n,t])}}const Nn=x(null),Q=x(null),Pn=S(function(e,t){let n=e[`aria-labelledby`];[e,t]=oe(e,t,Nn);let{dialogProps:i,titleProps:a}=Rt({...e,"aria-labelledby":n},t),o=w(Q);!i[`aria-label`]&&!i[`aria-labelledby`]&&e[`aria-labelledby`]&&(i[`aria-labelledby`]=e[`aria-labelledby`]);let s=ne({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),c=r(e,{global:!0});return b.createElement(pe.section,{...f(c,s,i),render:e.render,ref:t,slot:e.slot||void 0},b.createElement(le,{values:[[Te,{slots:{[de]:{},title:{...a,level:2}}}],[ue,{slots:{[de]:{},close:{onPress:()=>o?.close()}}}]]},s.children))}),Fn=x(null),In=x(null),Ln=S(function(e,t){if(w(In))return b.createElement(Vn,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,children:s,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d,...f}=e;return b.createElement(zn,{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d},b.createElement(Vn,{...f,modalRef:t},s))});function Rn(e,n){[e,n]=oe(e,n,Fn);let r=w(Q),a=Mn(e),o=e.isOpen!=null||e.defaultOpen!=null||!r?a:r,s=i(n),c=D(null),l=Pe(s,o.isOpen),u=Pe(c,o.isOpen),d=l||u||e.isExiting||!1,f=t();return!o.isOpen&&!d||f?null:b.createElement(Bn,{...e,state:o,isExiting:d,overlayRef:s,modalRef:c})}const zn=S(Rn);function Bn({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:i}=t,{modalProps:a,underlayProps:o}=jn(t,i,n),s=Ne(t.overlayRef)||t.isEntering||!1,c=ne({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:t.isExiting,state:i}}),l=Me(),u;if(typeof document<`u`){let e=j(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().height%1;u=e.scrollHeight-t}let d={...c.style,"--visual-viewport-height":l.height+`px`,"--page-height":u===void 0?void 0:u+`px`};return b.createElement(It,{isExiting:t.isExiting,portalContainer:e},b.createElement(pe.div,{...f(r(t,{global:!0}),o),...c,style:d,ref:t.overlayRef,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},b.createElement(le,{values:[[In,{modalProps:a,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[Q,i]]},c.children)))}function Vn(e){let{modalProps:t,modalRef:n,isExiting:a,isDismissable:o}=w(In),s=w(Q),c=i(E(()=>ie(e.modalRef,n),[e.modalRef,n])),l=Ne(c),u=ne({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:l,isExiting:a,state:s}});return b.createElement(pe.div,{...f(r(e,{global:!0}),t),...u,ref:c,"data-entering":l||void 0,"data-exiting":a||void 0},o&&b.createElement(Sn,{onDismiss:s.close}),u.children)}const Hn=x({}),Un=()=>w(Hn),Wn=x({}),Gn=({type:e,children:t})=>{let n=E(()=>({type:e}),[e]);return k(Wn.Provider,{value:n,children:t})},Kn=()=>w(Wn),$=x(null),qn=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},apiBaseUrl:a})=>{let{type:o}=Kn(),s=Un(),l=s.version??`0.6.0`,u=s.build,d=D(!1),[f,p]=O(),m=se({publishableKey:n,apiBaseUrl:a});T(()=>{(async()=>{d.current=!1,p(void 0);try{let e=await m.get(`api/v1/cfti/${t}`).json(),n=c.safeParse(e);if(!n.success)return;p(n.data)}catch{}})()},[m,t]);let h=C(async({answers:e})=>{let n=crypto.randomUUID();await m.put(`api/v1/cfti/${t}/response/${n}`,{json:{respondent:r,data:e,metadata:i,telemetry:{...o!==void 0&&{type:o},version:l,...u&&{build:u}}}})},[u,m,i,r,t,l,o]),g=C(()=>{m.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[m,r,t]);return T(()=>{d.current||f&&r&&(d.current=!0,m.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`view`}}).catch(()=>{}))},[m,r,f,t]),f?k($.Provider,{value:{submit:h,dismiss:g,surveyId:t,survey:f,metadata:i},children:e}):null},Jn=e=>w($)?k(be,{children:e.children}):k(qn,{...e}),Yn=()=>{let e=w($);if(!e)throw Error(`useSurvey must be used within a SurveyProvider`);return e},Xn=()=>{let[e,t]=O(!1);return T(()=>{let e=e=>{let n=he.safeParse(e);n.error||t(n.data.detail.isRecording)};return document.addEventListener(ge,e),()=>{document.removeEventListener(ge,e)}},[]),e},Zn=({className:e,iconClassName:t,onClose:n})=>Xn()?null:k(`button`,{type:`button`,className:e,"aria-label":`Dismiss`,onClick:n,children:k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:k(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M3.53 3.529c.26-.26.682-.26.942 0l3.529 3.528 3.528-3.528a.667.667 0 0 1 .943.942L8.943 8l3.53 3.528a.667.667 0 0 1-.944.943L8.001 8.943 4.472 12.47a.667.667 0 1 1-.943-.943L7.058 8 3.529 4.47a.667.667 0 0 1 0-.942Z`,clipRule:`evenodd`})})}),Qn=({children:e,classNames:t,isDismissable:n,onDismiss:r,onClose:i,closeOnFinishMs:a,isSubmitted:o,onSubmitted:s})=>{let{survey:c,surveyId:l,dismiss:u}=Yn(),[d,f]=O(!1);return ye(()=>{c&&i?.()},d?a:null),xe(Pn,{"aria-label":`Survey`,id:`${l}-popover`,className:A(`confetti-modal-dialog ${_e}`,t?.dialog),children:[n&&k(Zn,{className:A(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{!o&&!d&&(await u(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>s?.(),setIsFinished:()=>f(!0)}):e]})},$n=({children:e,classNames:t,onDismiss:n,onClose:r,isDismissable:i=!0,closeOnFinishMs:a=3e3})=>{let{dismiss:o}=Yn(),[s,c]=O(!1);return k(zn,{isOpen:!0,isDismissable:i,isKeyboardDismissDisabled:!i,onOpenChange:async e=>{e||(s||(await o(),n?.()),r?.())},className:A(`confetti-modal-overlay ${_e}`,t?.overlay),children:k(Ln,{className:A(`confetti-modal ${_e}`,t?.modal),children:k(Qn,{classNames:t,isDismissable:i,onDismiss:n,onClose:r,closeOnFinishMs:a,isSubmitted:s,onSubmitted:()=>c(!0),children:e})})})};export{$ as a,Gn as c,K as d,Je as f,we as h,Xn as i,Mt as l,Ee as m,Qn as n,Jn as o,ke as p,Zn as r,Yn as s,$n as t,Et as u};
|