quantum-component-library 1.4.54-dev.0 → 1.4.54
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/dist/components.cjs +1 -1
- package/dist/components.js +4 -4
- package/dist/{dnd-core-vendor-Dl2_2nro.js → dnd-core-vendor-BvkN08kD.js} +2 -2
- package/dist/{dnd-core-vendor-JZjD_Td8.cjs → dnd-core-vendor-Dpm8Ha_h.cjs} +1 -1
- package/dist/{graphql-vendor-B7q7Yz13.cjs → graphql-vendor-CSrUjvOC.cjs} +1 -1
- package/dist/{graphql-vendor-e0-pkqHq.js → graphql-vendor-ipMKtdBu.js} +1 -1
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/{lodash-vendor-CNINpQjK.js → lodash-vendor-CY4G3-79.js} +1 -1
- package/dist/{lodash-vendor-DUcUuCwh.cjs → lodash-vendor-CfNg9qwP.cjs} +1 -1
- package/dist/{other-CIQ4hL6N.cjs → other-B_xypnnb.cjs} +1 -1
- package/dist/{other-Bc-jVnzY.js → other-CPHWCRXi.js} +2 -2
- package/dist/{react-dnd-vendor-cqCcPDYo.js → react-dnd-vendor-DYesaYGm.js} +2 -2
- package/dist/{react-dnd-vendor-D97_L5Fj.cjs → react-dnd-vendor-DvbjNa5U.cjs} +1 -1
- package/dist/{react-select-vendor-Dm7JCXQl.js → react-select-vendor-B0QF8gkj.js} +1 -1
- package/dist/{react-select-vendor-DpstHMZN.cjs → react-select-vendor-BLLqfZvd.cjs} +1 -1
- package/dist/{services-human-BFuIf4vd.js → services-human-D5IllQkM.js} +2 -2
- package/dist/{services-human-BTPVJl80.cjs → services-human-DFPelsei.cjs} +1 -1
- package/dist/services.cjs +1 -1
- package/dist/services.js +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.js +3 -3
- package/dist/{utils-conversion-DSzF0R3j.js → utils-conversion-BQfLNP0g.js} +1 -1
- package/dist/{utils-conversion-DP8LonZS.cjs → utils-conversion-DFO1UVSN.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{vendor-2NwaL0dE.js → vendor-BSFJsa1P.js} +1 -1
- package/dist/{vendor-vQ2gqPbn.cjs → vendor-DeYnrakH.cjs} +1 -1
- package/package.json +1 -1
package/dist/components.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./react-jsx-runtime-vendor-Dszzpdy0.cjs");require("./moment-vendor-1cRqq0AH.cjs");const t=require("@chakra-ui/react"),s=require("react"),A=require("./generated.cjs"),R=require("./graphql-Dm6zPwG7.cjs"),Te=require("./utils-cn-FIKrq5Mb.cjs");require("./lodash-vendor-DUcUuCwh.cjs");const ee=require("urql"),ie=require("./hooks.cjs"),Pe=require("./ufuzzy-vendor-7qHa_k39.cjs"),ae=require("./react-select-vendor-DpstHMZN.cjs"),Me=require("./react-icons-vendor-BF_sZq07.cjs"),me=require("./services.cjs"),Se=require("./react-dnd-vendor-D97_L5Fj.cjs"),ce=require("./services-human-BTPVJl80.cjs"),_=require("./generated-graphql.cjs"),pe=require("./types.cjs"),Be=({setSearch:i,actions:o,updateUseCases:c,hideUseCaseFilter:p=!1})=>{const g=s.useMemo(()=>o?.flatMap(m=>m.useCases).filter((m,x,j)=>j.findIndex(r=>r.id===m.id)===x).map(m=>({label:m.name,value:m.id}))||[],[o]);return e.jsxRuntimeExports.jsxs(t.Flex,{width:"100%",alignContent:"space-evenly",gap:4,children:[e.jsxRuntimeExports.jsxs(t.InputGroup,{size:"md",flex:1,children:[e.jsxRuntimeExports.jsx(t.InputLeftElement,{children:e.jsxRuntimeExports.jsx(t.Icon,{as:Me.FaSearch,color:"gray.300"})}),e.jsxRuntimeExports.jsx(t.Input,{placeholder:"Search by name...",width:"100%",maxW:p?void 0:"30rem",onChange:m=>i(m.target.value)})]}),!p&&e.jsxRuntimeExports.jsx(t.InputGroup,{size:"md",children:e.jsxRuntimeExports.jsx(ae.st,{size:"md",chakraStyles:{container:m=>({...m,width:"100%"})},menuPortalTarget:document.body,placeholder:"Filter use case",isMulti:!0,options:g,onChange:m=>c(m.map(x=>x.value))})})]})},ue=({children:i})=>e.jsxRuntimeExports.jsx(t.FormLabel,{fontWeight:"bold",fontFamily:"sans-serif",fontSize:"large",children:i}),$e=({items:i,onChange:o,selectedItem:c,isDisabled:p,selectedProps:g,buttonProps:m})=>{const x=r=>r===c||r.value===c,j=r=>x(r)?{...m,...g}:m;return e.jsxRuntimeExports.jsx(t.ButtonGroup,{isAttached:!0,isDisabled:p,children:i.map((r,u)=>e.jsxRuntimeExports.jsx(t.Tooltip,{label:r.tooltip,openDelay:50,closeDelay:200,placement:"top",visibility:r.tooltip?"visible":"hidden",hasArrow:!0,children:e.jsxRuntimeExports.jsx(t.Button,{onClick:()=>x(r)?null:o(r,u),isDisabled:r.disabled,...j(r),children:r.label})},u))})},Ce=(i,o)=>o<0?-1*Math.abs(i):Math.abs(i),Ue=({isReversed:i,min:o,max:c,value:p,onChange:g,inputProps:m,size:x,zeroMarker:j,formatValue:r,valueLabel:u,positiveNegativeLabels:h,isDisabled:T,...v})=>{const[w,S]=s.useState([void 0,void 0]),y=w[0],E=w[1],l=j&&o<-5&&c>5,M=Number(p?.[0]??E??o)>0?1:-1,b=Number(p?.[1]??E??c)<0?-1:1,F=h?.[0]===h?.[1],N=p?.[0],O=p?.[1];s.useEffect(()=>{N!==void 0&&O!==void 0&&S([N.toFixed(0),O.toFixed(0)])},[N,O,S]);const L=s.useCallback(([k,$])=>{k<$&&S([k.toFixed(0),$.toFixed(0)])},[S]),I=s.useCallback(([k,$])=>{k<$&&g([k,$])},[g]),Y=s.useCallback(()=>{S(([k,$])=>{const J=isNaN(Number(k))?o:Number(k),z=isNaN(Number($))?c:Number($),H=Ce(Number(J),M),d=Ce(Number(z),b),n=M<0?Math.max(H,o):Math.min(H,c),a=b<0?Math.max(d,o):Math.min(d,c);return n>a?(g([a,n]),[a.toFixed(0),n.toFixed(0)]):(g([n,a]),[n.toFixed(0),a.toFixed(0)])})},[g,S,M,b,o,c]),se=s.useCallback(k=>{const $=k===""||isNaN(Number(k))?k:Ce(Number(k),M);S(([J,z])=>[$.toString(),z])},[S,M]),D=s.useCallback(k=>{const $=k===""||isNaN(Number(k))?k:Ce(Number(k),b);S(([J,z])=>[J,$.toString()])},[S,b]),V=s.useMemo(()=>x==="xs"?"0.75rem":void 0,[x]),X=s.useCallback((k,$)=>{const J=Number($.target.value);if(!y||!E||![-1,1].includes(J))return;const z=n=>J<0?-1*Math.abs(n):Math.abs(n),H=k?z(Number(y)):Number(y),d=k?Number(E):z(Number(E));H>d?g([d,H]):g([H,d])},[y,E,g]);return e.jsxRuntimeExports.jsxs(t.Flex,{direction:"column",...v,children:[e.jsxRuntimeExports.jsx(t.Box,{pt:"1em",mb:"-0.5em",children:e.jsxRuntimeExports.jsxs(t.RangeSlider,{"aria-label":["min","max"],isReversed:i,value:[Number(y??o),Number(E??c)],max:c,min:o,minStepsBetweenThumbs:3,step:1,onChange:L,onChangeEnd:I,isDisabled:T,children:[e.jsxRuntimeExports.jsx(t.RangeSliderMark,{value:o,top:"-1em",children:e.jsxRuntimeExports.jsx(t.Text,{fontSize:x??"sm",fontWeight:"semibold",whiteSpace:"nowrap",children:r?r?.(o):o})}),e.jsxRuntimeExports.jsx(t.RangeSliderMark,{value:c,top:"-1em",children:e.jsxRuntimeExports.jsx(t.Text,{fontSize:x??"sm",fontWeight:"semibold",style:{transform:"translateX(-100%)"},whiteSpace:"nowrap",children:r?r(c):c})}),l&&e.jsxRuntimeExports.jsxs(t.RangeSliderMark,{value:0,top:"-1em",pos:"relative",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:x,fontWeight:"semibold",children:r?.(0)??"0"}),e.jsxRuntimeExports.jsx(t.Box,{position:"absolute",width:"2px",height:"1em",top:"90%",left:"20%",backgroundColor:"var(--chakra-colors-gray-300)"})]}),e.jsxRuntimeExports.jsx(t.RangeSliderTrack,{children:e.jsxRuntimeExports.jsx(t.RangeSliderFilledTrack,{})}),e.jsxRuntimeExports.jsx(t.RangeSliderThumb,{index:0,w:V,h:V}),e.jsxRuntimeExports.jsx(t.RangeSliderThumb,{index:1,w:V,h:V})]})}),u&&e.jsxRuntimeExports.jsxs(t.Flex,{direction:i?"row-reverse":"row",justifyContent:"space-between",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:x??"sm",fontWeight:"semibold",whiteSpace:"nowrap",children:u(o)}),e.jsxRuntimeExports.jsx(t.Text,{fontSize:x??"sm",fontWeight:"semibold",whiteSpace:"nowrap",children:u(c)})]}),e.jsxRuntimeExports.jsxs(t.Flex,{direction:i?"row-reverse":"row",justifyContent:"center",alignItems:"center",gap:"0.125em",children:[h&&e.jsxRuntimeExports.jsxs(t.Select,{width:"auto",size:x,fontWeight:"bold",value:M,onChange:k=>X(!0,k),isDisabled:F||T,children:[e.jsxRuntimeExports.jsx("option",{value:-1,children:h[0]}),e.jsxRuntimeExports.jsx("option",{value:1,children:h[1]})]}),e.jsxRuntimeExports.jsx(t.NumberInput,{precision:0,size:x??"sm",min:0,max:M<0?Math.abs(o):O??c,value:y===""?"":Math.abs(Number(y??o)),onChange:se,onBlur:Y,borderWidth:1,borderRadius:3,borderColor:"#ccc",isDisabled:T,...m,children:e.jsxRuntimeExports.jsx(t.NumberInputField,{backgroundColor:"#fff",paddingRight:0,width:"4em"})}),e.jsxRuntimeExports.jsx(t.NumberInput,{size:x??"sm",min:0,max:b<0?Math.abs(N??o):c,precision:0,value:E===""?"":Math.abs(Number(E??c)),onChange:D,onBlur:Y,borderWidth:1,borderRadius:3,borderColor:"#ccc",isDisabled:T,...m,children:e.jsxRuntimeExports.jsx(t.NumberInputField,{backgroundColor:"#fff",paddingRight:0,width:"4em"})}),h&&e.jsxRuntimeExports.jsxs(t.Select,{width:"auto",size:x,fontWeight:"bold",value:b,onChange:k=>X(!1,k),isDisabled:F||T,children:[e.jsxRuntimeExports.jsx("option",{value:-1,children:h[0]}),e.jsxRuntimeExports.jsx("option",{value:1,children:h[1]})]})]})]})},ze=({tags:i,containerProps:o,...c})=>e.jsxRuntimeExports.jsx(t.HStack,{...o,children:i.map((p,g)=>e.jsxRuntimeExports.jsx(t.Tag,{...c,children:p},g))}),qe=new Pe.uFuzzy({}),We=({action:i,quantumIconSrc:o})=>{const{getLabel:c}=ie.useUiLabelContext(),p=s.useMemo(()=>({actionLowerCase:c("action").toLocaleLowerCase()}),[c]);return i.quantumOwned?e.jsxRuntimeExports.jsx(t.Tooltip,{label:`This ${p.actionLowerCase} is owned by Quantum`,"aria-label":"Quantum owned",children:e.jsxRuntimeExports.jsx(t.Box,{boxSize:"1.5em",borderRadius:"full",bg:"black",display:"flex",alignItems:"center",justifyContent:"center",children:e.jsxRuntimeExports.jsx(t.Image,{src:o,boxSize:"1em",alt:`Quantum-owned ${p.actionLowerCase}`})})}):null},Ke=(i,o)=>{if(!o||!o.trim().length)return i;const c=i.map(g=>g.name??"");return qe.filter(c,o)?.map(g=>i[g])??[]},Qe=i=>!i||i.length===0?"None":i.map(o=>o.replace(/([A-Z])/g," $1").trim()).join(", "),He=(i,o)=>!o||o.length==0?i:i.filter(c=>c.useCases?.some(p=>o.includes(p.id))??!1),Ye=(i,o,c)=>!o||o.length===0?i:i.filter(p=>{const g={};return o.forEach(m=>{for(const[x,j]of Object.entries(c||{}))if(j.some(r=>r.id===m)){g[x]||(g[x]=[]),g[x].push(m);break}}),Object.entries(g).every(([m,x])=>{const j=p.metadataGroups?.find(T=>A.getFragmentData(R.METADATA_GROUP_FRAGMENT,T).key===m);if(!j)return!1;const r=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,j),h=A.getFragmentData(R.METADATA_ITEM_FRAGMENT,r.data).map(T=>T.id);return x.some(T=>h.includes(T))})}),Ie=({actions:i,totalActions:o,onCreate:c,onDelete:p,onEdit:g,onView:m,onSelected:x,onDuplicate:j,disableMultiSelect:r,disableDelete:u,disableEdit:h,disableCreate:T,hideUseCase:v=!0,showMetadataFilters:w=!0,tableProps:S,containerProps:y,quantumIconSrc:E="/favicon.ico"})=>{const[l,M]=s.useState(""),[b,F]=s.useState(),[N,O]=s.useState([]),[L,I]=s.useState({}),{getLabel:Y}=ie.useUiLabelContext(),se=ee.useClient(),D=s.useMemo(()=>({action:Y("action"),actionPlural:Y("action_plural"),actionLowerCase:Y("action").toLocaleLowerCase(),actionPluralLowerCase:Y("action_plural").toLocaleLowerCase()}),[Y]),V=s.useMemo(()=>[{key:"module_category",label:"Link Category",multi:!0},{key:"activity_type",label:`${D.action} Type`,multi:!0},{key:"session_type",label:"Session Type",multi:!0},{key:"body_region",label:"Body Region",multi:!0},{key:"sport",label:"Sport",multi:!0}],[D.action]);s.useEffect(()=>{if(!w)return;const n=V.map(a=>se.query(R.GET_METADATA_BY_KEY,{key:a.key}));Promise.all(n).then(a=>{const C={};a.forEach(q=>{if(q.error||!q.data)return;const K=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,q.data.getMetadataByKey),W=A.getFragmentData(R.METADATA_ITEM_FRAGMENT,K.data);C[K.key]=W.map(B=>({label:B.label||B.value,value:B.value,id:B.id}))}),I(C)})},[se,V,w]);const X=s.useMemo(()=>{if(!i)return;const n=Ke(i,l),a=v?n:He(n,b);return w?Ye(a,N,L):a},[i,l,b,v,w,N,L]),k=s.useCallback(()=>{if(!p)return;const a=i.filter(C=>C.selected&&!C.quantumOwned).map(C=>C.id);p(a)},[i,p]),$=s.useCallback(()=>{if(!j)return;const n=i.filter(a=>a.selected);j(n.map(a=>a.id)),x&&n.forEach(a=>x(a,!1))},[i,j,x]),J=s.useMemo(()=>i.some(n=>n.selected&&!n.quantumOwned),[i]),z=s.useMemo(()=>i.some(n=>n.selected),[i]),H=s.useMemo(()=>i.some(n=>n.selected&&n.quantumOwned),[i]),d=s.useCallback((n,a)=>{const C=V.find(K=>K.key===n);if(!C)return;const q=C.multi?(a??[]).map(K=>K.id):a?[a.id]:[];O(K=>[...K.filter(B=>Object.values(L).flat().find(oe=>oe.id===B)&&!Object.keys(L).find(oe=>L[oe]?.some(de=>de.id===B&&oe===n))),...q])},[V,L]);return e.jsxRuntimeExports.jsxs(t.Box,{...y,children:[e.jsxRuntimeExports.jsxs(t.Flex,{alignContent:"space-between",gap:4,children:[(c||p||j)&&e.jsxRuntimeExports.jsxs(t.ButtonGroup,{mb:"1rem",gap:4,children:[c&&e.jsxRuntimeExports.jsxs(t.Button,{isDisabled:!c||T,colorScheme:"blackAlpha",backgroundColor:"gray.700",onClick:c,children:["Create New ",D.action]}),p&&!r&&e.jsxRuntimeExports.jsx(t.Tooltip,{label:H?J?`Quantum-owned ${D.actionPluralLowerCase} are selected and will be skipped`:`Selected ${D.actionPluralLowerCase} are quantum-owned and cannot be deleted`:void 0,shouldWrapChildren:!0,children:e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"gray",isDisabled:!J||!p||u,onClick:k,children:"Delete Selected"})}),j&&!r&&e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"gray",isDisabled:!z,onClick:$,children:"Duplicate Selected"})]}),e.jsxRuntimeExports.jsx(Be,{setSearch:M,actions:i,updateUseCases:F,hideUseCaseFilter:v})]}),w&&L&&e.jsxRuntimeExports.jsx(t.Box,{my:4,children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4",children:V.map(n=>e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(t.FormLabel,{fontSize:"sm",children:n.label}),e.jsxRuntimeExports.jsx(ae.st,{chakraStyles:{menu:a=>({...a,zIndex:2})},isMulti:n.multi,value:L[n.key]?.filter(a=>N.includes(a.id)),onChange:a=>{d(n.key,a)},options:L[n.key],placeholder:`Select ${n.multi?"one or more":"one"} ${n.label.toLowerCase()}`,isClearable:n.multi})]},n.key))})}),e.jsxRuntimeExports.jsx(t.TableContainer,{mr:"2rem",overflowX:"hidden",...S,children:e.jsxRuntimeExports.jsxs(t.Table,{size:"md",variant:"simple",children:[e.jsxRuntimeExports.jsx(t.Thead,{position:"sticky",top:0,bg:"white",zIndex:1,children:e.jsxRuntimeExports.jsxs(t.Tr,{children:[e.jsxRuntimeExports.jsxs(t.Th,{fontWeight:"normal",children:["(showing ",X?.length??0," of"," ",o??i.length,")"]}),e.jsxRuntimeExports.jsx(t.Th,{children:"Name"}),e.jsxRuntimeExports.jsx(t.Th,{children:"Sensor Locations"}),!v&&e.jsxRuntimeExports.jsx(t.Th,{children:"Use Case"}),e.jsxRuntimeExports.jsx(t.Th,{})]})}),e.jsxRuntimeExports.jsx(t.Tbody,{children:X?.map(n=>e.jsxRuntimeExports.jsxs(t.Tr,{className:Te.cn("hover:bg-[#f7f7f7]",!r&&"cursor-pointer",n.selected&&"bg-gray-200"),onClick:()=>{r||x?.(n,!n.selected)},children:[e.jsxRuntimeExports.jsx(t.Td,{children:e.jsxRuntimeExports.jsxs(t.Flex,{children:[!r&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n.selected?e.jsxRuntimeExports.jsx(Me.FaCheckSquare,{className:"text-blue-500"}):e.jsxRuntimeExports.jsx(Me.FaSquare,{className:"text-gray-400"})}),(n.quantumOwned||!g)&&m&&e.jsxRuntimeExports.jsx(t.Button,{ml:"1em",size:"sm",variant:"link",colorScheme:"blue",onClick:a=>{a.stopPropagation(),m(n.id)},children:"View"}),!n.quantumOwned&&g&&e.jsxRuntimeExports.jsx(t.Button,{isDisabled:h,ml:"1em",size:"sm",variant:"link",colorScheme:"blue",onClick:a=>{a.stopPropagation(),g(n.id)},children:"Edit"})]})}),e.jsxRuntimeExports.jsx(t.Td,{whiteSpace:"break-spaces",children:e.jsxRuntimeExports.jsxs(t.Flex,{align:"center",gap:2,children:[e.jsxRuntimeExports.jsx(We,{action:n,quantumIconSrc:E}),n.name]})}),e.jsxRuntimeExports.jsx(t.Td,{maxW:"20rem",whiteSpace:"break-spaces",children:Qe(n.sensorLocations)}),!v&&e.jsxRuntimeExports.jsx(t.Td,{maxW:"20rem",children:e.jsxRuntimeExports.jsx(ze,{containerProps:{flexWrap:"wrap"},tags:n.useCases?.map(a=>a.name)??[]})})]},n.id))})]})})]})},Je=({onSave:i,onCancel:o,onError:c,hideButtons:p=!1,setButtonDisabled:g,setButtonOnClick:m,quantumOwned:x})=>{const j=t.useToast(),{getLabel:r}=ie.useUiLabelContext(),u=s.useMemo(()=>({singular:r("action"),plural:r("action_plural"),pluralLowerCase:r("action_plural").toLowerCase(),singularLowerCase:r("action").toLowerCase()}),[r]),[h,T]=s.useState("copy"),[v,w]=s.useState(""),[S,y]=s.useState([]),[E,l]=s.useState(!1),[M]=ee.useQuery({query:R.GET_GROUPS}),[b]=ee.useQuery({query:R.GET_ACTIONS_BY_GROUP,variables:{groupId:v},pause:!v}),[,F]=ee.useMutation(R.CREATE_ACTION),[,N]=ee.useMutation(R.CONVERT_ACTION_TO_QUANTUM_OWNED),O=s.useMemo(()=>M.data?.groups?M.data.groups.map(d=>A.getFragmentData(R.GROUP_FRAGMENT,d)):[],[M.data]),L=s.useMemo(()=>b.data?b.data.actions.map(n=>{const a=A.getFragmentData(R.ACTION_FRAGMENT,n),C=A.getFragmentData(R.REPORT_FRAGMENT,a.reports),q=A.getFragmentData(R.MODULE_CATEGORY_FRAGMENT,a.categories),W=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,a.metadataGroups).map(B=>({...B,data:B.data.map(Q=>A.getFragmentData(R.METADATA_ITEM_FRAGMENT,Q))}));return{...a,thresholds:A.getFragmentData(R.THRESHOLD_FRAGMENT,a.thresholds),reports:C.map(B=>({...B,thresholds:A.getFragmentData(R.THRESHOLD_FRAGMENT,B.thresholds)})),categories:q,metadataGroups:W}}):[],[b.data]),I=s.useMemo(()=>L.filter(d=>S.includes(d.id)),[L,S]),Y=s.useCallback(d=>{const n=d?.value||"";w(n),y([])},[]),se=s.useCallback(d=>{const n=d.map(a=>a.value);y(n)},[]),D=s.useCallback(async d=>{const n={...d,name:`${d.name} (Copy)`,description:d.description||void 0,instructionsPointOfInterest:d.instructionsPointOfInterest||void 0,instructionsMovementReport:d.instructionsMovementReport||void 0,laterality:d.laterality,activityKind:d.activityKind,sensorLocations:d.sensorLocations,thresholds:d.thresholds.map(C=>({...C,id:void 0})),categories:d.categories.map(C=>C.id),quantumOwned:x,metadataItemIds:d.metadataGroups.flatMap(C=>C.data.map(q=>q.id)).filter(C=>C!==void 0),reports:d.reports.map(C=>({...C,id:void 0,thresholds:C.thresholds.map(q=>({...q,id:void 0}))})),id:void 0},a=await F({fields:n});if(a.error)throw new Error(a.error.message);if(a.data?.createAction)return A.getFragmentData(R.ACTION_FRAGMENT,a.data.createAction);throw new Error("No action data returned")},[F,x]),V=s.useCallback(async d=>{const n=await N({id:d.id});if(n.error)throw new Error(n.error.message);if(n.data?.convertActionToQuantumOwned)return A.getFragmentData(R.ACTION_FRAGMENT,n.data.convertActionToQuantumOwned);throw new Error("No action data returned")},[N]),X=s.useCallback(async()=>{if(l(!0),!I.length){const d=new Error(`No ${u.pluralLowerCase} selected for ${h==="copy"?"copying":"converting"}`);c?.(d),l(!1);return}try{const d=[];let n=0;const a=h==="copy"?D:V,C=h==="copy"?"copy":"convert";for(const q of I)try{const K=await a(q);d.push(K)}catch(K){console.error(`Failed to ${C} ${u.singularLowerCase} "${q.name}":`,K),n++}if(d.length>0){const q=d.length,K=I.length,W=h==="copy"?"copied":"converted",B=h==="copy"?"copy":"convert";j({title:n>0?`Partial ${B} completed`:`${u.plural} ${W} successfully`,description:n>0?`${q} of ${K} ${u.pluralLowerCase} ${W} successfully`:`${q} ${q>1?u.pluralLowerCase:u.singularLowerCase} ${W} successfully`,status:n>0?"warning":"success",duration:3e3,isClosable:!0}),i?.(),w(""),y([])}else throw new Error(`Failed to ${C} any ${u.pluralLowerCase}`)}catch(d){const n=h==="copy"?"copy":"convert",a=d instanceof Error?d.message:`Failed to ${n} ${u.pluralLowerCase}`;j({title:`${h==="copy"?"Copy":"Convert"} failed`,description:a,status:"error",duration:5e3,isClosable:!0}),c?.(d instanceof Error?d:new Error(a))}finally{l(!1)}},[I,h,D,V,j,i,c,u]),k=s.useCallback(()=>{w(""),y([]),T("copy"),o?.()},[o]);s.useEffect(()=>{g&&g({cancelButton:!1,saveButton:I.length===0||E})},[I.length,E,g]),s.useEffect(()=>{m&&m({cancelButton:k,saveButton:X})},[m,k,X]);const $=s.useMemo(()=>O.map(d=>({value:d.id,label:d.name})),[O]),J=s.useMemo(()=>L.filter(d=>h==="copy"?!0:!d.quantumOwned).map(d=>({value:d.id,label:d.name,isQuantumOwned:d.quantumOwned})),[L,h]),z=M.fetching,H=b.fetching;return e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsxs(t.VStack,{spacing:6,align:"stretch",children:[x&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ue,{children:"Operation Mode"}),e.jsxRuntimeExports.jsx(t.RadioGroup,{value:h,onChange:d=>{T(d),y([])},children:e.jsxRuntimeExports.jsxs(t.HStack,{spacing:6,children:[e.jsxRuntimeExports.jsx(t.Radio,{value:"copy",colorScheme:"blue",children:e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",children:["Copy ",u.plural]}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Create new ",u.plural.toLocaleLowerCase()," ","based on selected ones"]})]})}),e.jsxRuntimeExports.jsx(t.Radio,{value:"convert",colorScheme:"green",children:e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",children:["Convert to Quantum Owned ",u.singular]}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Convert existing"," ",u.plural.toLocaleLowerCase()," to quantum-owned"]})]})})]})})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ue,{children:"Select Source Group"}),e.jsxRuntimeExports.jsx(ae.st,{placeholder:"Choose a group...",options:$,value:$.find(d=>d.value===v)||null,onChange:Y,isLoading:z,isDisabled:z,isClearable:!0}),M.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load groups: ",M.error.message]})]})]}),v&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsxs(ue,{children:["Select ",u.plural," to"," ",h==="copy"?"Copy":"Convert"]}),H?e.jsxRuntimeExports.jsxs(t.HStack,{children:[e.jsxRuntimeExports.jsx(t.Spinner,{size:"sm"}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Loading ",u.pluralLowerCase,"..."]})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(ae.st,{placeholder:`Choose ${u.pluralLowerCase} to ${h}...`,options:J,value:J.filter(d=>S.includes(d.value)),onChange:se,isDisabled:J.length===0,isClearable:!0,isMulti:!0,closeMenuOnSelect:!1,formatOptionLabel:(d,{context:n})=>e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",w:"100%",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(t.Text,{children:d.label}),n==="value"&&d.isQuantumOwned&&e.jsxRuntimeExports.jsx(t.Text,{color:"blue",fontSize:"xs",children:"(Quantum Owned)"})]}),d.isQuantumOwned&&n==="menu"&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]})}),J.length===0&&e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.500",mt:2,children:["No ",u.pluralLowerCase," found"]})]}),b.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load ",u.pluralLowerCase,":"," ",b.error.message]})]})]}),I.length>0&&e.jsxRuntimeExports.jsxs(t.Box,{p:4,bg:"gray.50",borderRadius:"md",children:[e.jsxRuntimeExports.jsx(t.Text,{fontWeight:"semibold",mb:3,children:I.length===1?`${u.singular} to ${h==="copy"?"Copy":"Convert"}:`:`${I.length} ${u.plural} to ${h==="copy"?"Copy":"Convert"}:`}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:3,children:[I.map((d,n)=>e.jsxRuntimeExports.jsxs(t.Box,{w:"100%",p:3,bg:"white",borderRadius:"md",border:"1px solid",borderColor:"gray.200",children:[e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",align:"start",mb:2,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",fontSize:"sm",children:[n+1,". ",d.name]}),d.quantumOwned&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,fontSize:"sm",color:"gray.600",children:[d.description&&e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Description:"})," ",d.description]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Type:"})," ",d.activityKind]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Laterality:"})," ",d.laterality]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Sensor Locations:"})," ",d.sensorLocations.length]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Thresholds:"})," ",d.thresholds.length]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Use Cases:"})," ",d.useCases.map(a=>a.name).join(", ")||"None"]})]})]},d.id)),I.length>1&&e.jsxRuntimeExports.jsx(t.Box,{w:"100%",p:2,bg:"blue.50",borderRadius:"md",border:"1px solid",borderColor:"blue.200",children:e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",fontWeight:"medium",color:"blue.800",children:["Total: ",I.length," ",u.pluralLowerCase," will be"," ",h==="copy"?"copied":"converted"]})})]})]}),!p&&e.jsxRuntimeExports.jsxs(t.ButtonGroup,{spacing:4,justifyContent:"flex-end",children:[e.jsxRuntimeExports.jsx(t.Button,{variant:"outline",onClick:k,isDisabled:E,children:"Cancel"}),e.jsxRuntimeExports.jsxs(t.Button,{colorScheme:h==="copy"?"blue":"green",onClick:X,isDisabled:I.length===0||E,isLoading:E,loadingText:`${h==="copy"?"Copying":"Converting"}...`,children:[h==="copy"?"Copy":"Convert"," ",I.length===1?u.singular:`${I.length} ${u.plural}`]})]})]})})},Ve=({onSave:i,onCancel:o,onError:c,hideButtons:p=!1,setButtonDisabled:g,setButtonOnClick:m,quantumOwned:x})=>{const j=t.useToast(),{getLabel:r}=ie.useUiLabelContext(),u=s.useMemo(()=>({singular:r("module"),plural:r("module_plural"),pluralLowerCase:r("module_plural").toLowerCase(),singularLowerCase:r("module").toLowerCase()}),[r]),h=s.useMemo(()=>({singular:r("action"),plural:r("action_plural"),pluralLowerCase:r("action_plural").toLowerCase(),singularLowerCase:r("action").toLowerCase()}),[r]),[T,v]=s.useState(""),[w,S]=s.useState([]),[y,E]=s.useState(!1),[l,M]=s.useState("copy"),[b]=ee.useQuery({query:R.GET_GROUPS}),[F]=ee.useQuery({query:R.GET_MODULES_BY_GROUP,variables:{groupId:T},pause:!T}),[,N]=ee.useMutation(R.CREATE_MODULE),[,O]=ee.useMutation(R.UPDATE_MODULE),[,L]=ee.useMutation(R.CREATE_ACTION),[,I]=ee.useMutation(R.CONVERT_ACTION_TO_QUANTUM_OWNED),Y=s.useMemo(()=>b.data?.groups?b.data.groups.map(n=>A.getFragmentData(R.GROUP_FRAGMENT,n)):[],[b.data]),se=s.useMemo(()=>F.data?.modules?A.getFragmentData(R.ACTION_MODULE_FRAGMENT,F.data?.modules).map(a=>{const C=A.getFragmentData(R.MODULE_ACTION_FRAGMENT,a.moduleActions),K=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,a.metadataGroups).map(W=>A.getFragmentData(R.METADATA_ITEM_FRAGMENT,W.data)).flat();return{...a,moduleActions:C.map(W=>({...W,action:A.getFragmentData(R.ACTION_FRAGMENT,W.action)})),categories:A.getFragmentData(R.MODULE_CATEGORY_FRAGMENT,a.categories),metadataItems:K}}):[],[F.data]),D=s.useMemo(()=>se.filter(n=>w.includes(n.id)),[se,w]),V=s.useCallback(n=>{const a=n?.value||"";v(a),S([])},[]),X=s.useCallback(n=>{const a=n.map(C=>C.value);S(a)},[]),k=s.useCallback(async()=>{if(E(!0),!D.length){E(!1);const n=new Error(`No modules selected for ${l==="convert"?"converting":"copying"}`);c?.(n);return}try{const n=[];let a=0;for(const C of D)try{let q=C.moduleActions.map(K=>K.actionId);if(x){const K=C.moduleActions.map(Q=>Q.action),W=async Q=>{if(l==="copy"){if(Q.quantumOwned)return Q;const de=A.getFragmentData(R.MODULE_CATEGORY_FRAGMENT,Q.categories),je=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,Q.metadataGroups).map(le=>A.getFragmentData(R.METADATA_ITEM_FRAGMENT,le.data).map(ge=>ge.id)).flat(),fe=A.getFragmentData(R.REPORT_FRAGMENT,Q.reports).map(le=>({...le,id:void 0,thresholds:A.getFragmentData(R.THRESHOLD_FRAGMENT,le.thresholds).map(ge=>({...ge,id:void 0}))})),ve=A.getFragmentData(R.THRESHOLD_FRAGMENT,Q.thresholds).map(le=>({...le,id:void 0})),he={...Q,quantumOwned:!0,thresholds:ve,categories:de?.map(le=>le.id),reports:fe,metadataIds:je,id:void 0},xe=await L({fields:he});return xe.error||!xe.data?.createAction?null:A.getFragmentData(R.ACTION_FRAGMENT,xe.data.createAction)}if(Q.quantumOwned)return Q;const oe=await I({id:Q.id});return oe.error||!oe.data?.convertActionToQuantumOwned?null:A.getFragmentData(R.ACTION_FRAGMENT,oe.data.convertActionToQuantumOwned)};q=(await Promise.all(K.map(W))).filter(Q=>!!Q?.id).map(Q=>Q.id)}if(l==="convert"){const K={name:C.name,description:C.description||void 0,actions:q,categories:C.categories.map(B=>B.id),quantumOwned:!0},W=await O({id:C.id,input:K});if(W.error)throw new Error(W.error.message);if(W.data?.updateModule){const B=A.getFragmentData(R.ACTION_MODULE_FRAGMENT,W.data.updateModule);n.push(B)}}else{const K={name:`${C.name} (Copy)`,description:C.description||void 0,actions:q,categories:C.categories.map(B=>B.id),quantumOwned:x,metadataItemIds:C.metadataItems.map(B=>B.id),actionReports:C.moduleActions.filter(B=>!!B.reportId).map(B=>({actionId:B.actionId,reportId:B.reportId}))},W=await N({input:K});if(W.error)throw new Error(W.error.message);if(W.data?.createModule){const B=A.getFragmentData(R.ACTION_MODULE_FRAGMENT,W.data.createModule);n.push(B)}}}catch(q){console.error(`Failed to ${l==="convert"?"convert":"copy"} module "${C.name}":`,q),a++}if(n.length>0){const C=n.length,q=D.length;j({title:a>0?`Partial ${l==="convert"?"convert":"copy"} completed`:`${u.plural} ${l==="convert"?"converted":"copied"} successfully`,description:a>0?`${C} of ${q} ${u.plural} ${l==="convert"?"converted":"copied"} successfully`:`${C} ${C>1?u.plural:u.singular} ${l==="convert"?"converted":"copied"} successfully`,status:a>0?"warning":"success",duration:3e3,isClosable:!0}),n.length>0&&i?.(),v(""),S([])}else throw new Error(`Failed to ${l==="convert"?"convert":"copy"} any modules`)}catch(n){const a=n instanceof Error?n.message:`Failed to ${l==="convert"?"convert":"copy"} modules`;j({title:l==="convert"?"Convert failed":"Copy failed",description:a,status:"error",duration:5e3,isClosable:!0}),c?.(n instanceof Error?n:new Error(a))}finally{E(!1)}},[D,N,O,j,i,c,x,L,I,l,u]),$=s.useCallback(()=>{v(""),S([]),M("copy"),o?.()},[o]);s.useEffect(()=>{g&&g({cancelButton:!1,saveButton:D.length===0||y})},[D.length,y,g]),s.useEffect(()=>{m&&m({cancelButton:$,saveButton:k})},[m,$,k]);const J=s.useMemo(()=>Y.map(n=>({value:n.id,label:n.name})),[Y]),z=s.useMemo(()=>se.filter(n=>l==="copy"?!0:!n.quantumOwned).map(n=>({value:n.id,label:n.name,isQuantumOwned:n.quantumOwned})),[se,l]),H=b.fetching,d=F.fetching;return e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsxs(t.VStack,{spacing:6,align:"stretch",children:[x&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ue,{children:"Operation Mode"}),e.jsxRuntimeExports.jsx(t.RadioGroup,{value:l,onChange:n=>{M(n),S([])},children:e.jsxRuntimeExports.jsxs(t.HStack,{spacing:6,children:[e.jsxRuntimeExports.jsx(t.Radio,{value:"copy",colorScheme:"blue",children:e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",children:["Copy ",u.plural]}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Create new ",u.pluralLowerCase," based on selected ones"]})]})}),e.jsxRuntimeExports.jsx(t.Radio,{value:"convert",colorScheme:"green",children:e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,children:[e.jsxRuntimeExports.jsx(t.Text,{fontWeight:"medium",children:"Convert to Quantum Owned"}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Convert existing ",u.pluralLowerCase," to quantum-owned"]})]})})]})})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ue,{children:"Select Source Group"}),e.jsxRuntimeExports.jsx(ae.st,{placeholder:"Choose a group...",options:J,value:J.find(n=>n.value===T)||null,onChange:V,isLoading:H,isDisabled:H,isClearable:!0}),b.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load groups: ",b.error.message]})]})]}),T&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ue,{children:l==="convert"?`Select ${u.plural} to Convert`:`Select ${u.plural} to Copy`}),d?e.jsxRuntimeExports.jsxs(t.HStack,{children:[e.jsxRuntimeExports.jsx(t.Spinner,{size:"sm"}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Loading ",u.pluralLowerCase,"..."]})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(ae.st,{placeholder:l==="convert"?`Choose ${u.pluralLowerCase} to convert...`:`Choose ${u.pluralLowerCase} to copy...`,options:z,value:z.filter(n=>w.includes(n.value)),onChange:X,isDisabled:z.length===0,isClearable:!0,isMulti:!0,closeMenuOnSelect:!1,formatOptionLabel:(n,{context:a})=>e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",w:"100%",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(t.Text,{children:n.label}),a==="value"&&n.isQuantumOwned&&e.jsxRuntimeExports.jsx(t.Text,{color:"blue",fontSize:"xs",children:"(Quantum Owned)"})]}),n.isQuantumOwned&&a==="menu"&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]})}),z.length===0&&e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.500",mt:2,children:["No ",u.pluralLowerCase," found in this group"]})]}),F.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load ",u.pluralLowerCase,":"," ",F.error.message]})]})]}),D.length>0&&e.jsxRuntimeExports.jsxs(t.Box,{p:4,bg:"gray.50",borderRadius:"md",children:[e.jsxRuntimeExports.jsx(t.Text,{fontWeight:"semibold",mb:3,children:D.length===1?`${u.singular} to ${l==="copy"?"Copy":"Convert"}`:`${D.length} ${u.plural} to ${l==="copy"?"Copy":"Convert"}`}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:3,children:[D.map((n,a)=>e.jsxRuntimeExports.jsxs(t.Box,{w:"100%",p:3,bg:"white",borderRadius:"md",border:"1px solid",borderColor:"gray.200",children:[e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",align:"start",mb:2,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",fontSize:"sm",children:[a+1,". ",n.name]}),n.quantumOwned&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,fontSize:"sm",color:"gray.600",children:[n.description&&e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Description:"})," ",n.description]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Activities:"})," ",n.moduleActions.length]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Categories:"})," ",n.categories.map(C=>C.name).join(", ")||"None"]})]})]},n.id)),D.length>1&&e.jsxRuntimeExports.jsx(t.Box,{w:"100%",p:2,bg:"blue.50",borderRadius:"md",border:"1px solid",borderColor:"blue.200",children:e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",fontWeight:"medium",color:"blue.800",children:["Total: ",D.length," ",u.pluralLowerCase," will be"," ",l==="copy"?"copied":"converted"]})}),x&&D.filter(n=>n.moduleActions.some(a=>!a.action.quantumOwned)).length>0&&e.jsxRuntimeExports.jsx(t.Box,{p:2,bg:"yellow.50",borderRadius:"md",border:"1px solid",borderColor:"yellow.200",children:e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",fontWeight:"medium",color:"yellow.800",children:l==="convert"?`Converting ${u.plural} will convert non QM-Owned ${h.plural} to QM-Owned ${h.plural}`:`Copying ${u.plural} with Non QM-Owned ${h.plural} will create corresponding QM-Owned ${h.plural}`})})]})]}),!p&&e.jsxRuntimeExports.jsxs(t.ButtonGroup,{spacing:4,justifyContent:"flex-end",children:[e.jsxRuntimeExports.jsx(t.Button,{variant:"outline",onClick:$,isDisabled:y,children:"Cancel"}),e.jsxRuntimeExports.jsxs(t.Button,{colorScheme:l==="copy"?"blue":"green",onClick:k,isDisabled:D.length===0||y,isLoading:y,loadingText:`${l==="copy"?"Copying":"Converting"}...`,children:[l==="copy"?"Copy":"Convert"," ",D.length===1?u.singular:`${D.length} ${u.plural}`]})]})]})})},ke=s.createContext(void 0),Re=()=>{const i=s.useContext(ke);if(!i)throw new Error("useUpsertModuleFormContext must be used within a UpsertModuleFormProvider");return i},Ne=({name:i,setName:o,actions:c,selectedActionIds:p,setSelectedActionIds:g,availableCategories:m,selectedCategoryIds:x,setSelectedCategoryIds:j,description:r,setDescription:u,selectedMetadataIds:h,setSelectedMetadataIds:T,actionReportIds:v,setActionReportIds:w,...S})=>{const y=t.useDisclosure(),E=s.useMemo(()=>c.map(O=>({...O,selected:p.includes(O.id)})),[c,p]),l=s.useMemo(()=>c.reduce((O,L)=>(O[L.id]=L,O),{}),[c]),M=s.useMemo(()=>p.map(O=>l[O]),[p,l]),b=s.useCallback((O,L)=>{g(L?[...p,O.id]:p.filter(I=>I!==O.id))},[p,g]),F=s.useCallback(O=>{o(O.target.value)},[o]),N=s.useCallback(O=>{u?.(O.target.value)},[u]);return e.jsxRuntimeExports.jsxs(t.Box,{...S,children:[e.jsxRuntimeExports.jsxs(t.HStack,{gap:"2rem",children:[e.jsxRuntimeExports.jsx(Xe,{name:i??"",onInputChange:F}),e.jsxRuntimeExports.jsx(Ze,{availableCategories:m,value:x,onChange:j})]}),e.jsxRuntimeExports.jsx(et,{description:r??"",onInputChange:N}),e.jsxRuntimeExports.jsx(ot,{selectedMetadataIds:h,setSelectedMetadataIds:T}),e.jsxRuntimeExports.jsx(tt,{value:M,onChange:g,onAdjustActivities:()=>y.onOpen(),actionReportIds:v,setActionReportIds:w}),e.jsxRuntimeExports.jsxs(t.Modal,{isOpen:y.isOpen,onClose:y.onClose,size:"6xl",children:[e.jsxRuntimeExports.jsx(t.ModalOverlay,{}),e.jsxRuntimeExports.jsxs(t.ModalContent,{children:[e.jsxRuntimeExports.jsx(t.ModalHeader,{children:"Select Activities"}),e.jsxRuntimeExports.jsx(t.ModalCloseButton,{}),e.jsxRuntimeExports.jsx(t.ModalBody,{children:e.jsxRuntimeExports.jsx(Ie,{actions:E,onSelected:b,disableCreate:!0,disableDelete:!0,tableProps:{height:"28rem",overflowY:"auto"}})}),e.jsxRuntimeExports.jsx(t.ModalFooter,{children:e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",onClick:y.onClose,isDisabled:p.length===0,children:"Done"})})]})]})]})},Xe=s.memo(({name:i,onInputChange:o})=>{const{getLabel:c}=ie.useUiLabelContext(),p=c("module"),{isView:g}=Re();return e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsxs(ue,{children:[p," Name"]}),e.jsxRuntimeExports.jsx(t.Input,{placeholder:"i.e. ACL RTP Test Battery",value:i,onChange:o,isRequired:!0,isDisabled:g})]})}),Ze=s.memo(({availableCategories:i,value:o,onChange:c})=>{const{getLabel:p}=ie.useUiLabelContext(),g=p("module"),{isView:m}=Re(),x=s.useMemo(()=>[...i,{id:"other",name:"Other"}],[i]),j=s.useMemo(()=>x.map(r=>({value:r.id,label:r.name})),[x]);return e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsxs(ue,{children:[g," Category"]}),e.jsxRuntimeExports.jsx(ae.st,{isDisabled:i.length===0||m,options:j,value:o.length===0?{value:"other",label:"Other"}:x.filter(r=>o.includes(r.id)).map(r=>({value:r.id,label:r.name}))[0],onChange:r=>c(r?[r.value]:[]),placeholder:"Select category"})]})}),et=s.memo(({description:i,onInputChange:o})=>{const{getLabel:c}=ie.useUiLabelContext(),p=c("module"),{isView:g}=Re();return e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsx(ue,{children:e.jsxRuntimeExports.jsxs("span",{children:["Description",e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.500",children:["Briefly describe the objective of this"," ",p.toLocaleLowerCase(),". Max 40 words."]})]})}),e.jsxRuntimeExports.jsx(t.Input,{placeholder:"i.e. Assess readiness to return to play post-ACL reconstruction",value:i,onChange:o,isDisabled:g})]})}),tt=s.memo(({value:i,onChange:o,onAdjustActivities:c,actionReportIds:p,setActionReportIds:g})=>{const{getLabel:m}=ie.useUiLabelContext(),{isView:x}=Re(),j=s.useMemo(()=>({module:m("module"),moduleLowerCase:m("module").toLocaleLowerCase(),action:m("action"),actionPlural:m("action_plural"),actionPluralLowerCase:m("action_plural").toLocaleLowerCase()}),[m]),r=s.useMemo(()=>i.filter(u=>!!u?.id).map(u=>({id:u.id,name:u.name,reports:A.getFragmentData(R.REPORT_FRAGMENT,u.reports)||[],selectedReportId:p[u.id]||null})),[i,p]);return e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsxs(t.HStack,{justifyContent:"space-between",children:[e.jsxRuntimeExports.jsx(ue,{children:e.jsxRuntimeExports.jsxs("span",{children:[j.actionPlural,!x&&e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.500",children:["Drag and drop to reorder the ",j.actionPluralLowerCase," ","in this ",j.moduleLowerCase,"."]})]})}),!x&&e.jsxRuntimeExports.jsxs(t.Button,{size:"sm",variant:"solid",colorScheme:"blue",onClick:c,children:["Add / Remove ",j.actionPlural]})]}),r.length===0?e.jsxRuntimeExports.jsx(t.VStack,{children:e.jsxRuntimeExports.jsxs(t.Text,{color:"gray.500",fontSize:"lg",mb:"4rem",mt:"4rem",children:["No ",j.actionPluralLowerCase," selected for this"," ",j.moduleLowerCase,".",!x&&e.jsxRuntimeExports.jsxs(t.Button,{ml:"0.5em",size:"sm",variant:"link",colorScheme:"blue",onClick:c,children:["Add ",j.actionPluralLowerCase,"."]})]})}):e.jsxRuntimeExports.jsx(st,{value:r,onChange:u=>{const h=u(r);o(h.map(T=>T.id))},disabled:x,actionReportIds:p,setActionReportIds:g})]})}),st=s.memo(({value:i,onChange:o,disabled:c,actionReportIds:p,setActionReportIds:g})=>{const[m]=s.useState(()=>Math.random().toString(36).substring(2,15)),x=s.useCallback((j,r)=>{c||o(u=>{const h=[...u],[T]=h.splice(j,1);return h.splice(r,0,T),h})},[o,c]);return e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsx(Se.DndProvider,{backend:Se.HTML5Backend,children:e.jsxRuntimeExports.jsx(t.VStack,{spacing:3,align:"stretch",children:i.map((j,r)=>e.jsxRuntimeExports.jsx(nt,{listKey:m,item:j,index:r,disabled:!!c,move:x,onReportChange:u=>{g({...p,[j.id]:u})}},j.id))})})})}),nt=s.memo(({listKey:i,item:o,index:c,disabled:p,move:g,onReportChange:m})=>{const x=s.useRef(null),{getLabel:j}=ie.useUiLabelContext(),r=j("action"),[{handlerId:u},h]=Se.useDrop({accept:i,collect:l=>({handlerId:l.getHandlerId()?.toString()??""}),hover:(l,M)=>{if(!x.current)return;const b=l.index,F=c;if(b===F)return;const N=x.current?.getBoundingClientRect(),O=(N.bottom-N.top)/2,I=M.getClientOffset().y-N.top;b<F&&I<O||b>F&&I>O||(g(b,F),l.index=F)}}),[{isDragging:T},v]=Se.useDrag({type:i,item:()=>({id:o.id,index:c}),collect:l=>({isDragging:l.isDragging()}),canDrag:!p}),w=s.useMemo(()=>`action-report-label-${o.id}`,[o.id]),S=s.useMemo(()=>[{value:null,label:"No Report"},...o.reports.map(l=>{const M=l.name&&l.name.length>0?l.name:"No Name",b=me.reportKindName(l.reportKind);return{value:l.id,label:`${M} (${b})`}})],[o.reports]),y=T?.6:1,E=p?"default":T?"grabbing":"grab";return v(h(x)),e.jsxRuntimeExports.jsx(t.Box,{ref:x,p:3,border:"1px solid",borderColor:"gray.200",borderRadius:"md",bg:"gray.50",style:{opacity:y,cursor:E},"data-handler-id":u,children:e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",align:"center",children:[e.jsxRuntimeExports.jsxs(t.HStack,{spacing:3,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"semibold",minW:"2rem",children:[c+1,"."]}),e.jsxRuntimeExports.jsx(t.Text,{fontWeight:"medium",children:o.name})]}),e.jsxRuntimeExports.jsxs(t.HStack,{spacing:3,align:"center",children:[e.jsxRuntimeExports.jsxs(t.Text,{id:w,fontSize:"sm",color:"gray.600",children:[r," Report:"]}),e.jsxRuntimeExports.jsx(t.Box,{width:{base:"100%",md:"450px"},children:e.jsxRuntimeExports.jsx(ae.st,{"aria-labelledby":w,value:S.find(l=>l.value===o.selectedReportId),onChange:l=>{m(l?.value||null)},options:S,placeholder:"Select report...",isDisabled:p})})]})]})})}),ot=s.memo(({selectedMetadataIds:i,setSelectedMetadataIds:o})=>{const{getLabel:c}=ie.useUiLabelContext(),{isView:p,metadataOptions:g}=Re(),m=s.useMemo(()=>[{key:"activity_type",label:`${c("action")} Type`,multi:!0},{key:"session_type",label:"Session Type",multi:!0},{key:"body_region",label:"Body Region",multi:!0},{key:"sport",label:"Sport",multi:!0}],[c]),x=s.useCallback((j,r)=>{const u=m.find(T=>T.key===j);if(!u)return;const h=u.multi?(r??[]).map(T=>T.id):r?[r.id]:[];o(T=>[...T.filter(w=>Object.values(g||{}).flat().find(y=>y.id===w)&&!Object.keys(g||{}).find(y=>g?.[y]?.some(E=>E.id===w&&y===j))),...h])},[m,g,o]);return g?e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsx(ue,{children:"Metadata Tags"}),e.jsxRuntimeExports.jsx(t.HStack,{gap:"1rem",align:"start",children:m.map(j=>e.jsxRuntimeExports.jsxs(t.FormControl,{flex:"1",children:[e.jsxRuntimeExports.jsx(t.FormLabel,{fontSize:"sm",children:j.label}),e.jsxRuntimeExports.jsx(ae.st,{isMulti:j.multi,value:g[j.key]?.filter(r=>i.includes(r.id)),onChange:r=>{x(j.key,r)},options:g[j.key],placeholder:`Select ${j.multi?"one or more":"one"} ${j.label.toLowerCase()}`,isDisabled:p,isClearable:j.multi})]},j.key))})]}):null}),Oe=({value:i,onChange:o,forceKind:c,disableRemove:p,disableKind:g,isDisabled:m,lockRanges:x,...j})=>{const r=s.useMemo(()=>[...i].sort((v,w)=>{const S=pe.availablePlanes.indexOf(v.plane),y=pe.availablePlanes.indexOf(w.plane);return S-y}),[i]),u=s.useCallback(v=>"segment"in v.id?ce.getSegmentNameWithPlane(v.id.segment,v.plane,!0)??"Unknown":ce.getJointNameWithPlane(v.id.joint,v.plane,!0)??"Unknown",[]),h=s.useCallback((v,w)=>{const S=r.findIndex(E=>E.id===w.id&&E.plane===w.plane);let y=[...r];c&&(w={...w,kind:c}),y[S]=w,x&&(y=y.map(E=>({...E,min:w.min,max:w.max}))),o(y)},[o,r,c,x]),T=s.useCallback(v=>{const w=r.filter(S=>S.id!==v.id||S.plane!==v.plane);o(w)},[o,r]);return e.jsxRuntimeExports.jsx(t.VStack,{alignItems:"flex-start",overflowY:"auto",...j,children:r.map((v,w)=>e.jsxRuntimeExports.jsx(rt,{label:u(v),parameter:v,onChange:S=>h(w,S),onRemove:p||m?void 0:()=>T(v),forceKind:c,disableKind:g||m,isDisabled:m},`${JSON.stringify(v.id)}-${v.plane}`))})},rt=({label:i,parameter:o,onChange:c,onRemove:p,forceKind:g,disableKind:m,isDisabled:x})=>{const j=s.useCallback(h=>"joint"in o.id?ce.getJointAngleDirectionName(o.id.joint,o.plane,h<0?-1:1):ce.getSegmentAngleDirectionName(o.id.segment,o.plane,h<0?-1:1),[o]),{min:r,max:u}="joint"in o.id?ce.getNormativeJointRange(o.id.joint,o.plane):{min:-180,max:180};return e.jsxRuntimeExports.jsxs(t.VStack,{borderRadius:"md",p:2,px:4,bg:"gray.100",w:"100%",overflow:"hidden",flexShrink:"0",children:[e.jsxRuntimeExports.jsxs(t.HStack,{w:"100%",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",flex:1,textTransform:"capitalize",fontWeight:"semibold",children:i}),o.sensorOnly&&e.jsxRuntimeExports.jsx(t.Badge,{size:"sm",colorScheme:"orange",variant:"subtle",children:"Sensor Only"}),p&&!x&&e.jsxRuntimeExports.jsx(t.IconButton,{size:"xs",variant:"ghost","aria-label":"delete",icon:e.jsxRuntimeExports.jsx(t.Icon,{as:Me.FaTrash}),onClick:p}),!g&&e.jsxRuntimeExports.jsx($e,{selectedItem:o?.kind??_.ThresholdKind.Limit,onChange:({value:h})=>c({...o,kind:h}),isDisabled:m||x,buttonProps:{size:"sm",variant:"outline",colorScheme:"gray"},selectedProps:{variant:"solid",colorScheme:"teal"},items:[{value:_.ThresholdKind.Limit,label:"limit"},{value:_.ThresholdKind.Target,label:"target"}]})]}),e.jsxRuntimeExports.jsx(Ue,{w:"100%",size:"xs",min:r,max:u,zeroMarker:!0,value:[o.min,o.max],onChange:h=>c({...o,min:h[0],max:h[1]}),formatValue:h=>`${Math.abs(h)}°`,valueLabel:h=>j(h)??"",positiveNegativeLabels:j(0)?[j(-1)??"",j(1)??""]:void 0,isDisabled:x})]})},ye=(i,o)=>"segment"in i&&"segment"in o&&i.segment===o.segment||"joint"in i&&"joint"in o&&i.joint===o.joint,we=({options:i,value:o,onChange:c,forceKind:p,singleValue:g,singleValueSideless:m,editOnly:x,disableKind:j,maxParameters:r,...u})=>{const h=m?2:r,T=s.useMemo(()=>{const E=new Map;return i.forEach(l=>{const M="joint"in l.id;let b,F;if(M?(b=ce.getJointNameWithPlane(l.id.joint,l.plane,!0)??"Unknown",F=`joint:${l.id.joint}`):(b=ce.getSegmentNameWithPlane(l.id.segment,l.plane,!0)??"Unknown",F=`segment:${l.id.segment}`),!E.has(F)){const L=M?ce.getPartName(l.id.joint)??"Unknown Joint":ce.getPartName(l.id.segment)??"Unknown Segment";E.set(F,{label:L,options:[]})}const N=E.get(F),O=[b,M?l.id.joint:l.id.segment,l.plane].filter(Boolean).map(L=>String(L).toLowerCase().replace(/\s+|_/g,""));N.options.push({label:e.jsxRuntimeExports.jsxs(t.HStack,{spacing:2,justify:"space-between",w:"100%",pl:3,children:[e.jsxRuntimeExports.jsx(t.Text,{children:b}),l.sensorOnly&&e.jsxRuntimeExports.jsx(t.Badge,{size:"sm",colorScheme:"orange",variant:"subtle",children:"Sensor Only"})]}),value:l.id,plane:l.plane,sensorOnly:l.sensorOnly,searchTokens:O})}),Array.from(E.values())},[i]),v=s.useMemo(()=>{if(!m||o.length===0)return T;const E=o[0];return T.map(l=>({...l,options:l.options.filter(M=>pe.getAnalysisPartIdNoSide(M.value)===pe.getAnalysisPartIdNoSide(E.id)&&M.plane===E.plane)})).filter(l=>l.options.length>0)},[T,o,m]),w=s.useMemo(()=>T.flatMap(l=>l.options).filter(l=>o.some(M=>ye(M.id,l.value)&&M.plane===l.plane)),[T,o]),S=s.useCallback((E,l)=>{if(!l)return!0;const M=l.toLowerCase().replace(/\s+|_/g,""),b=E.data;return!b||!b.searchTokens?!1:b.searchTokens.some(F=>F.includes(M))},[]),y=s.useCallback(E=>{const l=E.map(M=>{const b=o.find(I=>ye(I.id,M.value)&&I.plane===M.plane),F=i.find(I=>ye(I.id,M.value)&&I.plane===M.plane),N=m?o.find(I=>pe.getAnalysisPartIdNoSide(I.id)===pe.getAnalysisPartIdNoSide(M.value)&&I.plane===M.plane):void 0,O=N&&!b?N.min:F&&F.min?F.min:0,L=N&&!b?N.max:F&&F.max?F.max:0;return b??{id:M.value,plane:M.plane,min:O,max:L,sensorOnly:M.sensorOnly,kind:p??_.ThresholdKind.Limit}});c(l)},[c,o,i,p,m]);return s.useEffect(()=>{const E=o.filter(l=>i.some(M=>ye(M.id,l.id)&&M.plane===l.plane));E.length!==o.length&&c(E)},[i,c,o]),e.jsxRuntimeExports.jsxs(t.Box,{...u,children:[e.jsxRuntimeExports.jsx(ae.st,{isMulti:!g,placeholder:o.length?`${o.length} selected`:"Search...",value:w,isDisabled:x||w.length>=(h??1/0),onChange:E=>Array.isArray(E)?y([...E]):y(E!==null?[E]:[]),options:v,controlShouldRenderValue:!1,formatOptionLabel:E=>E.label,filterOption:S,isSearchable:!0}),e.jsxRuntimeExports.jsx(Oe,{marginTop:2,maxH:"28rem",value:o,onChange:c,forceKind:p,disableKind:j,isDisabled:x,lockRanges:m})]})},Le=i=>{switch(i){case _.SensorLocation.Thorax:return"Thorax";case _.SensorLocation.CenterBack:return"Center Back";case _.SensorLocation.Pelvis:return"Pelvis";case _.SensorLocation.LeftThigh:return"Left Thigh";case _.SensorLocation.RightThigh:return"Right Thigh";case _.SensorLocation.LeftShank:return"Left Shank";case _.SensorLocation.RightShank:return"Right Shank";case _.SensorLocation.LeftFoot:return"Left Foot";case _.SensorLocation.RightFoot:return"Right Foot";case _.SensorLocation.LeftUpperArm:return"Left Upper Arm";case _.SensorLocation.RightUpperArm:return"Right Upper Arm";case _.SensorLocation.LeftForearm:return"Left Forearm";case _.SensorLocation.RightForearm:return"Right Forearm";case _.SensorLocation.Head:return"Head"}},it=({id:i,onError:o,onCancel:c,onSave:p,hideButtons:g,setButtonOnClick:m,setButtonDisabled:x,quantumOwned:j,isView:r})=>{const u=ee.useClient(),[{fetching:h},T]=ee.useMutation(R.CREATE_ACTION),[{fetching:v},w]=ee.useMutation(R.UPDATE_ACTION),[{data:S}]=ee.useQuery({query:R.GET_ACTION_BY_ID,variables:{id:i??""},pause:!i}),y=s.useMemo(()=>{const f=A.getFragmentData(R.ACTION_FRAGMENT,S?.getActionById);if(!f)return null;const G=(A.getFragmentData(R.REPORT_FRAGMENT,f.reports)||[]).map(P=>({...P,thresholds:A.getFragmentData(R.THRESHOLD_FRAGMENT,P.thresholds)}));return{...f,thresholds:A.getFragmentData(R.THRESHOLD_FRAGMENT,f.thresholds),reports:G}},[S]),E=h||v,l=!!y&&!!i,{getLabel:M}=ie.useUiLabelContext(),b=s.useMemo(()=>({action:M("action")}),[M]),F=s.useMemo(()=>[{key:"module_category",label:"Link Category",multi:!0},{key:"activity_type",label:`${b.action} Type`,multi:!1},{key:"session_type",label:"Session Type",multi:!0},{key:"body_region",label:"Body Region",multi:!0},{key:"sport",label:"Sport",multi:!0},{key:"activity_motion_direction",label:"Activity Motion Direction",multi:!0}],[b.action]),[N,O]=s.useState(""),[L,I]=s.useState(""),[Y,se]=s.useState(""),[D,V]=s.useState(""),[X,k]=s.useState([]),[$,J]=s.useState({}),[z,H]=s.useState(null),[d,n]=s.useState(""),[a,C]=s.useState([]),[q,K]=s.useState([]),[W,B]=s.useState(""),[Q,oe]=s.useState([]),de=ie.useAllPartParameters(),Fe=s.useMemo(()=>de.filter(f=>f.sensorOnly),[de]),je=[{label:me.reportKindName(_.ReportKind.GeneralActivity),value:_.ReportKind.GeneralActivity},{label:me.reportKindName(_.ReportKind.MovementCoordination),value:_.ReportKind.MovementCoordination},{label:me.reportKindName(_.ReportKind.Range),value:_.ReportKind.Range},{label:me.reportKindName(_.ReportKind.StabilityBalance),value:_.ReportKind.StabilityBalance},{label:me.reportKindName(_.ReportKind.PointOfInterest),value:_.ReportKind.PointOfInterest}],Ee=s.useMemo(()=>N.trim().length>0,[N]),[fe,ve]=s.useState({});s.useEffect(()=>{const f=F.map(U=>u.query(R.GET_METADATA_BY_KEY,{key:U.key}));Promise.all(f).then(U=>{const G={};U.forEach(P=>{if(P.error||!P.data)return;const te=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,P.data.getMetadataByKey),Z=A.getFragmentData(R.METADATA_ITEM_FRAGMENT,te.data);G[te.key]=Z.map(re=>({label:re.label||re.value,value:re.value,id:re.id}))}),J(G)})},[u,F]),s.useEffect(()=>{if(y){const U=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,y.metadataGroups).map(te=>te.data.map(Z=>A.getFragmentData(R.METADATA_ITEM_FRAGMENT,Z).id)),G=y.reports.map(te=>({id:te.id,name:te.name??"",instructions:te.instructions??"",kind:te.reportKind,parameters:te.thresholds.map(Z=>({id:{[Z.partKind]:Z.partId},kind:Z.kind,min:Z.min,max:Z.max,plane:Z.partDimension,oldId:Z.id,sensorOnly:Fe.some(re=>{const Ae=re.id[Z.partKind];return Ae?Ae===Z.partId&&re.plane===Z.partDimension:!1})})),sensorLocations:te.sensorLocations})),P={name:y.name,description:y.description||"",cameraPlacement:y.cameraPlacement||"",videoLink:y.videoLink||"",metadataIds:U.flat(),reports:G};O(P.name),I(P.description),se(P.cameraPlacement),V(P.videoLink),k(P.metadataIds),oe(G),ve(P)}},[y]);const he=s.useMemo(()=>JSON.stringify(fe)!==JSON.stringify({name:N,description:L,cameraPlacement:Y,videoLink:D,metadataIds:X,reports:Q}),[fe,N,L,Y,D,X,Q]),xe=s.useCallback(()=>{const f={name:N,description:L,cameraPlacement:Y,videoLink:D,metadataItemIds:X,laterality:_.ActionLaterality.Either,quantumOwned:j,sessionType:[],thresholds:[],reports:Q.map(G=>({id:G.isNew?void 0:G.id,name:G.name,reportKind:G.kind,sensorLocations:G.sensorLocations,instructions:G.instructions,thresholds:G.parameters.map(P=>({id:P.oldId,kind:P.kind,min:P.min,max:P.max,partKind:"joint"in P.id?"joint":"segment",partId:"joint"in P.id?P.id.joint:P.id.segment,partDimension:P.plane}))}))};let U;l&&i?U=w({id:i,fields:f}):U=T({fields:f}),U.then(({error:G})=>{G?o(G):p()})},[j,T,w,i,N,L,Y,D,X,Q,l,p,o]);s.useEffect(()=>{x&&x({cancelButton:E,saveButton:r?!0:E||!Ee||!he})},[E,x,Ee,he,r]),s.useEffect(()=>{m&&m({cancelButton:c,saveButton:r?()=>{}:xe})},[m,c,xe,r]);const le=s.useCallback(f=>{const U=ce.getSuggestedSensorLocations(f.map(G=>"joint"in G.id?G.id.joint:G.id.segment));K(U)},[]);s.useEffect(()=>{le(a)},[a,le]);const ge=s.useCallback(()=>{if(!z||!d.trim())return;const f=z===_.ReportKind.PointOfInterest,U={id:Date.now().toString(),name:d.trim(),kind:z,parameters:f?[]:a,sensorLocations:f?[]:q,instructions:f?W:"",isNew:!0};oe(G=>[...G,U]),H(null),n(""),C([]),K([]),B("")},[z,d,a,q,W]),De=s.useCallback(f=>{oe(U=>U.filter(G=>G.id!==f))},[]),_e=(f,U)=>{const G=F.find(te=>te.key===f);if(!G)return;const P=G.multi?(U??[]).map(te=>te.id):U?[U.id]:[];k(te=>[...te.filter(re=>Object.values($).flat().find(be=>be.id===re)&&!Object.keys($).find(be=>$[be]?.some(Ge=>Ge.id===re&&be===f))),...P])};return e.jsxRuntimeExports.jsxs(t.VStack,{spacing:4,w:"full",align:"stretch",children:[e.jsxRuntimeExports.jsxs(t.Tabs,{children:[e.jsxRuntimeExports.jsxs(t.TabList,{children:[e.jsxRuntimeExports.jsx(t.Tab,{children:"Activity Configuration"}),e.jsxRuntimeExports.jsx(t.Tab,{children:"Reports Configuration"})]}),e.jsxRuntimeExports.jsxs(t.TabPanels,{children:[e.jsxRuntimeExports.jsx(t.TabPanel,{px:0,children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Name"}),e.jsxRuntimeExports.jsx(t.Input,{value:N,onChange:f=>O(f.target.value),type:"text",placeholder:"i.e. Lunge & Return",isDisabled:r})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Camera Placement"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:Y,onChange:f=>se(f.target.value),rows:2,placeholder:"(optional) Describe camera setup, placement, angles",isDisabled:r})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Video Link"}),e.jsxRuntimeExports.jsx(t.Input,{value:D,onChange:f=>V(f.target.value),type:"url",placeholder:"(optional) https://...",isDisabled:r})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Description"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:L,onChange:f=>I(f.target.value),rows:2,placeholder:"(optional) Describe how to perform the test or exercise",isDisabled:r})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[e.jsxRuntimeExports.jsx(ne,{children:"Metadata Tags"}),F.map(f=>e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:f.label}),e.jsxRuntimeExports.jsx(ae.st,{isMulti:f.multi,value:$[f.key]?.filter(U=>X.includes(U.id)),onChange:U=>{_e(f.key,U)},options:$[f.key],placeholder:`Select ${f.multi?"one or more":"one"} ${f.label.toLowerCase()}`,isDisabled:r,isClearable:f.multi})]},f.key))]})]})}),e.jsxRuntimeExports.jsx(t.TabPanel,{px:0,children:e.jsxRuntimeExports.jsxs("div",{className:Te.cn("grid grid-cols-1 gap-6",!r&&"md:grid-cols-2"),children:[e.jsxRuntimeExports.jsxs("div",{className:Te.cn("space-y-4",r&&"hidden"),children:[e.jsxRuntimeExports.jsx(ne,{children:"Add New Report"}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Report Name"}),e.jsxRuntimeExports.jsx(t.Input,{value:d,onChange:f=>n(f.target.value),maxLength:120,type:"text",placeholder:"Enter report name...",isDisabled:r})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Report Type"}),e.jsxRuntimeExports.jsx(ae.st,{value:z?je.find(f=>f.value===z):null,onChange:f=>H(f?.value||null),options:je,placeholder:"Select report type...",isDisabled:r,isClearable:!0})]}),z!==_.ReportKind.PointOfInterest&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Default Parameters"}),e.jsxRuntimeExports.jsx(we,{options:de,value:a,onChange:C,editOnly:r})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Suggested Sensor Locations"}),e.jsxRuntimeExports.jsx(t.Input,{value:q.map(f=>Le(f)).join(", "),placeholder:"Auto-filled based on parameters...",isDisabled:!0})]})]}),z===_.ReportKind.PointOfInterest&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Instructions"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:W,onChange:f=>B(f.target.value),rows:3,placeholder:"Enter specific instructions for this report...",isDisabled:r})]}),e.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-end",children:e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",onClick:ge,isDisabled:!z||!d.trim()||r||je.length===0||z!==_.ReportKind.PointOfInterest&&a.length===0,children:"Add Report"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[e.jsxRuntimeExports.jsx(ne,{children:"Configured Reports"}),Q.length===0?e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.500",children:"No reports created yet"}):e.jsxRuntimeExports.jsx("div",{className:"space-y-3",children:Q.map(f=>e.jsxRuntimeExports.jsxs("div",{className:"p-3 border border-gray-200 rounded-md bg-gray-50 flex flex-col gap-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.600",children:me.reportKindName(f.kind)}),!r&&e.jsxRuntimeExports.jsx(t.Button,{size:"xs",colorScheme:"red",variant:"ghost",onClick:()=>De(f.id),children:"Remove"})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Report Name"}),e.jsxRuntimeExports.jsx(t.Input,{value:f.name,onChange:U=>oe(G=>G.map(P=>P.id===f.id?{...P,name:U.target.value}:P)),placeholder:"Enter report name...",isDisabled:r})]}),f.kind===_.ReportKind.PointOfInterest&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Instructions"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:f.instructions,onChange:U=>oe(G=>G.map(P=>P.id===f.id?{...P,instructions:U.target.value}:P)),rows:3,placeholder:"Enter specific instructions for this report...",isDisabled:r})]}),f.kind!==_.ReportKind.PointOfInterest&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[e.jsxRuntimeExports.jsx(ne,{children:"Default Parameters"}),e.jsxRuntimeExports.jsx(we,{options:de,value:f.parameters,onChange:U=>{const G=Z=>"joint"in Z.id?Z.id.joint:Z.id.segment,P=U.map(G),te=ce.getSuggestedSensorLocations(P);oe(Z=>Z.map(re=>re.id===f.id?{...re,parameters:U,sensorLocations:te}:re))},editOnly:r})]}),f.kind!==_.ReportKind.PointOfInterest&&e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Sensors:"," ",f.sensorLocations.map(U=>Le(U)).join(", ")]})]},f.id))})]})]})})]})]}),e.jsxRuntimeExports.jsx(t.HStack,{justify:"end",className:Te.cn((g||r)&&"!hidden"),children:e.jsxRuntimeExports.jsxs(t.ButtonGroup,{gap:4,children:[e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"gray",isDisabled:E,onClick:c,children:"Cancel"}),e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",isDisabled:E||!Ee||!he,isLoading:E,onClick:xe,children:"Save changes"})]})})]})},ne=({children:i})=>e.jsxRuntimeExports.jsx(t.FormLabel,{fontWeight:"bold",fontFamily:"sans-serif",fontSize:"large",children:i}),at=({children:i,isView:o,metadataKeys:c})=>{const[p,g]=s.useState({}),m=ee.useClient();return s.useEffect(()=>{let x=!1;return(async()=>{const r=(c??[]).map(T=>m.query(R.GET_METADATA_BY_KEY,{key:T}).toPromise()),u=await Promise.all(r),h={};for(const T of u){if(T.error||!T.data?.getMetadataByKey)continue;const v=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,T.data.getMetadataByKey);if(!v)continue;const w=A.getFragmentData(R.METADATA_ITEM_FRAGMENT,v.data)??[];h[v.key]=w.map(S=>({label:S.label||S.value,value:S.value,id:S.id}))}x||g(h)})(),()=>{x=!0}},[m,c]),e.jsxRuntimeExports.jsx(ke.Provider,{value:{isView:o,metadataOptions:p},children:i})},lt=({id:i,onCancel:o,onSave:c,onError:p,hideButtons:g,quantumOwned:m,setButtonOnClick:x,setButtonDisabled:j,isView:r})=>{const[{data:u,fetching:h}]=ee.useQuery({query:m?R.GET_QUANTUM_OWNED_ACTIONS:R.GET_ACTIONS}),[{data:T}]=ee.useQuery({query:R.GET_MODULE_BY_ID,variables:{id:i},pause:!i}),[{data:v}]=ee.useQuery({query:R.GET_ALL_MODULE_CATEGORIES}),w=A.getFragmentData(R.MODULE_CATEGORY_FRAGMENT,v?.moduleCategories),[{fetching:S},y]=ee.useMutation(R.UPDATE_MODULE),[{fetching:E},l]=ee.useMutation(R.CREATE_MODULE),M=s.useMemo(()=>!u||h?[]:A.getFragmentData(R.ACTION_FRAGMENT,m?u?.quantumOwnedActions??[]:u?.actions??[]).filter(d=>!!d?.id),[u,m,h]),b=A.getFragmentData(R.ACTION_MODULE_FRAGMENT,T?.module),F=s.useMemo(()=>A.getFragmentData(R.MODULE_ACTION_FRAGMENT,b?.moduleActions)??[],[b?.moduleActions]),[N,O]=s.useState([...F.map(H=>H.actionId)??[]]),[L,I]=s.useState(b?.name??""),[Y,se]=s.useState([]),[D,V]=s.useState(b?.description??""),[X,k]=s.useState([]),[$,J]=s.useState({});s.useEffect(()=>{if(b){O(F.map(a=>a.actionId)),I(b.name),V(b.description??""),se(b.categories.map(a=>A.getFragmentData(R.MODULE_CATEGORY_FRAGMENT,a).id)??[]);const d=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,b.metadataGroups).map(a=>a.data.map(C=>A.getFragmentData(R.METADATA_ITEM_FRAGMENT,C).id));k(d.flat());const n={};F.forEach(a=>{n[a.actionId]=a.reportId||null}),J(n)}},[b,F]);const z=s.useCallback(()=>{let H;const d=Object.entries($).filter(([,a])=>a!==null).map(([a,C])=>({actionId:a,reportId:C})),n={actions:N,name:L,categories:Y.filter(a=>a!=="other"),description:D,quantumOwned:m,metadataItemIds:X,actionReports:d};b?H=y({id:b.id,input:n}):H=l({input:n}),H.then(({error:a})=>{a?p(a instanceof Error?a:new Error(String(a))):c()})},[l,y,N,L,D,Y,X,$,b,c,p,m]);return s.useEffect(()=>{j&&j({cancelButton:S||E,saveButton:S||E||!L||D.trim().split(/\s+/).filter(Boolean).length>40})},[j,S,E,N,L,D]),s.useEffect(()=>{x&&x({cancelButton:o,saveButton:z})},[x,o,z]),e.jsxRuntimeExports.jsx(t.Box,{width:"100%",children:e.jsxRuntimeExports.jsxs(at,{isView:r,metadataKeys:["activity_type","session_type","body_region","sport"],children:[e.jsxRuntimeExports.jsx(Ne,{name:L,setName:I,actions:M,selectedActionIds:N,setSelectedActionIds:O,availableCategories:w??[],selectedCategoryIds:Y,setSelectedCategoryIds:se,description:D,setDescription:V,selectedMetadataIds:X,setSelectedMetadataIds:k,actionReportIds:$,setActionReportIds:J}),!g&&!r&&e.jsxRuntimeExports.jsx(t.HStack,{justifyContent:"flex-start",children:e.jsxRuntimeExports.jsxs(t.ButtonGroup,{mt:16,gap:4,children:[e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"gray",isDisabled:S||E,onClick:o,children:"Cancel"}),e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",isDisabled:S||E||!L||D.trim().split(/\s+/).filter(Boolean).length>40,isLoading:S||E,onClick:z,children:"Save"})]})})]})})};exports.ActivityList=Ie;exports.CopyActivityForm=Je;exports.CopyModuleForm=Ve;exports.ModuleForm=Ne;exports.ParameterEditList=Oe;exports.ParameterEditSelect=we;exports.UpsertActivityForm=it;exports.UpsertModuleForm=lt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./react-jsx-runtime-vendor-Dszzpdy0.cjs");require("./moment-vendor-1cRqq0AH.cjs");const t=require("@chakra-ui/react"),s=require("react"),A=require("./generated.cjs"),R=require("./graphql-Dm6zPwG7.cjs"),Te=require("./utils-cn-FIKrq5Mb.cjs");require("./lodash-vendor-CfNg9qwP.cjs");const ee=require("urql"),ie=require("./hooks.cjs"),Pe=require("./ufuzzy-vendor-7qHa_k39.cjs"),ae=require("./react-select-vendor-BLLqfZvd.cjs"),Me=require("./react-icons-vendor-BF_sZq07.cjs"),me=require("./services.cjs"),Se=require("./react-dnd-vendor-DvbjNa5U.cjs"),ce=require("./services-human-DFPelsei.cjs"),_=require("./generated-graphql.cjs"),pe=require("./types.cjs"),Be=({setSearch:i,actions:o,updateUseCases:c,hideUseCaseFilter:p=!1})=>{const g=s.useMemo(()=>o?.flatMap(m=>m.useCases).filter((m,x,j)=>j.findIndex(r=>r.id===m.id)===x).map(m=>({label:m.name,value:m.id}))||[],[o]);return e.jsxRuntimeExports.jsxs(t.Flex,{width:"100%",alignContent:"space-evenly",gap:4,children:[e.jsxRuntimeExports.jsxs(t.InputGroup,{size:"md",flex:1,children:[e.jsxRuntimeExports.jsx(t.InputLeftElement,{children:e.jsxRuntimeExports.jsx(t.Icon,{as:Me.FaSearch,color:"gray.300"})}),e.jsxRuntimeExports.jsx(t.Input,{placeholder:"Search by name...",width:"100%",maxW:p?void 0:"30rem",onChange:m=>i(m.target.value)})]}),!p&&e.jsxRuntimeExports.jsx(t.InputGroup,{size:"md",children:e.jsxRuntimeExports.jsx(ae.st,{size:"md",chakraStyles:{container:m=>({...m,width:"100%"})},menuPortalTarget:document.body,placeholder:"Filter use case",isMulti:!0,options:g,onChange:m=>c(m.map(x=>x.value))})})]})},ue=({children:i})=>e.jsxRuntimeExports.jsx(t.FormLabel,{fontWeight:"bold",fontFamily:"sans-serif",fontSize:"large",children:i}),$e=({items:i,onChange:o,selectedItem:c,isDisabled:p,selectedProps:g,buttonProps:m})=>{const x=r=>r===c||r.value===c,j=r=>x(r)?{...m,...g}:m;return e.jsxRuntimeExports.jsx(t.ButtonGroup,{isAttached:!0,isDisabled:p,children:i.map((r,u)=>e.jsxRuntimeExports.jsx(t.Tooltip,{label:r.tooltip,openDelay:50,closeDelay:200,placement:"top",visibility:r.tooltip?"visible":"hidden",hasArrow:!0,children:e.jsxRuntimeExports.jsx(t.Button,{onClick:()=>x(r)?null:o(r,u),isDisabled:r.disabled,...j(r),children:r.label})},u))})},Ce=(i,o)=>o<0?-1*Math.abs(i):Math.abs(i),Ue=({isReversed:i,min:o,max:c,value:p,onChange:g,inputProps:m,size:x,zeroMarker:j,formatValue:r,valueLabel:u,positiveNegativeLabels:h,isDisabled:T,...v})=>{const[w,S]=s.useState([void 0,void 0]),y=w[0],E=w[1],l=j&&o<-5&&c>5,M=Number(p?.[0]??E??o)>0?1:-1,b=Number(p?.[1]??E??c)<0?-1:1,F=h?.[0]===h?.[1],N=p?.[0],O=p?.[1];s.useEffect(()=>{N!==void 0&&O!==void 0&&S([N.toFixed(0),O.toFixed(0)])},[N,O,S]);const L=s.useCallback(([k,$])=>{k<$&&S([k.toFixed(0),$.toFixed(0)])},[S]),I=s.useCallback(([k,$])=>{k<$&&g([k,$])},[g]),Y=s.useCallback(()=>{S(([k,$])=>{const J=isNaN(Number(k))?o:Number(k),z=isNaN(Number($))?c:Number($),H=Ce(Number(J),M),d=Ce(Number(z),b),n=M<0?Math.max(H,o):Math.min(H,c),a=b<0?Math.max(d,o):Math.min(d,c);return n>a?(g([a,n]),[a.toFixed(0),n.toFixed(0)]):(g([n,a]),[n.toFixed(0),a.toFixed(0)])})},[g,S,M,b,o,c]),se=s.useCallback(k=>{const $=k===""||isNaN(Number(k))?k:Ce(Number(k),M);S(([J,z])=>[$.toString(),z])},[S,M]),D=s.useCallback(k=>{const $=k===""||isNaN(Number(k))?k:Ce(Number(k),b);S(([J,z])=>[J,$.toString()])},[S,b]),V=s.useMemo(()=>x==="xs"?"0.75rem":void 0,[x]),X=s.useCallback((k,$)=>{const J=Number($.target.value);if(!y||!E||![-1,1].includes(J))return;const z=n=>J<0?-1*Math.abs(n):Math.abs(n),H=k?z(Number(y)):Number(y),d=k?Number(E):z(Number(E));H>d?g([d,H]):g([H,d])},[y,E,g]);return e.jsxRuntimeExports.jsxs(t.Flex,{direction:"column",...v,children:[e.jsxRuntimeExports.jsx(t.Box,{pt:"1em",mb:"-0.5em",children:e.jsxRuntimeExports.jsxs(t.RangeSlider,{"aria-label":["min","max"],isReversed:i,value:[Number(y??o),Number(E??c)],max:c,min:o,minStepsBetweenThumbs:3,step:1,onChange:L,onChangeEnd:I,isDisabled:T,children:[e.jsxRuntimeExports.jsx(t.RangeSliderMark,{value:o,top:"-1em",children:e.jsxRuntimeExports.jsx(t.Text,{fontSize:x??"sm",fontWeight:"semibold",whiteSpace:"nowrap",children:r?r?.(o):o})}),e.jsxRuntimeExports.jsx(t.RangeSliderMark,{value:c,top:"-1em",children:e.jsxRuntimeExports.jsx(t.Text,{fontSize:x??"sm",fontWeight:"semibold",style:{transform:"translateX(-100%)"},whiteSpace:"nowrap",children:r?r(c):c})}),l&&e.jsxRuntimeExports.jsxs(t.RangeSliderMark,{value:0,top:"-1em",pos:"relative",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:x,fontWeight:"semibold",children:r?.(0)??"0"}),e.jsxRuntimeExports.jsx(t.Box,{position:"absolute",width:"2px",height:"1em",top:"90%",left:"20%",backgroundColor:"var(--chakra-colors-gray-300)"})]}),e.jsxRuntimeExports.jsx(t.RangeSliderTrack,{children:e.jsxRuntimeExports.jsx(t.RangeSliderFilledTrack,{})}),e.jsxRuntimeExports.jsx(t.RangeSliderThumb,{index:0,w:V,h:V}),e.jsxRuntimeExports.jsx(t.RangeSliderThumb,{index:1,w:V,h:V})]})}),u&&e.jsxRuntimeExports.jsxs(t.Flex,{direction:i?"row-reverse":"row",justifyContent:"space-between",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:x??"sm",fontWeight:"semibold",whiteSpace:"nowrap",children:u(o)}),e.jsxRuntimeExports.jsx(t.Text,{fontSize:x??"sm",fontWeight:"semibold",whiteSpace:"nowrap",children:u(c)})]}),e.jsxRuntimeExports.jsxs(t.Flex,{direction:i?"row-reverse":"row",justifyContent:"center",alignItems:"center",gap:"0.125em",children:[h&&e.jsxRuntimeExports.jsxs(t.Select,{width:"auto",size:x,fontWeight:"bold",value:M,onChange:k=>X(!0,k),isDisabled:F||T,children:[e.jsxRuntimeExports.jsx("option",{value:-1,children:h[0]}),e.jsxRuntimeExports.jsx("option",{value:1,children:h[1]})]}),e.jsxRuntimeExports.jsx(t.NumberInput,{precision:0,size:x??"sm",min:0,max:M<0?Math.abs(o):O??c,value:y===""?"":Math.abs(Number(y??o)),onChange:se,onBlur:Y,borderWidth:1,borderRadius:3,borderColor:"#ccc",isDisabled:T,...m,children:e.jsxRuntimeExports.jsx(t.NumberInputField,{backgroundColor:"#fff",paddingRight:0,width:"4em"})}),e.jsxRuntimeExports.jsx(t.NumberInput,{size:x??"sm",min:0,max:b<0?Math.abs(N??o):c,precision:0,value:E===""?"":Math.abs(Number(E??c)),onChange:D,onBlur:Y,borderWidth:1,borderRadius:3,borderColor:"#ccc",isDisabled:T,...m,children:e.jsxRuntimeExports.jsx(t.NumberInputField,{backgroundColor:"#fff",paddingRight:0,width:"4em"})}),h&&e.jsxRuntimeExports.jsxs(t.Select,{width:"auto",size:x,fontWeight:"bold",value:b,onChange:k=>X(!1,k),isDisabled:F||T,children:[e.jsxRuntimeExports.jsx("option",{value:-1,children:h[0]}),e.jsxRuntimeExports.jsx("option",{value:1,children:h[1]})]})]})]})},ze=({tags:i,containerProps:o,...c})=>e.jsxRuntimeExports.jsx(t.HStack,{...o,children:i.map((p,g)=>e.jsxRuntimeExports.jsx(t.Tag,{...c,children:p},g))}),qe=new Pe.uFuzzy({}),We=({action:i,quantumIconSrc:o})=>{const{getLabel:c}=ie.useUiLabelContext(),p=s.useMemo(()=>({actionLowerCase:c("action").toLocaleLowerCase()}),[c]);return i.quantumOwned?e.jsxRuntimeExports.jsx(t.Tooltip,{label:`This ${p.actionLowerCase} is owned by Quantum`,"aria-label":"Quantum owned",children:e.jsxRuntimeExports.jsx(t.Box,{boxSize:"1.5em",borderRadius:"full",bg:"black",display:"flex",alignItems:"center",justifyContent:"center",children:e.jsxRuntimeExports.jsx(t.Image,{src:o,boxSize:"1em",alt:`Quantum-owned ${p.actionLowerCase}`})})}):null},Ke=(i,o)=>{if(!o||!o.trim().length)return i;const c=i.map(g=>g.name??"");return qe.filter(c,o)?.map(g=>i[g])??[]},Qe=i=>!i||i.length===0?"None":i.map(o=>o.replace(/([A-Z])/g," $1").trim()).join(", "),He=(i,o)=>!o||o.length==0?i:i.filter(c=>c.useCases?.some(p=>o.includes(p.id))??!1),Ye=(i,o,c)=>!o||o.length===0?i:i.filter(p=>{const g={};return o.forEach(m=>{for(const[x,j]of Object.entries(c||{}))if(j.some(r=>r.id===m)){g[x]||(g[x]=[]),g[x].push(m);break}}),Object.entries(g).every(([m,x])=>{const j=p.metadataGroups?.find(T=>A.getFragmentData(R.METADATA_GROUP_FRAGMENT,T).key===m);if(!j)return!1;const r=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,j),h=A.getFragmentData(R.METADATA_ITEM_FRAGMENT,r.data).map(T=>T.id);return x.some(T=>h.includes(T))})}),Ie=({actions:i,totalActions:o,onCreate:c,onDelete:p,onEdit:g,onView:m,onSelected:x,onDuplicate:j,disableMultiSelect:r,disableDelete:u,disableEdit:h,disableCreate:T,hideUseCase:v=!0,showMetadataFilters:w=!0,tableProps:S,containerProps:y,quantumIconSrc:E="/favicon.ico"})=>{const[l,M]=s.useState(""),[b,F]=s.useState(),[N,O]=s.useState([]),[L,I]=s.useState({}),{getLabel:Y}=ie.useUiLabelContext(),se=ee.useClient(),D=s.useMemo(()=>({action:Y("action"),actionPlural:Y("action_plural"),actionLowerCase:Y("action").toLocaleLowerCase(),actionPluralLowerCase:Y("action_plural").toLocaleLowerCase()}),[Y]),V=s.useMemo(()=>[{key:"module_category",label:"Link Category",multi:!0},{key:"activity_type",label:`${D.action} Type`,multi:!0},{key:"session_type",label:"Session Type",multi:!0},{key:"body_region",label:"Body Region",multi:!0},{key:"sport",label:"Sport",multi:!0}],[D.action]);s.useEffect(()=>{if(!w)return;const n=V.map(a=>se.query(R.GET_METADATA_BY_KEY,{key:a.key}));Promise.all(n).then(a=>{const C={};a.forEach(q=>{if(q.error||!q.data)return;const K=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,q.data.getMetadataByKey),W=A.getFragmentData(R.METADATA_ITEM_FRAGMENT,K.data);C[K.key]=W.map(B=>({label:B.label||B.value,value:B.value,id:B.id}))}),I(C)})},[se,V,w]);const X=s.useMemo(()=>{if(!i)return;const n=Ke(i,l),a=v?n:He(n,b);return w?Ye(a,N,L):a},[i,l,b,v,w,N,L]),k=s.useCallback(()=>{if(!p)return;const a=i.filter(C=>C.selected&&!C.quantumOwned).map(C=>C.id);p(a)},[i,p]),$=s.useCallback(()=>{if(!j)return;const n=i.filter(a=>a.selected);j(n.map(a=>a.id)),x&&n.forEach(a=>x(a,!1))},[i,j,x]),J=s.useMemo(()=>i.some(n=>n.selected&&!n.quantumOwned),[i]),z=s.useMemo(()=>i.some(n=>n.selected),[i]),H=s.useMemo(()=>i.some(n=>n.selected&&n.quantumOwned),[i]),d=s.useCallback((n,a)=>{const C=V.find(K=>K.key===n);if(!C)return;const q=C.multi?(a??[]).map(K=>K.id):a?[a.id]:[];O(K=>[...K.filter(B=>Object.values(L).flat().find(oe=>oe.id===B)&&!Object.keys(L).find(oe=>L[oe]?.some(de=>de.id===B&&oe===n))),...q])},[V,L]);return e.jsxRuntimeExports.jsxs(t.Box,{...y,children:[e.jsxRuntimeExports.jsxs(t.Flex,{alignContent:"space-between",gap:4,children:[(c||p||j)&&e.jsxRuntimeExports.jsxs(t.ButtonGroup,{mb:"1rem",gap:4,children:[c&&e.jsxRuntimeExports.jsxs(t.Button,{isDisabled:!c||T,colorScheme:"blackAlpha",backgroundColor:"gray.700",onClick:c,children:["Create New ",D.action]}),p&&!r&&e.jsxRuntimeExports.jsx(t.Tooltip,{label:H?J?`Quantum-owned ${D.actionPluralLowerCase} are selected and will be skipped`:`Selected ${D.actionPluralLowerCase} are quantum-owned and cannot be deleted`:void 0,shouldWrapChildren:!0,children:e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"gray",isDisabled:!J||!p||u,onClick:k,children:"Delete Selected"})}),j&&!r&&e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"gray",isDisabled:!z,onClick:$,children:"Duplicate Selected"})]}),e.jsxRuntimeExports.jsx(Be,{setSearch:M,actions:i,updateUseCases:F,hideUseCaseFilter:v})]}),w&&L&&e.jsxRuntimeExports.jsx(t.Box,{my:4,children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4",children:V.map(n=>e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(t.FormLabel,{fontSize:"sm",children:n.label}),e.jsxRuntimeExports.jsx(ae.st,{chakraStyles:{menu:a=>({...a,zIndex:2})},isMulti:n.multi,value:L[n.key]?.filter(a=>N.includes(a.id)),onChange:a=>{d(n.key,a)},options:L[n.key],placeholder:`Select ${n.multi?"one or more":"one"} ${n.label.toLowerCase()}`,isClearable:n.multi})]},n.key))})}),e.jsxRuntimeExports.jsx(t.TableContainer,{mr:"2rem",overflowX:"hidden",...S,children:e.jsxRuntimeExports.jsxs(t.Table,{size:"md",variant:"simple",children:[e.jsxRuntimeExports.jsx(t.Thead,{position:"sticky",top:0,bg:"white",zIndex:1,children:e.jsxRuntimeExports.jsxs(t.Tr,{children:[e.jsxRuntimeExports.jsxs(t.Th,{fontWeight:"normal",children:["(showing ",X?.length??0," of"," ",o??i.length,")"]}),e.jsxRuntimeExports.jsx(t.Th,{children:"Name"}),e.jsxRuntimeExports.jsx(t.Th,{children:"Sensor Locations"}),!v&&e.jsxRuntimeExports.jsx(t.Th,{children:"Use Case"}),e.jsxRuntimeExports.jsx(t.Th,{})]})}),e.jsxRuntimeExports.jsx(t.Tbody,{children:X?.map(n=>e.jsxRuntimeExports.jsxs(t.Tr,{className:Te.cn("hover:bg-[#f7f7f7]",!r&&"cursor-pointer",n.selected&&"bg-gray-200"),onClick:()=>{r||x?.(n,!n.selected)},children:[e.jsxRuntimeExports.jsx(t.Td,{children:e.jsxRuntimeExports.jsxs(t.Flex,{children:[!r&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n.selected?e.jsxRuntimeExports.jsx(Me.FaCheckSquare,{className:"text-blue-500"}):e.jsxRuntimeExports.jsx(Me.FaSquare,{className:"text-gray-400"})}),(n.quantumOwned||!g)&&m&&e.jsxRuntimeExports.jsx(t.Button,{ml:"1em",size:"sm",variant:"link",colorScheme:"blue",onClick:a=>{a.stopPropagation(),m(n.id)},children:"View"}),!n.quantumOwned&&g&&e.jsxRuntimeExports.jsx(t.Button,{isDisabled:h,ml:"1em",size:"sm",variant:"link",colorScheme:"blue",onClick:a=>{a.stopPropagation(),g(n.id)},children:"Edit"})]})}),e.jsxRuntimeExports.jsx(t.Td,{whiteSpace:"break-spaces",children:e.jsxRuntimeExports.jsxs(t.Flex,{align:"center",gap:2,children:[e.jsxRuntimeExports.jsx(We,{action:n,quantumIconSrc:E}),n.name]})}),e.jsxRuntimeExports.jsx(t.Td,{maxW:"20rem",whiteSpace:"break-spaces",children:Qe(n.sensorLocations)}),!v&&e.jsxRuntimeExports.jsx(t.Td,{maxW:"20rem",children:e.jsxRuntimeExports.jsx(ze,{containerProps:{flexWrap:"wrap"},tags:n.useCases?.map(a=>a.name)??[]})})]},n.id))})]})})]})},Je=({onSave:i,onCancel:o,onError:c,hideButtons:p=!1,setButtonDisabled:g,setButtonOnClick:m,quantumOwned:x})=>{const j=t.useToast(),{getLabel:r}=ie.useUiLabelContext(),u=s.useMemo(()=>({singular:r("action"),plural:r("action_plural"),pluralLowerCase:r("action_plural").toLowerCase(),singularLowerCase:r("action").toLowerCase()}),[r]),[h,T]=s.useState("copy"),[v,w]=s.useState(""),[S,y]=s.useState([]),[E,l]=s.useState(!1),[M]=ee.useQuery({query:R.GET_GROUPS}),[b]=ee.useQuery({query:R.GET_ACTIONS_BY_GROUP,variables:{groupId:v},pause:!v}),[,F]=ee.useMutation(R.CREATE_ACTION),[,N]=ee.useMutation(R.CONVERT_ACTION_TO_QUANTUM_OWNED),O=s.useMemo(()=>M.data?.groups?M.data.groups.map(d=>A.getFragmentData(R.GROUP_FRAGMENT,d)):[],[M.data]),L=s.useMemo(()=>b.data?b.data.actions.map(n=>{const a=A.getFragmentData(R.ACTION_FRAGMENT,n),C=A.getFragmentData(R.REPORT_FRAGMENT,a.reports),q=A.getFragmentData(R.MODULE_CATEGORY_FRAGMENT,a.categories),W=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,a.metadataGroups).map(B=>({...B,data:B.data.map(Q=>A.getFragmentData(R.METADATA_ITEM_FRAGMENT,Q))}));return{...a,thresholds:A.getFragmentData(R.THRESHOLD_FRAGMENT,a.thresholds),reports:C.map(B=>({...B,thresholds:A.getFragmentData(R.THRESHOLD_FRAGMENT,B.thresholds)})),categories:q,metadataGroups:W}}):[],[b.data]),I=s.useMemo(()=>L.filter(d=>S.includes(d.id)),[L,S]),Y=s.useCallback(d=>{const n=d?.value||"";w(n),y([])},[]),se=s.useCallback(d=>{const n=d.map(a=>a.value);y(n)},[]),D=s.useCallback(async d=>{const n={...d,name:`${d.name} (Copy)`,description:d.description||void 0,instructionsPointOfInterest:d.instructionsPointOfInterest||void 0,instructionsMovementReport:d.instructionsMovementReport||void 0,laterality:d.laterality,activityKind:d.activityKind,sensorLocations:d.sensorLocations,thresholds:d.thresholds.map(C=>({...C,id:void 0})),categories:d.categories.map(C=>C.id),quantumOwned:x,metadataItemIds:d.metadataGroups.flatMap(C=>C.data.map(q=>q.id)).filter(C=>C!==void 0),reports:d.reports.map(C=>({...C,id:void 0,thresholds:C.thresholds.map(q=>({...q,id:void 0}))})),id:void 0},a=await F({fields:n});if(a.error)throw new Error(a.error.message);if(a.data?.createAction)return A.getFragmentData(R.ACTION_FRAGMENT,a.data.createAction);throw new Error("No action data returned")},[F,x]),V=s.useCallback(async d=>{const n=await N({id:d.id});if(n.error)throw new Error(n.error.message);if(n.data?.convertActionToQuantumOwned)return A.getFragmentData(R.ACTION_FRAGMENT,n.data.convertActionToQuantumOwned);throw new Error("No action data returned")},[N]),X=s.useCallback(async()=>{if(l(!0),!I.length){const d=new Error(`No ${u.pluralLowerCase} selected for ${h==="copy"?"copying":"converting"}`);c?.(d),l(!1);return}try{const d=[];let n=0;const a=h==="copy"?D:V,C=h==="copy"?"copy":"convert";for(const q of I)try{const K=await a(q);d.push(K)}catch(K){console.error(`Failed to ${C} ${u.singularLowerCase} "${q.name}":`,K),n++}if(d.length>0){const q=d.length,K=I.length,W=h==="copy"?"copied":"converted",B=h==="copy"?"copy":"convert";j({title:n>0?`Partial ${B} completed`:`${u.plural} ${W} successfully`,description:n>0?`${q} of ${K} ${u.pluralLowerCase} ${W} successfully`:`${q} ${q>1?u.pluralLowerCase:u.singularLowerCase} ${W} successfully`,status:n>0?"warning":"success",duration:3e3,isClosable:!0}),i?.(),w(""),y([])}else throw new Error(`Failed to ${C} any ${u.pluralLowerCase}`)}catch(d){const n=h==="copy"?"copy":"convert",a=d instanceof Error?d.message:`Failed to ${n} ${u.pluralLowerCase}`;j({title:`${h==="copy"?"Copy":"Convert"} failed`,description:a,status:"error",duration:5e3,isClosable:!0}),c?.(d instanceof Error?d:new Error(a))}finally{l(!1)}},[I,h,D,V,j,i,c,u]),k=s.useCallback(()=>{w(""),y([]),T("copy"),o?.()},[o]);s.useEffect(()=>{g&&g({cancelButton:!1,saveButton:I.length===0||E})},[I.length,E,g]),s.useEffect(()=>{m&&m({cancelButton:k,saveButton:X})},[m,k,X]);const $=s.useMemo(()=>O.map(d=>({value:d.id,label:d.name})),[O]),J=s.useMemo(()=>L.filter(d=>h==="copy"?!0:!d.quantumOwned).map(d=>({value:d.id,label:d.name,isQuantumOwned:d.quantumOwned})),[L,h]),z=M.fetching,H=b.fetching;return e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsxs(t.VStack,{spacing:6,align:"stretch",children:[x&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ue,{children:"Operation Mode"}),e.jsxRuntimeExports.jsx(t.RadioGroup,{value:h,onChange:d=>{T(d),y([])},children:e.jsxRuntimeExports.jsxs(t.HStack,{spacing:6,children:[e.jsxRuntimeExports.jsx(t.Radio,{value:"copy",colorScheme:"blue",children:e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",children:["Copy ",u.plural]}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Create new ",u.plural.toLocaleLowerCase()," ","based on selected ones"]})]})}),e.jsxRuntimeExports.jsx(t.Radio,{value:"convert",colorScheme:"green",children:e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",children:["Convert to Quantum Owned ",u.singular]}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Convert existing"," ",u.plural.toLocaleLowerCase()," to quantum-owned"]})]})})]})})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ue,{children:"Select Source Group"}),e.jsxRuntimeExports.jsx(ae.st,{placeholder:"Choose a group...",options:$,value:$.find(d=>d.value===v)||null,onChange:Y,isLoading:z,isDisabled:z,isClearable:!0}),M.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load groups: ",M.error.message]})]})]}),v&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsxs(ue,{children:["Select ",u.plural," to"," ",h==="copy"?"Copy":"Convert"]}),H?e.jsxRuntimeExports.jsxs(t.HStack,{children:[e.jsxRuntimeExports.jsx(t.Spinner,{size:"sm"}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Loading ",u.pluralLowerCase,"..."]})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(ae.st,{placeholder:`Choose ${u.pluralLowerCase} to ${h}...`,options:J,value:J.filter(d=>S.includes(d.value)),onChange:se,isDisabled:J.length===0,isClearable:!0,isMulti:!0,closeMenuOnSelect:!1,formatOptionLabel:(d,{context:n})=>e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",w:"100%",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(t.Text,{children:d.label}),n==="value"&&d.isQuantumOwned&&e.jsxRuntimeExports.jsx(t.Text,{color:"blue",fontSize:"xs",children:"(Quantum Owned)"})]}),d.isQuantumOwned&&n==="menu"&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]})}),J.length===0&&e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.500",mt:2,children:["No ",u.pluralLowerCase," found"]})]}),b.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load ",u.pluralLowerCase,":"," ",b.error.message]})]})]}),I.length>0&&e.jsxRuntimeExports.jsxs(t.Box,{p:4,bg:"gray.50",borderRadius:"md",children:[e.jsxRuntimeExports.jsx(t.Text,{fontWeight:"semibold",mb:3,children:I.length===1?`${u.singular} to ${h==="copy"?"Copy":"Convert"}:`:`${I.length} ${u.plural} to ${h==="copy"?"Copy":"Convert"}:`}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:3,children:[I.map((d,n)=>e.jsxRuntimeExports.jsxs(t.Box,{w:"100%",p:3,bg:"white",borderRadius:"md",border:"1px solid",borderColor:"gray.200",children:[e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",align:"start",mb:2,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",fontSize:"sm",children:[n+1,". ",d.name]}),d.quantumOwned&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,fontSize:"sm",color:"gray.600",children:[d.description&&e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Description:"})," ",d.description]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Type:"})," ",d.activityKind]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Laterality:"})," ",d.laterality]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Sensor Locations:"})," ",d.sensorLocations.length]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Thresholds:"})," ",d.thresholds.length]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Use Cases:"})," ",d.useCases.map(a=>a.name).join(", ")||"None"]})]})]},d.id)),I.length>1&&e.jsxRuntimeExports.jsx(t.Box,{w:"100%",p:2,bg:"blue.50",borderRadius:"md",border:"1px solid",borderColor:"blue.200",children:e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",fontWeight:"medium",color:"blue.800",children:["Total: ",I.length," ",u.pluralLowerCase," will be"," ",h==="copy"?"copied":"converted"]})})]})]}),!p&&e.jsxRuntimeExports.jsxs(t.ButtonGroup,{spacing:4,justifyContent:"flex-end",children:[e.jsxRuntimeExports.jsx(t.Button,{variant:"outline",onClick:k,isDisabled:E,children:"Cancel"}),e.jsxRuntimeExports.jsxs(t.Button,{colorScheme:h==="copy"?"blue":"green",onClick:X,isDisabled:I.length===0||E,isLoading:E,loadingText:`${h==="copy"?"Copying":"Converting"}...`,children:[h==="copy"?"Copy":"Convert"," ",I.length===1?u.singular:`${I.length} ${u.plural}`]})]})]})})},Ve=({onSave:i,onCancel:o,onError:c,hideButtons:p=!1,setButtonDisabled:g,setButtonOnClick:m,quantumOwned:x})=>{const j=t.useToast(),{getLabel:r}=ie.useUiLabelContext(),u=s.useMemo(()=>({singular:r("module"),plural:r("module_plural"),pluralLowerCase:r("module_plural").toLowerCase(),singularLowerCase:r("module").toLowerCase()}),[r]),h=s.useMemo(()=>({singular:r("action"),plural:r("action_plural"),pluralLowerCase:r("action_plural").toLowerCase(),singularLowerCase:r("action").toLowerCase()}),[r]),[T,v]=s.useState(""),[w,S]=s.useState([]),[y,E]=s.useState(!1),[l,M]=s.useState("copy"),[b]=ee.useQuery({query:R.GET_GROUPS}),[F]=ee.useQuery({query:R.GET_MODULES_BY_GROUP,variables:{groupId:T},pause:!T}),[,N]=ee.useMutation(R.CREATE_MODULE),[,O]=ee.useMutation(R.UPDATE_MODULE),[,L]=ee.useMutation(R.CREATE_ACTION),[,I]=ee.useMutation(R.CONVERT_ACTION_TO_QUANTUM_OWNED),Y=s.useMemo(()=>b.data?.groups?b.data.groups.map(n=>A.getFragmentData(R.GROUP_FRAGMENT,n)):[],[b.data]),se=s.useMemo(()=>F.data?.modules?A.getFragmentData(R.ACTION_MODULE_FRAGMENT,F.data?.modules).map(a=>{const C=A.getFragmentData(R.MODULE_ACTION_FRAGMENT,a.moduleActions),K=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,a.metadataGroups).map(W=>A.getFragmentData(R.METADATA_ITEM_FRAGMENT,W.data)).flat();return{...a,moduleActions:C.map(W=>({...W,action:A.getFragmentData(R.ACTION_FRAGMENT,W.action)})),categories:A.getFragmentData(R.MODULE_CATEGORY_FRAGMENT,a.categories),metadataItems:K}}):[],[F.data]),D=s.useMemo(()=>se.filter(n=>w.includes(n.id)),[se,w]),V=s.useCallback(n=>{const a=n?.value||"";v(a),S([])},[]),X=s.useCallback(n=>{const a=n.map(C=>C.value);S(a)},[]),k=s.useCallback(async()=>{if(E(!0),!D.length){E(!1);const n=new Error(`No modules selected for ${l==="convert"?"converting":"copying"}`);c?.(n);return}try{const n=[];let a=0;for(const C of D)try{let q=C.moduleActions.map(K=>K.actionId);if(x){const K=C.moduleActions.map(Q=>Q.action),W=async Q=>{if(l==="copy"){if(Q.quantumOwned)return Q;const de=A.getFragmentData(R.MODULE_CATEGORY_FRAGMENT,Q.categories),je=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,Q.metadataGroups).map(le=>A.getFragmentData(R.METADATA_ITEM_FRAGMENT,le.data).map(ge=>ge.id)).flat(),fe=A.getFragmentData(R.REPORT_FRAGMENT,Q.reports).map(le=>({...le,id:void 0,thresholds:A.getFragmentData(R.THRESHOLD_FRAGMENT,le.thresholds).map(ge=>({...ge,id:void 0}))})),ve=A.getFragmentData(R.THRESHOLD_FRAGMENT,Q.thresholds).map(le=>({...le,id:void 0})),he={...Q,quantumOwned:!0,thresholds:ve,categories:de?.map(le=>le.id),reports:fe,metadataIds:je,id:void 0},xe=await L({fields:he});return xe.error||!xe.data?.createAction?null:A.getFragmentData(R.ACTION_FRAGMENT,xe.data.createAction)}if(Q.quantumOwned)return Q;const oe=await I({id:Q.id});return oe.error||!oe.data?.convertActionToQuantumOwned?null:A.getFragmentData(R.ACTION_FRAGMENT,oe.data.convertActionToQuantumOwned)};q=(await Promise.all(K.map(W))).filter(Q=>!!Q?.id).map(Q=>Q.id)}if(l==="convert"){const K={name:C.name,description:C.description||void 0,actions:q,categories:C.categories.map(B=>B.id),quantumOwned:!0},W=await O({id:C.id,input:K});if(W.error)throw new Error(W.error.message);if(W.data?.updateModule){const B=A.getFragmentData(R.ACTION_MODULE_FRAGMENT,W.data.updateModule);n.push(B)}}else{const K={name:`${C.name} (Copy)`,description:C.description||void 0,actions:q,categories:C.categories.map(B=>B.id),quantumOwned:x,metadataItemIds:C.metadataItems.map(B=>B.id),actionReports:C.moduleActions.filter(B=>!!B.reportId).map(B=>({actionId:B.actionId,reportId:B.reportId}))},W=await N({input:K});if(W.error)throw new Error(W.error.message);if(W.data?.createModule){const B=A.getFragmentData(R.ACTION_MODULE_FRAGMENT,W.data.createModule);n.push(B)}}}catch(q){console.error(`Failed to ${l==="convert"?"convert":"copy"} module "${C.name}":`,q),a++}if(n.length>0){const C=n.length,q=D.length;j({title:a>0?`Partial ${l==="convert"?"convert":"copy"} completed`:`${u.plural} ${l==="convert"?"converted":"copied"} successfully`,description:a>0?`${C} of ${q} ${u.plural} ${l==="convert"?"converted":"copied"} successfully`:`${C} ${C>1?u.plural:u.singular} ${l==="convert"?"converted":"copied"} successfully`,status:a>0?"warning":"success",duration:3e3,isClosable:!0}),n.length>0&&i?.(),v(""),S([])}else throw new Error(`Failed to ${l==="convert"?"convert":"copy"} any modules`)}catch(n){const a=n instanceof Error?n.message:`Failed to ${l==="convert"?"convert":"copy"} modules`;j({title:l==="convert"?"Convert failed":"Copy failed",description:a,status:"error",duration:5e3,isClosable:!0}),c?.(n instanceof Error?n:new Error(a))}finally{E(!1)}},[D,N,O,j,i,c,x,L,I,l,u]),$=s.useCallback(()=>{v(""),S([]),M("copy"),o?.()},[o]);s.useEffect(()=>{g&&g({cancelButton:!1,saveButton:D.length===0||y})},[D.length,y,g]),s.useEffect(()=>{m&&m({cancelButton:$,saveButton:k})},[m,$,k]);const J=s.useMemo(()=>Y.map(n=>({value:n.id,label:n.name})),[Y]),z=s.useMemo(()=>se.filter(n=>l==="copy"?!0:!n.quantumOwned).map(n=>({value:n.id,label:n.name,isQuantumOwned:n.quantumOwned})),[se,l]),H=b.fetching,d=F.fetching;return e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsxs(t.VStack,{spacing:6,align:"stretch",children:[x&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ue,{children:"Operation Mode"}),e.jsxRuntimeExports.jsx(t.RadioGroup,{value:l,onChange:n=>{M(n),S([])},children:e.jsxRuntimeExports.jsxs(t.HStack,{spacing:6,children:[e.jsxRuntimeExports.jsx(t.Radio,{value:"copy",colorScheme:"blue",children:e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",children:["Copy ",u.plural]}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Create new ",u.pluralLowerCase," based on selected ones"]})]})}),e.jsxRuntimeExports.jsx(t.Radio,{value:"convert",colorScheme:"green",children:e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,children:[e.jsxRuntimeExports.jsx(t.Text,{fontWeight:"medium",children:"Convert to Quantum Owned"}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Convert existing ",u.pluralLowerCase," to quantum-owned"]})]})})]})})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ue,{children:"Select Source Group"}),e.jsxRuntimeExports.jsx(ae.st,{placeholder:"Choose a group...",options:J,value:J.find(n=>n.value===T)||null,onChange:V,isLoading:H,isDisabled:H,isClearable:!0}),b.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load groups: ",b.error.message]})]})]}),T&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ue,{children:l==="convert"?`Select ${u.plural} to Convert`:`Select ${u.plural} to Copy`}),d?e.jsxRuntimeExports.jsxs(t.HStack,{children:[e.jsxRuntimeExports.jsx(t.Spinner,{size:"sm"}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Loading ",u.pluralLowerCase,"..."]})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(ae.st,{placeholder:l==="convert"?`Choose ${u.pluralLowerCase} to convert...`:`Choose ${u.pluralLowerCase} to copy...`,options:z,value:z.filter(n=>w.includes(n.value)),onChange:X,isDisabled:z.length===0,isClearable:!0,isMulti:!0,closeMenuOnSelect:!1,formatOptionLabel:(n,{context:a})=>e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",w:"100%",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxRuntimeExports.jsx(t.Text,{children:n.label}),a==="value"&&n.isQuantumOwned&&e.jsxRuntimeExports.jsx(t.Text,{color:"blue",fontSize:"xs",children:"(Quantum Owned)"})]}),n.isQuantumOwned&&a==="menu"&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]})}),z.length===0&&e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.500",mt:2,children:["No ",u.pluralLowerCase," found in this group"]})]}),F.error&&e.jsxRuntimeExports.jsxs(t.Alert,{status:"error",mt:2,children:[e.jsxRuntimeExports.jsx(t.AlertIcon,{}),e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",children:["Failed to load ",u.pluralLowerCase,":"," ",F.error.message]})]})]}),D.length>0&&e.jsxRuntimeExports.jsxs(t.Box,{p:4,bg:"gray.50",borderRadius:"md",children:[e.jsxRuntimeExports.jsx(t.Text,{fontWeight:"semibold",mb:3,children:D.length===1?`${u.singular} to ${l==="copy"?"Copy":"Convert"}`:`${D.length} ${u.plural} to ${l==="copy"?"Copy":"Convert"}`}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:3,children:[D.map((n,a)=>e.jsxRuntimeExports.jsxs(t.Box,{w:"100%",p:3,bg:"white",borderRadius:"md",border:"1px solid",borderColor:"gray.200",children:[e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",align:"start",mb:2,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"medium",fontSize:"sm",children:[a+1,". ",n.name]}),n.quantumOwned&&e.jsxRuntimeExports.jsx(t.Tag,{size:"sm",colorScheme:"blue",variant:"solid",children:"Quantum Owned"})]}),e.jsxRuntimeExports.jsxs(t.VStack,{align:"start",spacing:1,fontSize:"sm",color:"gray.600",children:[n.description&&e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Description:"})," ",n.description]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Activities:"})," ",n.moduleActions.length]}),e.jsxRuntimeExports.jsxs(t.Text,{children:[e.jsxRuntimeExports.jsx("strong",{children:"Categories:"})," ",n.categories.map(C=>C.name).join(", ")||"None"]})]})]},n.id)),D.length>1&&e.jsxRuntimeExports.jsx(t.Box,{w:"100%",p:2,bg:"blue.50",borderRadius:"md",border:"1px solid",borderColor:"blue.200",children:e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",fontWeight:"medium",color:"blue.800",children:["Total: ",D.length," ",u.pluralLowerCase," will be"," ",l==="copy"?"copied":"converted"]})}),x&&D.filter(n=>n.moduleActions.some(a=>!a.action.quantumOwned)).length>0&&e.jsxRuntimeExports.jsx(t.Box,{p:2,bg:"yellow.50",borderRadius:"md",border:"1px solid",borderColor:"yellow.200",children:e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",fontWeight:"medium",color:"yellow.800",children:l==="convert"?`Converting ${u.plural} will convert non QM-Owned ${h.plural} to QM-Owned ${h.plural}`:`Copying ${u.plural} with Non QM-Owned ${h.plural} will create corresponding QM-Owned ${h.plural}`})})]})]}),!p&&e.jsxRuntimeExports.jsxs(t.ButtonGroup,{spacing:4,justifyContent:"flex-end",children:[e.jsxRuntimeExports.jsx(t.Button,{variant:"outline",onClick:$,isDisabled:y,children:"Cancel"}),e.jsxRuntimeExports.jsxs(t.Button,{colorScheme:l==="copy"?"blue":"green",onClick:k,isDisabled:D.length===0||y,isLoading:y,loadingText:`${l==="copy"?"Copying":"Converting"}...`,children:[l==="copy"?"Copy":"Convert"," ",D.length===1?u.singular:`${D.length} ${u.plural}`]})]})]})})},ke=s.createContext(void 0),Re=()=>{const i=s.useContext(ke);if(!i)throw new Error("useUpsertModuleFormContext must be used within a UpsertModuleFormProvider");return i},Ne=({name:i,setName:o,actions:c,selectedActionIds:p,setSelectedActionIds:g,availableCategories:m,selectedCategoryIds:x,setSelectedCategoryIds:j,description:r,setDescription:u,selectedMetadataIds:h,setSelectedMetadataIds:T,actionReportIds:v,setActionReportIds:w,...S})=>{const y=t.useDisclosure(),E=s.useMemo(()=>c.map(O=>({...O,selected:p.includes(O.id)})),[c,p]),l=s.useMemo(()=>c.reduce((O,L)=>(O[L.id]=L,O),{}),[c]),M=s.useMemo(()=>p.map(O=>l[O]),[p,l]),b=s.useCallback((O,L)=>{g(L?[...p,O.id]:p.filter(I=>I!==O.id))},[p,g]),F=s.useCallback(O=>{o(O.target.value)},[o]),N=s.useCallback(O=>{u?.(O.target.value)},[u]);return e.jsxRuntimeExports.jsxs(t.Box,{...S,children:[e.jsxRuntimeExports.jsxs(t.HStack,{gap:"2rem",children:[e.jsxRuntimeExports.jsx(Xe,{name:i??"",onInputChange:F}),e.jsxRuntimeExports.jsx(Ze,{availableCategories:m,value:x,onChange:j})]}),e.jsxRuntimeExports.jsx(et,{description:r??"",onInputChange:N}),e.jsxRuntimeExports.jsx(ot,{selectedMetadataIds:h,setSelectedMetadataIds:T}),e.jsxRuntimeExports.jsx(tt,{value:M,onChange:g,onAdjustActivities:()=>y.onOpen(),actionReportIds:v,setActionReportIds:w}),e.jsxRuntimeExports.jsxs(t.Modal,{isOpen:y.isOpen,onClose:y.onClose,size:"6xl",children:[e.jsxRuntimeExports.jsx(t.ModalOverlay,{}),e.jsxRuntimeExports.jsxs(t.ModalContent,{children:[e.jsxRuntimeExports.jsx(t.ModalHeader,{children:"Select Activities"}),e.jsxRuntimeExports.jsx(t.ModalCloseButton,{}),e.jsxRuntimeExports.jsx(t.ModalBody,{children:e.jsxRuntimeExports.jsx(Ie,{actions:E,onSelected:b,disableCreate:!0,disableDelete:!0,tableProps:{height:"28rem",overflowY:"auto"}})}),e.jsxRuntimeExports.jsx(t.ModalFooter,{children:e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",onClick:y.onClose,isDisabled:p.length===0,children:"Done"})})]})]})]})},Xe=s.memo(({name:i,onInputChange:o})=>{const{getLabel:c}=ie.useUiLabelContext(),p=c("module"),{isView:g}=Re();return e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsxs(ue,{children:[p," Name"]}),e.jsxRuntimeExports.jsx(t.Input,{placeholder:"i.e. ACL RTP Test Battery",value:i,onChange:o,isRequired:!0,isDisabled:g})]})}),Ze=s.memo(({availableCategories:i,value:o,onChange:c})=>{const{getLabel:p}=ie.useUiLabelContext(),g=p("module"),{isView:m}=Re(),x=s.useMemo(()=>[...i,{id:"other",name:"Other"}],[i]),j=s.useMemo(()=>x.map(r=>({value:r.id,label:r.name})),[x]);return e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsxs(ue,{children:[g," Category"]}),e.jsxRuntimeExports.jsx(ae.st,{isDisabled:i.length===0||m,options:j,value:o.length===0?{value:"other",label:"Other"}:x.filter(r=>o.includes(r.id)).map(r=>({value:r.id,label:r.name}))[0],onChange:r=>c(r?[r.value]:[]),placeholder:"Select category"})]})}),et=s.memo(({description:i,onInputChange:o})=>{const{getLabel:c}=ie.useUiLabelContext(),p=c("module"),{isView:g}=Re();return e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsx(ue,{children:e.jsxRuntimeExports.jsxs("span",{children:["Description",e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.500",children:["Briefly describe the objective of this"," ",p.toLocaleLowerCase(),". Max 40 words."]})]})}),e.jsxRuntimeExports.jsx(t.Input,{placeholder:"i.e. Assess readiness to return to play post-ACL reconstruction",value:i,onChange:o,isDisabled:g})]})}),tt=s.memo(({value:i,onChange:o,onAdjustActivities:c,actionReportIds:p,setActionReportIds:g})=>{const{getLabel:m}=ie.useUiLabelContext(),{isView:x}=Re(),j=s.useMemo(()=>({module:m("module"),moduleLowerCase:m("module").toLocaleLowerCase(),action:m("action"),actionPlural:m("action_plural"),actionPluralLowerCase:m("action_plural").toLocaleLowerCase()}),[m]),r=s.useMemo(()=>i.filter(u=>!!u?.id).map(u=>({id:u.id,name:u.name,reports:A.getFragmentData(R.REPORT_FRAGMENT,u.reports)||[],selectedReportId:p[u.id]||null})),[i,p]);return e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsxs(t.HStack,{justifyContent:"space-between",children:[e.jsxRuntimeExports.jsx(ue,{children:e.jsxRuntimeExports.jsxs("span",{children:[j.actionPlural,!x&&e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.500",children:["Drag and drop to reorder the ",j.actionPluralLowerCase," ","in this ",j.moduleLowerCase,"."]})]})}),!x&&e.jsxRuntimeExports.jsxs(t.Button,{size:"sm",variant:"solid",colorScheme:"blue",onClick:c,children:["Add / Remove ",j.actionPlural]})]}),r.length===0?e.jsxRuntimeExports.jsx(t.VStack,{children:e.jsxRuntimeExports.jsxs(t.Text,{color:"gray.500",fontSize:"lg",mb:"4rem",mt:"4rem",children:["No ",j.actionPluralLowerCase," selected for this"," ",j.moduleLowerCase,".",!x&&e.jsxRuntimeExports.jsxs(t.Button,{ml:"0.5em",size:"sm",variant:"link",colorScheme:"blue",onClick:c,children:["Add ",j.actionPluralLowerCase,"."]})]})}):e.jsxRuntimeExports.jsx(st,{value:r,onChange:u=>{const h=u(r);o(h.map(T=>T.id))},disabled:x,actionReportIds:p,setActionReportIds:g})]})}),st=s.memo(({value:i,onChange:o,disabled:c,actionReportIds:p,setActionReportIds:g})=>{const[m]=s.useState(()=>Math.random().toString(36).substring(2,15)),x=s.useCallback((j,r)=>{c||o(u=>{const h=[...u],[T]=h.splice(j,1);return h.splice(r,0,T),h})},[o,c]);return e.jsxRuntimeExports.jsx(t.Box,{children:e.jsxRuntimeExports.jsx(Se.DndProvider,{backend:Se.HTML5Backend,children:e.jsxRuntimeExports.jsx(t.VStack,{spacing:3,align:"stretch",children:i.map((j,r)=>e.jsxRuntimeExports.jsx(nt,{listKey:m,item:j,index:r,disabled:!!c,move:x,onReportChange:u=>{g({...p,[j.id]:u})}},j.id))})})})}),nt=s.memo(({listKey:i,item:o,index:c,disabled:p,move:g,onReportChange:m})=>{const x=s.useRef(null),{getLabel:j}=ie.useUiLabelContext(),r=j("action"),[{handlerId:u},h]=Se.useDrop({accept:i,collect:l=>({handlerId:l.getHandlerId()?.toString()??""}),hover:(l,M)=>{if(!x.current)return;const b=l.index,F=c;if(b===F)return;const N=x.current?.getBoundingClientRect(),O=(N.bottom-N.top)/2,I=M.getClientOffset().y-N.top;b<F&&I<O||b>F&&I>O||(g(b,F),l.index=F)}}),[{isDragging:T},v]=Se.useDrag({type:i,item:()=>({id:o.id,index:c}),collect:l=>({isDragging:l.isDragging()}),canDrag:!p}),w=s.useMemo(()=>`action-report-label-${o.id}`,[o.id]),S=s.useMemo(()=>[{value:null,label:"No Report"},...o.reports.map(l=>{const M=l.name&&l.name.length>0?l.name:"No Name",b=me.reportKindName(l.reportKind);return{value:l.id,label:`${M} (${b})`}})],[o.reports]),y=T?.6:1,E=p?"default":T?"grabbing":"grab";return v(h(x)),e.jsxRuntimeExports.jsx(t.Box,{ref:x,p:3,border:"1px solid",borderColor:"gray.200",borderRadius:"md",bg:"gray.50",style:{opacity:y,cursor:E},"data-handler-id":u,children:e.jsxRuntimeExports.jsxs(t.HStack,{justify:"space-between",align:"center",children:[e.jsxRuntimeExports.jsxs(t.HStack,{spacing:3,children:[e.jsxRuntimeExports.jsxs(t.Text,{fontWeight:"semibold",minW:"2rem",children:[c+1,"."]}),e.jsxRuntimeExports.jsx(t.Text,{fontWeight:"medium",children:o.name})]}),e.jsxRuntimeExports.jsxs(t.HStack,{spacing:3,align:"center",children:[e.jsxRuntimeExports.jsxs(t.Text,{id:w,fontSize:"sm",color:"gray.600",children:[r," Report:"]}),e.jsxRuntimeExports.jsx(t.Box,{width:{base:"100%",md:"450px"},children:e.jsxRuntimeExports.jsx(ae.st,{"aria-labelledby":w,value:S.find(l=>l.value===o.selectedReportId),onChange:l=>{m(l?.value||null)},options:S,placeholder:"Select report...",isDisabled:p})})]})]})})}),ot=s.memo(({selectedMetadataIds:i,setSelectedMetadataIds:o})=>{const{getLabel:c}=ie.useUiLabelContext(),{isView:p,metadataOptions:g}=Re(),m=s.useMemo(()=>[{key:"activity_type",label:`${c("action")} Type`,multi:!0},{key:"session_type",label:"Session Type",multi:!0},{key:"body_region",label:"Body Region",multi:!0},{key:"sport",label:"Sport",multi:!0}],[c]),x=s.useCallback((j,r)=>{const u=m.find(T=>T.key===j);if(!u)return;const h=u.multi?(r??[]).map(T=>T.id):r?[r.id]:[];o(T=>[...T.filter(w=>Object.values(g||{}).flat().find(y=>y.id===w)&&!Object.keys(g||{}).find(y=>g?.[y]?.some(E=>E.id===w&&y===j))),...h])},[m,g,o]);return g?e.jsxRuntimeExports.jsxs(t.FormControl,{mb:4,children:[e.jsxRuntimeExports.jsx(ue,{children:"Metadata Tags"}),e.jsxRuntimeExports.jsx(t.HStack,{gap:"1rem",align:"start",children:m.map(j=>e.jsxRuntimeExports.jsxs(t.FormControl,{flex:"1",children:[e.jsxRuntimeExports.jsx(t.FormLabel,{fontSize:"sm",children:j.label}),e.jsxRuntimeExports.jsx(ae.st,{isMulti:j.multi,value:g[j.key]?.filter(r=>i.includes(r.id)),onChange:r=>{x(j.key,r)},options:g[j.key],placeholder:`Select ${j.multi?"one or more":"one"} ${j.label.toLowerCase()}`,isDisabled:p,isClearable:j.multi})]},j.key))})]}):null}),Oe=({value:i,onChange:o,forceKind:c,disableRemove:p,disableKind:g,isDisabled:m,lockRanges:x,...j})=>{const r=s.useMemo(()=>[...i].sort((v,w)=>{const S=pe.availablePlanes.indexOf(v.plane),y=pe.availablePlanes.indexOf(w.plane);return S-y}),[i]),u=s.useCallback(v=>"segment"in v.id?ce.getSegmentNameWithPlane(v.id.segment,v.plane,!0)??"Unknown":ce.getJointNameWithPlane(v.id.joint,v.plane,!0)??"Unknown",[]),h=s.useCallback((v,w)=>{const S=r.findIndex(E=>E.id===w.id&&E.plane===w.plane);let y=[...r];c&&(w={...w,kind:c}),y[S]=w,x&&(y=y.map(E=>({...E,min:w.min,max:w.max}))),o(y)},[o,r,c,x]),T=s.useCallback(v=>{const w=r.filter(S=>S.id!==v.id||S.plane!==v.plane);o(w)},[o,r]);return e.jsxRuntimeExports.jsx(t.VStack,{alignItems:"flex-start",overflowY:"auto",...j,children:r.map((v,w)=>e.jsxRuntimeExports.jsx(rt,{label:u(v),parameter:v,onChange:S=>h(w,S),onRemove:p||m?void 0:()=>T(v),forceKind:c,disableKind:g||m,isDisabled:m},`${JSON.stringify(v.id)}-${v.plane}`))})},rt=({label:i,parameter:o,onChange:c,onRemove:p,forceKind:g,disableKind:m,isDisabled:x})=>{const j=s.useCallback(h=>"joint"in o.id?ce.getJointAngleDirectionName(o.id.joint,o.plane,h<0?-1:1):ce.getSegmentAngleDirectionName(o.id.segment,o.plane,h<0?-1:1),[o]),{min:r,max:u}="joint"in o.id?ce.getNormativeJointRange(o.id.joint,o.plane):{min:-180,max:180};return e.jsxRuntimeExports.jsxs(t.VStack,{borderRadius:"md",p:2,px:4,bg:"gray.100",w:"100%",overflow:"hidden",flexShrink:"0",children:[e.jsxRuntimeExports.jsxs(t.HStack,{w:"100%",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",flex:1,textTransform:"capitalize",fontWeight:"semibold",children:i}),o.sensorOnly&&e.jsxRuntimeExports.jsx(t.Badge,{size:"sm",colorScheme:"orange",variant:"subtle",children:"Sensor Only"}),p&&!x&&e.jsxRuntimeExports.jsx(t.IconButton,{size:"xs",variant:"ghost","aria-label":"delete",icon:e.jsxRuntimeExports.jsx(t.Icon,{as:Me.FaTrash}),onClick:p}),!g&&e.jsxRuntimeExports.jsx($e,{selectedItem:o?.kind??_.ThresholdKind.Limit,onChange:({value:h})=>c({...o,kind:h}),isDisabled:m||x,buttonProps:{size:"sm",variant:"outline",colorScheme:"gray"},selectedProps:{variant:"solid",colorScheme:"teal"},items:[{value:_.ThresholdKind.Limit,label:"limit"},{value:_.ThresholdKind.Target,label:"target"}]})]}),e.jsxRuntimeExports.jsx(Ue,{w:"100%",size:"xs",min:r,max:u,zeroMarker:!0,value:[o.min,o.max],onChange:h=>c({...o,min:h[0],max:h[1]}),formatValue:h=>`${Math.abs(h)}°`,valueLabel:h=>j(h)??"",positiveNegativeLabels:j(0)?[j(-1)??"",j(1)??""]:void 0,isDisabled:x})]})},ye=(i,o)=>"segment"in i&&"segment"in o&&i.segment===o.segment||"joint"in i&&"joint"in o&&i.joint===o.joint,we=({options:i,value:o,onChange:c,forceKind:p,singleValue:g,singleValueSideless:m,editOnly:x,disableKind:j,maxParameters:r,...u})=>{const h=m?2:r,T=s.useMemo(()=>{const E=new Map;return i.forEach(l=>{const M="joint"in l.id;let b,F;if(M?(b=ce.getJointNameWithPlane(l.id.joint,l.plane,!0)??"Unknown",F=`joint:${l.id.joint}`):(b=ce.getSegmentNameWithPlane(l.id.segment,l.plane,!0)??"Unknown",F=`segment:${l.id.segment}`),!E.has(F)){const L=M?ce.getPartName(l.id.joint)??"Unknown Joint":ce.getPartName(l.id.segment)??"Unknown Segment";E.set(F,{label:L,options:[]})}const N=E.get(F),O=[b,M?l.id.joint:l.id.segment,l.plane].filter(Boolean).map(L=>String(L).toLowerCase().replace(/\s+|_/g,""));N.options.push({label:e.jsxRuntimeExports.jsxs(t.HStack,{spacing:2,justify:"space-between",w:"100%",pl:3,children:[e.jsxRuntimeExports.jsx(t.Text,{children:b}),l.sensorOnly&&e.jsxRuntimeExports.jsx(t.Badge,{size:"sm",colorScheme:"orange",variant:"subtle",children:"Sensor Only"})]}),value:l.id,plane:l.plane,sensorOnly:l.sensorOnly,searchTokens:O})}),Array.from(E.values())},[i]),v=s.useMemo(()=>{if(!m||o.length===0)return T;const E=o[0];return T.map(l=>({...l,options:l.options.filter(M=>pe.getAnalysisPartIdNoSide(M.value)===pe.getAnalysisPartIdNoSide(E.id)&&M.plane===E.plane)})).filter(l=>l.options.length>0)},[T,o,m]),w=s.useMemo(()=>T.flatMap(l=>l.options).filter(l=>o.some(M=>ye(M.id,l.value)&&M.plane===l.plane)),[T,o]),S=s.useCallback((E,l)=>{if(!l)return!0;const M=l.toLowerCase().replace(/\s+|_/g,""),b=E.data;return!b||!b.searchTokens?!1:b.searchTokens.some(F=>F.includes(M))},[]),y=s.useCallback(E=>{const l=E.map(M=>{const b=o.find(I=>ye(I.id,M.value)&&I.plane===M.plane),F=i.find(I=>ye(I.id,M.value)&&I.plane===M.plane),N=m?o.find(I=>pe.getAnalysisPartIdNoSide(I.id)===pe.getAnalysisPartIdNoSide(M.value)&&I.plane===M.plane):void 0,O=N&&!b?N.min:F&&F.min?F.min:0,L=N&&!b?N.max:F&&F.max?F.max:0;return b??{id:M.value,plane:M.plane,min:O,max:L,sensorOnly:M.sensorOnly,kind:p??_.ThresholdKind.Limit}});c(l)},[c,o,i,p,m]);return s.useEffect(()=>{const E=o.filter(l=>i.some(M=>ye(M.id,l.id)&&M.plane===l.plane));E.length!==o.length&&c(E)},[i,c,o]),e.jsxRuntimeExports.jsxs(t.Box,{...u,children:[e.jsxRuntimeExports.jsx(ae.st,{isMulti:!g,placeholder:o.length?`${o.length} selected`:"Search...",value:w,isDisabled:x||w.length>=(h??1/0),onChange:E=>Array.isArray(E)?y([...E]):y(E!==null?[E]:[]),options:v,controlShouldRenderValue:!1,formatOptionLabel:E=>E.label,filterOption:S,isSearchable:!0}),e.jsxRuntimeExports.jsx(Oe,{marginTop:2,maxH:"28rem",value:o,onChange:c,forceKind:p,disableKind:j,isDisabled:x,lockRanges:m})]})},Le=i=>{switch(i){case _.SensorLocation.Thorax:return"Thorax";case _.SensorLocation.CenterBack:return"Center Back";case _.SensorLocation.Pelvis:return"Pelvis";case _.SensorLocation.LeftThigh:return"Left Thigh";case _.SensorLocation.RightThigh:return"Right Thigh";case _.SensorLocation.LeftShank:return"Left Shank";case _.SensorLocation.RightShank:return"Right Shank";case _.SensorLocation.LeftFoot:return"Left Foot";case _.SensorLocation.RightFoot:return"Right Foot";case _.SensorLocation.LeftUpperArm:return"Left Upper Arm";case _.SensorLocation.RightUpperArm:return"Right Upper Arm";case _.SensorLocation.LeftForearm:return"Left Forearm";case _.SensorLocation.RightForearm:return"Right Forearm";case _.SensorLocation.Head:return"Head"}},it=({id:i,onError:o,onCancel:c,onSave:p,hideButtons:g,setButtonOnClick:m,setButtonDisabled:x,quantumOwned:j,isView:r})=>{const u=ee.useClient(),[{fetching:h},T]=ee.useMutation(R.CREATE_ACTION),[{fetching:v},w]=ee.useMutation(R.UPDATE_ACTION),[{data:S}]=ee.useQuery({query:R.GET_ACTION_BY_ID,variables:{id:i??""},pause:!i}),y=s.useMemo(()=>{const f=A.getFragmentData(R.ACTION_FRAGMENT,S?.getActionById);if(!f)return null;const G=(A.getFragmentData(R.REPORT_FRAGMENT,f.reports)||[]).map(P=>({...P,thresholds:A.getFragmentData(R.THRESHOLD_FRAGMENT,P.thresholds)}));return{...f,thresholds:A.getFragmentData(R.THRESHOLD_FRAGMENT,f.thresholds),reports:G}},[S]),E=h||v,l=!!y&&!!i,{getLabel:M}=ie.useUiLabelContext(),b=s.useMemo(()=>({action:M("action")}),[M]),F=s.useMemo(()=>[{key:"module_category",label:"Link Category",multi:!0},{key:"activity_type",label:`${b.action} Type`,multi:!1},{key:"session_type",label:"Session Type",multi:!0},{key:"body_region",label:"Body Region",multi:!0},{key:"sport",label:"Sport",multi:!0},{key:"activity_motion_direction",label:"Activity Motion Direction",multi:!0}],[b.action]),[N,O]=s.useState(""),[L,I]=s.useState(""),[Y,se]=s.useState(""),[D,V]=s.useState(""),[X,k]=s.useState([]),[$,J]=s.useState({}),[z,H]=s.useState(null),[d,n]=s.useState(""),[a,C]=s.useState([]),[q,K]=s.useState([]),[W,B]=s.useState(""),[Q,oe]=s.useState([]),de=ie.useAllPartParameters(),Fe=s.useMemo(()=>de.filter(f=>f.sensorOnly),[de]),je=[{label:me.reportKindName(_.ReportKind.GeneralActivity),value:_.ReportKind.GeneralActivity},{label:me.reportKindName(_.ReportKind.MovementCoordination),value:_.ReportKind.MovementCoordination},{label:me.reportKindName(_.ReportKind.Range),value:_.ReportKind.Range},{label:me.reportKindName(_.ReportKind.StabilityBalance),value:_.ReportKind.StabilityBalance},{label:me.reportKindName(_.ReportKind.PointOfInterest),value:_.ReportKind.PointOfInterest}],Ee=s.useMemo(()=>N.trim().length>0,[N]),[fe,ve]=s.useState({});s.useEffect(()=>{const f=F.map(U=>u.query(R.GET_METADATA_BY_KEY,{key:U.key}));Promise.all(f).then(U=>{const G={};U.forEach(P=>{if(P.error||!P.data)return;const te=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,P.data.getMetadataByKey),Z=A.getFragmentData(R.METADATA_ITEM_FRAGMENT,te.data);G[te.key]=Z.map(re=>({label:re.label||re.value,value:re.value,id:re.id}))}),J(G)})},[u,F]),s.useEffect(()=>{if(y){const U=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,y.metadataGroups).map(te=>te.data.map(Z=>A.getFragmentData(R.METADATA_ITEM_FRAGMENT,Z).id)),G=y.reports.map(te=>({id:te.id,name:te.name??"",instructions:te.instructions??"",kind:te.reportKind,parameters:te.thresholds.map(Z=>({id:{[Z.partKind]:Z.partId},kind:Z.kind,min:Z.min,max:Z.max,plane:Z.partDimension,oldId:Z.id,sensorOnly:Fe.some(re=>{const Ae=re.id[Z.partKind];return Ae?Ae===Z.partId&&re.plane===Z.partDimension:!1})})),sensorLocations:te.sensorLocations})),P={name:y.name,description:y.description||"",cameraPlacement:y.cameraPlacement||"",videoLink:y.videoLink||"",metadataIds:U.flat(),reports:G};O(P.name),I(P.description),se(P.cameraPlacement),V(P.videoLink),k(P.metadataIds),oe(G),ve(P)}},[y]);const he=s.useMemo(()=>JSON.stringify(fe)!==JSON.stringify({name:N,description:L,cameraPlacement:Y,videoLink:D,metadataIds:X,reports:Q}),[fe,N,L,Y,D,X,Q]),xe=s.useCallback(()=>{const f={name:N,description:L,cameraPlacement:Y,videoLink:D,metadataItemIds:X,laterality:_.ActionLaterality.Either,quantumOwned:j,sessionType:[],thresholds:[],reports:Q.map(G=>({id:G.isNew?void 0:G.id,name:G.name,reportKind:G.kind,sensorLocations:G.sensorLocations,instructions:G.instructions,thresholds:G.parameters.map(P=>({id:P.oldId,kind:P.kind,min:P.min,max:P.max,partKind:"joint"in P.id?"joint":"segment",partId:"joint"in P.id?P.id.joint:P.id.segment,partDimension:P.plane}))}))};let U;l&&i?U=w({id:i,fields:f}):U=T({fields:f}),U.then(({error:G})=>{G?o(G):p()})},[j,T,w,i,N,L,Y,D,X,Q,l,p,o]);s.useEffect(()=>{x&&x({cancelButton:E,saveButton:r?!0:E||!Ee||!he})},[E,x,Ee,he,r]),s.useEffect(()=>{m&&m({cancelButton:c,saveButton:r?()=>{}:xe})},[m,c,xe,r]);const le=s.useCallback(f=>{const U=ce.getSuggestedSensorLocations(f.map(G=>"joint"in G.id?G.id.joint:G.id.segment));K(U)},[]);s.useEffect(()=>{le(a)},[a,le]);const ge=s.useCallback(()=>{if(!z||!d.trim())return;const f=z===_.ReportKind.PointOfInterest,U={id:Date.now().toString(),name:d.trim(),kind:z,parameters:f?[]:a,sensorLocations:f?[]:q,instructions:f?W:"",isNew:!0};oe(G=>[...G,U]),H(null),n(""),C([]),K([]),B("")},[z,d,a,q,W]),De=s.useCallback(f=>{oe(U=>U.filter(G=>G.id!==f))},[]),_e=(f,U)=>{const G=F.find(te=>te.key===f);if(!G)return;const P=G.multi?(U??[]).map(te=>te.id):U?[U.id]:[];k(te=>[...te.filter(re=>Object.values($).flat().find(be=>be.id===re)&&!Object.keys($).find(be=>$[be]?.some(Ge=>Ge.id===re&&be===f))),...P])};return e.jsxRuntimeExports.jsxs(t.VStack,{spacing:4,w:"full",align:"stretch",children:[e.jsxRuntimeExports.jsxs(t.Tabs,{children:[e.jsxRuntimeExports.jsxs(t.TabList,{children:[e.jsxRuntimeExports.jsx(t.Tab,{children:"Activity Configuration"}),e.jsxRuntimeExports.jsx(t.Tab,{children:"Reports Configuration"})]}),e.jsxRuntimeExports.jsxs(t.TabPanels,{children:[e.jsxRuntimeExports.jsx(t.TabPanel,{px:0,children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Name"}),e.jsxRuntimeExports.jsx(t.Input,{value:N,onChange:f=>O(f.target.value),type:"text",placeholder:"i.e. Lunge & Return",isDisabled:r})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Camera Placement"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:Y,onChange:f=>se(f.target.value),rows:2,placeholder:"(optional) Describe camera setup, placement, angles",isDisabled:r})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Video Link"}),e.jsxRuntimeExports.jsx(t.Input,{value:D,onChange:f=>V(f.target.value),type:"url",placeholder:"(optional) https://...",isDisabled:r})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Description"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:L,onChange:f=>I(f.target.value),rows:2,placeholder:"(optional) Describe how to perform the test or exercise",isDisabled:r})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[e.jsxRuntimeExports.jsx(ne,{children:"Metadata Tags"}),F.map(f=>e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:f.label}),e.jsxRuntimeExports.jsx(ae.st,{isMulti:f.multi,value:$[f.key]?.filter(U=>X.includes(U.id)),onChange:U=>{_e(f.key,U)},options:$[f.key],placeholder:`Select ${f.multi?"one or more":"one"} ${f.label.toLowerCase()}`,isDisabled:r,isClearable:f.multi})]},f.key))]})]})}),e.jsxRuntimeExports.jsx(t.TabPanel,{px:0,children:e.jsxRuntimeExports.jsxs("div",{className:Te.cn("grid grid-cols-1 gap-6",!r&&"md:grid-cols-2"),children:[e.jsxRuntimeExports.jsxs("div",{className:Te.cn("space-y-4",r&&"hidden"),children:[e.jsxRuntimeExports.jsx(ne,{children:"Add New Report"}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Report Name"}),e.jsxRuntimeExports.jsx(t.Input,{value:d,onChange:f=>n(f.target.value),maxLength:120,type:"text",placeholder:"Enter report name...",isDisabled:r})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Report Type"}),e.jsxRuntimeExports.jsx(ae.st,{value:z?je.find(f=>f.value===z):null,onChange:f=>H(f?.value||null),options:je,placeholder:"Select report type...",isDisabled:r,isClearable:!0})]}),z!==_.ReportKind.PointOfInterest&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Default Parameters"}),e.jsxRuntimeExports.jsx(we,{options:de,value:a,onChange:C,editOnly:r})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Suggested Sensor Locations"}),e.jsxRuntimeExports.jsx(t.Input,{value:q.map(f=>Le(f)).join(", "),placeholder:"Auto-filled based on parameters...",isDisabled:!0})]})]}),z===_.ReportKind.PointOfInterest&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Instructions"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:W,onChange:f=>B(f.target.value),rows:3,placeholder:"Enter specific instructions for this report...",isDisabled:r})]}),e.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-end",children:e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",onClick:ge,isDisabled:!z||!d.trim()||r||je.length===0||z!==_.ReportKind.PointOfInterest&&a.length===0,children:"Add Report"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[e.jsxRuntimeExports.jsx(ne,{children:"Configured Reports"}),Q.length===0?e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.500",children:"No reports created yet"}):e.jsxRuntimeExports.jsx("div",{className:"space-y-3",children:Q.map(f=>e.jsxRuntimeExports.jsxs("div",{className:"p-3 border border-gray-200 rounded-md bg-gray-50 flex flex-col gap-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxRuntimeExports.jsx(t.Text,{fontSize:"sm",color:"gray.600",children:me.reportKindName(f.kind)}),!r&&e.jsxRuntimeExports.jsx(t.Button,{size:"xs",colorScheme:"red",variant:"ghost",onClick:()=>De(f.id),children:"Remove"})]}),e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Report Name"}),e.jsxRuntimeExports.jsx(t.Input,{value:f.name,onChange:U=>oe(G=>G.map(P=>P.id===f.id?{...P,name:U.target.value}:P)),placeholder:"Enter report name...",isDisabled:r})]}),f.kind===_.ReportKind.PointOfInterest&&e.jsxRuntimeExports.jsxs(t.FormControl,{children:[e.jsxRuntimeExports.jsx(ne,{children:"Instructions"}),e.jsxRuntimeExports.jsx(t.Textarea,{value:f.instructions,onChange:U=>oe(G=>G.map(P=>P.id===f.id?{...P,instructions:U.target.value}:P)),rows:3,placeholder:"Enter specific instructions for this report...",isDisabled:r})]}),f.kind!==_.ReportKind.PointOfInterest&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[e.jsxRuntimeExports.jsx(ne,{children:"Default Parameters"}),e.jsxRuntimeExports.jsx(we,{options:de,value:f.parameters,onChange:U=>{const G=Z=>"joint"in Z.id?Z.id.joint:Z.id.segment,P=U.map(G),te=ce.getSuggestedSensorLocations(P);oe(Z=>Z.map(re=>re.id===f.id?{...re,parameters:U,sensorLocations:te}:re))},editOnly:r})]}),f.kind!==_.ReportKind.PointOfInterest&&e.jsxRuntimeExports.jsxs(t.Text,{fontSize:"sm",color:"gray.600",children:["Sensors:"," ",f.sensorLocations.map(U=>Le(U)).join(", ")]})]},f.id))})]})]})})]})]}),e.jsxRuntimeExports.jsx(t.HStack,{justify:"end",className:Te.cn((g||r)&&"!hidden"),children:e.jsxRuntimeExports.jsxs(t.ButtonGroup,{gap:4,children:[e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"gray",isDisabled:E,onClick:c,children:"Cancel"}),e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",isDisabled:E||!Ee||!he,isLoading:E,onClick:xe,children:"Save changes"})]})})]})},ne=({children:i})=>e.jsxRuntimeExports.jsx(t.FormLabel,{fontWeight:"bold",fontFamily:"sans-serif",fontSize:"large",children:i}),at=({children:i,isView:o,metadataKeys:c})=>{const[p,g]=s.useState({}),m=ee.useClient();return s.useEffect(()=>{let x=!1;return(async()=>{const r=(c??[]).map(T=>m.query(R.GET_METADATA_BY_KEY,{key:T}).toPromise()),u=await Promise.all(r),h={};for(const T of u){if(T.error||!T.data?.getMetadataByKey)continue;const v=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,T.data.getMetadataByKey);if(!v)continue;const w=A.getFragmentData(R.METADATA_ITEM_FRAGMENT,v.data)??[];h[v.key]=w.map(S=>({label:S.label||S.value,value:S.value,id:S.id}))}x||g(h)})(),()=>{x=!0}},[m,c]),e.jsxRuntimeExports.jsx(ke.Provider,{value:{isView:o,metadataOptions:p},children:i})},lt=({id:i,onCancel:o,onSave:c,onError:p,hideButtons:g,quantumOwned:m,setButtonOnClick:x,setButtonDisabled:j,isView:r})=>{const[{data:u,fetching:h}]=ee.useQuery({query:m?R.GET_QUANTUM_OWNED_ACTIONS:R.GET_ACTIONS}),[{data:T}]=ee.useQuery({query:R.GET_MODULE_BY_ID,variables:{id:i},pause:!i}),[{data:v}]=ee.useQuery({query:R.GET_ALL_MODULE_CATEGORIES}),w=A.getFragmentData(R.MODULE_CATEGORY_FRAGMENT,v?.moduleCategories),[{fetching:S},y]=ee.useMutation(R.UPDATE_MODULE),[{fetching:E},l]=ee.useMutation(R.CREATE_MODULE),M=s.useMemo(()=>!u||h?[]:A.getFragmentData(R.ACTION_FRAGMENT,m?u?.quantumOwnedActions??[]:u?.actions??[]).filter(d=>!!d?.id),[u,m,h]),b=A.getFragmentData(R.ACTION_MODULE_FRAGMENT,T?.module),F=s.useMemo(()=>A.getFragmentData(R.MODULE_ACTION_FRAGMENT,b?.moduleActions)??[],[b?.moduleActions]),[N,O]=s.useState([...F.map(H=>H.actionId)??[]]),[L,I]=s.useState(b?.name??""),[Y,se]=s.useState([]),[D,V]=s.useState(b?.description??""),[X,k]=s.useState([]),[$,J]=s.useState({});s.useEffect(()=>{if(b){O(F.map(a=>a.actionId)),I(b.name),V(b.description??""),se(b.categories.map(a=>A.getFragmentData(R.MODULE_CATEGORY_FRAGMENT,a).id)??[]);const d=A.getFragmentData(R.METADATA_GROUP_FRAGMENT,b.metadataGroups).map(a=>a.data.map(C=>A.getFragmentData(R.METADATA_ITEM_FRAGMENT,C).id));k(d.flat());const n={};F.forEach(a=>{n[a.actionId]=a.reportId||null}),J(n)}},[b,F]);const z=s.useCallback(()=>{let H;const d=Object.entries($).filter(([,a])=>a!==null).map(([a,C])=>({actionId:a,reportId:C})),n={actions:N,name:L,categories:Y.filter(a=>a!=="other"),description:D,quantumOwned:m,metadataItemIds:X,actionReports:d};b?H=y({id:b.id,input:n}):H=l({input:n}),H.then(({error:a})=>{a?p(a instanceof Error?a:new Error(String(a))):c()})},[l,y,N,L,D,Y,X,$,b,c,p,m]);return s.useEffect(()=>{j&&j({cancelButton:S||E,saveButton:S||E||!L||D.trim().split(/\s+/).filter(Boolean).length>40})},[j,S,E,N,L,D]),s.useEffect(()=>{x&&x({cancelButton:o,saveButton:z})},[x,o,z]),e.jsxRuntimeExports.jsx(t.Box,{width:"100%",children:e.jsxRuntimeExports.jsxs(at,{isView:r,metadataKeys:["activity_type","session_type","body_region","sport"],children:[e.jsxRuntimeExports.jsx(Ne,{name:L,setName:I,actions:M,selectedActionIds:N,setSelectedActionIds:O,availableCategories:w??[],selectedCategoryIds:Y,setSelectedCategoryIds:se,description:D,setDescription:V,selectedMetadataIds:X,setSelectedMetadataIds:k,actionReportIds:$,setActionReportIds:J}),!g&&!r&&e.jsxRuntimeExports.jsx(t.HStack,{justifyContent:"flex-start",children:e.jsxRuntimeExports.jsxs(t.ButtonGroup,{mt:16,gap:4,children:[e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"gray",isDisabled:S||E,onClick:o,children:"Cancel"}),e.jsxRuntimeExports.jsx(t.Button,{colorScheme:"blue",isDisabled:S||E||!L||D.trim().split(/\s+/).filter(Boolean).length>40,isLoading:S||E,onClick:z,children:"Save"})]})})]})})};exports.ActivityList=Ie;exports.CopyActivityForm=Je;exports.CopyModuleForm=Ve;exports.ModuleForm=Ne;exports.ParameterEditList=Oe;exports.ParameterEditSelect=we;exports.UpsertActivityForm=it;exports.UpsertModuleForm=lt;
|
package/dist/components.js
CHANGED
|
@@ -5,15 +5,15 @@ import { useMemo as k, useState as _, useEffect as le, useCallback as G, createC
|
|
|
5
5
|
import { getFragmentData as I } from "./generated.js";
|
|
6
6
|
import { G as st, M as je, a as be, b as Lt, c as ln, C as rt, d as It, e as Mt, R as Ze, f as De, T as Oe, A as Ce, g as cn, h as Ot, U as At, i as Qe, j as kt, k as dn, l as un, m as mn, n as hn, o as pn, p as gn } from "./graphql-CN-pqRpK.js";
|
|
7
7
|
import { c as qe } from "./utils-cn-CgdSr4hO.js";
|
|
8
|
-
import "./lodash-vendor-
|
|
8
|
+
import "./lodash-vendor-CY4G3-79.js";
|
|
9
9
|
import { useClient as ot, useQuery as we, useMutation as fe } from "urql";
|
|
10
10
|
import { useUiLabelContext as xe, useAllPartParameters as xn } from "./hooks.js";
|
|
11
11
|
import { u as fn } from "./ufuzzy-vendor-Dl0ZI6Av.js";
|
|
12
|
-
import { s as he } from "./react-select-vendor-
|
|
12
|
+
import { s as he } from "./react-select-vendor-B0QF8gkj.js";
|
|
13
13
|
import { F as jn, a as bn, b as yn, c as vn } from "./react-icons-vendor-CMsTQrA0.js";
|
|
14
14
|
import { reportKindName as Le } from "./services.js";
|
|
15
|
-
import { D as Cn, H as wn, u as Sn, a as Ln } from "./react-dnd-vendor-
|
|
16
|
-
import { g as Tt, a as Nt, b as In, c as Mn, d as On, e as gt, f as xt } from "./services-human-
|
|
15
|
+
import { D as Cn, H as wn, u as Sn, a as Ln } from "./react-dnd-vendor-DYesaYGm.js";
|
|
16
|
+
import { g as Tt, a as Nt, b as In, c as Mn, d as On, e as gt, f as xt } from "./services-human-D5IllQkM.js";
|
|
17
17
|
import { ThresholdKind as Ke, ReportKind as ae, ActionLaterality as An, SensorLocation as me } from "./generated-graphql.js";
|
|
18
18
|
import { availablePlanes as ft, getAnalysisPartIdNoSide as Be } from "./types.js";
|
|
19
19
|
const kn = ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as j } from "./vendor-
|
|
2
|
-
import { i as s, b as M } from "./react-dnd-vendor-
|
|
1
|
+
import { c as j } from "./vendor-BSFJsa1P.js";
|
|
2
|
+
import { i as s, b as M } from "./react-dnd-vendor-DYesaYGm.js";
|
|
3
3
|
function H(t, e, r) {
|
|
4
4
|
return e.split(".").reduce(
|
|
5
5
|
(n, i) => n && n[i] ? n[i] : r || null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const M=require("./vendor-vQ2gqPbn.cjs"),s=require("./react-dnd-vendor-D97_L5Fj.cjs");function j(t,e,r){return e.split(".").reduce((n,i)=>n&&n[i]?n[i]:r||null,t)}function H(t,e){return t.filter(r=>r!==e)}function U(t){return typeof t=="object"}function N(t,e){const r=new Map,n=o=>{r.set(o,r.has(o)?r.get(o)+1:1)};t.forEach(n),e.forEach(n);const i=[];return r.forEach((o,a)=>{o===1&&i.push(a)}),i}function L(t,e){return t.filter(r=>e.indexOf(r)>-1)}const E="dnd-core/INIT_COORDS",p="dnd-core/BEGIN_DRAG",I="dnd-core/PUBLISH_DRAG_SOURCE",h="dnd-core/HOVER",y="dnd-core/DROP",S="dnd-core/END_DRAG";function _(t,e){return{type:E,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}const V={type:E,payload:{clientOffset:null,sourceClientOffset:null}};function k(t){return function(r=[],n={publishSource:!0}){const{publishSource:i=!0,clientOffset:o,getSourceClientOffset:a}=n,c=t.getMonitor(),l=t.getRegistry();t.dispatch(_(o)),q(r,c,l);const f=X(r,c);if(f==null){t.dispatch(V);return}let D=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");B(a),D=a(f)}t.dispatch(_(o,D));const b=l.getSource(f).beginDrag(c,f);if(b==null)return;F(b),l.pinSource(f);const $=l.getSourceType(f);return{type:p,payload:{itemType:$,item:b,sourceId:f,clientOffset:o||null,sourceClientOffset:D||null,isSourcePublic:!!i}}}}function q(t,e,r){s.invariant(!e.isDragging(),"Cannot call beginDrag while dragging."),t.forEach(function(n){s.invariant(r.getSource(n),"Expected sourceIds to be registered.")})}function B(t){s.invariant(typeof t=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function F(t){s.invariant(U(t),"Item must be an object.")}function X(t,e){let r=null;for(let n=t.length-1;n>=0;n--)if(e.canDragSource(t[n])){r=t[n];break}return r}function W(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function z(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){W(t,i,r[i])})}return t}function J(t){return function(r={}){const n=t.getMonitor(),i=t.getRegistry();Q(n),K(n).forEach((a,c)=>{const l=Y(a,c,i,n),f={type:y,payload:{dropResult:z({},r,l)}};t.dispatch(f)})}}function Q(t){s.invariant(t.isDragging(),"Cannot call drop while not dragging."),s.invariant(!t.didDrop(),"Cannot call drop twice during one drag operation.")}function Y(t,e,r,n){const i=r.getTarget(t);let o=i?i.drop(n,t):void 0;return Z(o),typeof o>"u"&&(o=e===0?{}:n.getDropResult()),o}function Z(t){s.invariant(typeof t>"u"||U(t),"Drop result must either be an object or undefined.")}function K(t){const e=t.getTargetIds().filter(t.canDropOnTarget,t);return e.reverse(),e}function ee(t){return function(){const r=t.getMonitor(),n=t.getRegistry();te(r);const i=r.getSourceId();return i!=null&&(n.getSource(i,!0).endDrag(r,i),n.unpinSource()),{type:S}}}function te(t){s.invariant(t.isDragging(),"Cannot call endDrag while not dragging.")}function v(t,e){return e===null?t===null:Array.isArray(t)?t.some(r=>r===e):t===e}function re(t){return function(r,{clientOffset:n}={}){ne(r);const i=r.slice(0),o=t.getMonitor(),a=t.getRegistry(),c=o.getItemType();return oe(i,a,c),ie(i,o,a),se(i,o,a),{type:h,payload:{targetIds:i,clientOffset:n||null}}}}function ne(t){s.invariant(Array.isArray(t),"Expected targetIds to be an array.")}function ie(t,e,r){s.invariant(e.isDragging(),"Cannot call hover while not dragging."),s.invariant(!e.didDrop(),"Cannot call hover after drop.");for(let n=0;n<t.length;n++){const i=t[n];s.invariant(t.lastIndexOf(i)===n,"Expected targetIds to be unique in the passed array.");const o=r.getTarget(i);s.invariant(o,"Expected targetIds to be registered.")}}function oe(t,e,r){for(let n=t.length-1;n>=0;n--){const i=t[n],o=e.getTargetType(i);v(o,r)||t.splice(n,1)}}function se(t,e,r){t.forEach(function(n){r.getTarget(n).hover(e,n)})}function ae(t){return function(){if(t.getMonitor().isDragging())return{type:I}}}function ce(t){return{beginDrag:k(t),publishDragSource:ae(t),hover:re(t),drop:J(t),endDrag:ee(t)}}class ue{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:r}=this.store;function n(o){return(...a)=>{const c=o.apply(e,a);typeof c<"u"&&r(c)}}const i=ce(this);return Object.keys(i).reduce((o,a)=>{const c=i[a];return o[a]=n(c),o},{})}dispatch(e){this.store.dispatch(e)}constructor(e,r){this.isSetUp=!1,this.handleRefCountChange=()=>{const n=this.store.getState().refCount>0;this.backend&&(n&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!n&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=r,e.subscribe(this.handleRefCountChange)}}function fe(t,e){return{x:t.x+e.x,y:t.y+e.y}}function G(t,e){return{x:t.x-e.x,y:t.y-e.y}}function le(t){const{clientOffset:e,initialClientOffset:r,initialSourceClientOffset:n}=t;return!e||!r||!n?null:G(fe(e,n),r)}function de(t){const{clientOffset:e,initialClientOffset:r}=t;return!e||!r?null:G(e,r)}const g=[],m=[];g.__IS_NONE__=!0;m.__IS_ALL__=!0;function ge(t,e){return t===g?!1:t===m||typeof e>"u"?!0:L(e,t).length>0}class pe{subscribeToStateChange(e,r={}){const{handlerIds:n}=r;s.invariant(typeof e=="function","listener must be a function."),s.invariant(typeof n>"u"||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let i=this.store.getState().stateId;const o=()=>{const a=this.store.getState(),c=a.stateId;try{c===i||c===i+1&&!ge(a.dirtyHandlerIds,n)||e()}finally{i=c}};return this.store.subscribe(o)}subscribeToOffsetChange(e){s.invariant(typeof e=="function","listener must be a function.");let r=this.store.getState().dragOffset;const n=()=>{const i=this.store.getState().dragOffset;i!==r&&(r=i,e())};return this.store.subscribe(n)}canDragSource(e){if(!e)return!1;const r=this.registry.getSource(e);return s.invariant(r,`Expected to find a valid source. sourceId=${e}`),this.isDragging()?!1:r.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const r=this.registry.getTarget(e);if(s.invariant(r,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;const n=this.registry.getTargetType(e),i=this.getItemType();return v(n,i)&&r.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;const r=this.registry.getSource(e,!0);if(s.invariant(r,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic())return!1;const n=this.registry.getSourceType(e),i=this.getItemType();return n!==i?!1:r.isDragging(this,e)}isOverTarget(e,r={shallow:!1}){if(!e)return!1;const{shallow:n}=r;if(!this.isDragging())return!1;const i=this.registry.getTargetType(e),o=this.getItemType();if(o&&!v(i,o))return!1;const a=this.getTargetIds();if(!a.length)return!1;const c=a.indexOf(e);return n?c===a.length-1:c>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return le(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return de(this.store.getState().dragOffset)}constructor(e,r){this.store=e,this.registry=r}}const C="dnd-core/ADD_SOURCE",R="dnd-core/ADD_TARGET",x="dnd-core/REMOVE_SOURCE",O="dnd-core/REMOVE_TARGET";function he(t){return{type:C,payload:{sourceId:t}}}function ye(t){return{type:R,payload:{targetId:t}}}function Se(t){return{type:x,payload:{sourceId:t}}}function Oe(t){return{type:O,payload:{targetId:t}}}function De(t){s.invariant(typeof t.canDrag=="function","Expected canDrag to be a function."),s.invariant(typeof t.beginDrag=="function","Expected beginDrag to be a function."),s.invariant(typeof t.endDrag=="function","Expected endDrag to be a function.")}function be(t){s.invariant(typeof t.canDrop=="function","Expected canDrop to be a function."),s.invariant(typeof t.hover=="function","Expected hover to be a function."),s.invariant(typeof t.drop=="function","Expected beginDrag to be a function.")}function T(t,e){if(e&&Array.isArray(t)){t.forEach(r=>T(r,!1));return}s.invariant(typeof t=="string"||typeof t=="symbol",e?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var u;(function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"})(u||(u={}));let ve=0;function Te(){return ve++}function Ee(t){const e=Te().toString();switch(t){case u.SOURCE:return`S${e}`;case u.TARGET:return`T${e}`;default:throw new Error(`Unknown Handler Role: ${t}`)}}function w(t){switch(t[0]){case"S":return u.SOURCE;case"T":return u.TARGET;default:throw new Error(`Cannot parse handler ID: ${t}`)}}function P(t,e){const r=t.entries();let n=!1;do{const{done:i,value:[,o]}=r.next();if(o===e)return!0;n=!!i}while(!n);return!1}class Ie{addSource(e,r){T(e),De(r);const n=this.addHandler(u.SOURCE,e,r);return this.store.dispatch(he(n)),n}addTarget(e,r){T(e,!0),be(r);const n=this.addHandler(u.TARGET,e,r);return this.store.dispatch(ye(n)),n}containsHandler(e){return P(this.dragSources,e)||P(this.dropTargets,e)}getSource(e,r=!1){return s.invariant(this.isSourceId(e),"Expected a valid source ID."),r&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return s.invariant(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return s.invariant(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return s.invariant(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return w(e)===u.SOURCE}isTargetId(e){return w(e)===u.TARGET}removeSource(e){s.invariant(this.getSource(e),"Expected an existing source."),this.store.dispatch(Se(e)),s.asap(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){s.invariant(this.getTarget(e),"Expected an existing target."),this.store.dispatch(Oe(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const r=this.getSource(e);s.invariant(r,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=r}unpinSource(){s.invariant(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,r,n){const i=Ee(e);return this.types.set(i,r),e===u.SOURCE?this.dragSources.set(i,n):e===u.TARGET&&this.dropTargets.set(i,n),i}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const me=(t,e)=>t===e;function Ce(t,e){return!t&&!e?!0:!t||!e?!1:t.x===e.x&&t.y===e.y}function Re(t,e,r=me){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(!r(t[n],e[n]))return!1;return!0}function xe(t=g,e){switch(e.type){case h:break;case C:case R:case O:case x:return g;case p:case I:case S:case y:default:return m}const{targetIds:r=[],prevTargetIds:n=[]}=e.payload,i=N(r,n);if(!(i.length>0||!Re(r,n)))return g;const a=n[n.length-1],c=r[r.length-1];return a!==c&&(a&&i.push(a),c&&i.push(c)),i}function _e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function we(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){_e(t,i,r[i])})}return t}const A={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Pe(t=A,e){const{payload:r}=e;switch(e.type){case E:case p:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case h:return Ce(t.clientOffset,r.clientOffset)?t:we({},t,{clientOffset:r.clientOffset});case S:case y:return A;default:return t}}function Ae(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){Ae(t,i,r[i])})}return t}const Ue={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Ge(t=Ue,e){const{payload:r}=e;switch(e.type){case p:return d({},t,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case I:return d({},t,{isSourcePublic:!0});case h:return d({},t,{targetIds:r.targetIds});case O:return t.targetIds.indexOf(r.targetId)===-1?t:d({},t,{targetIds:H(t.targetIds,r.targetId)});case y:return d({},t,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case S:return d({},t,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return t}}function $e(t=0,e){switch(e.type){case C:case R:return t+1;case x:case O:return t-1;default:return t}}function Me(t=0){return t+1}function je(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function He(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){je(t,i,r[i])})}return t}function Ne(t={},e){return{dirtyHandlerIds:xe(t.dirtyHandlerIds,{type:e.type,payload:He({},e.payload,{prevTargetIds:j(t,"dragOperation.targetIds",[])})}),dragOffset:Pe(t.dragOffset,e),refCount:$e(t.refCount,e),dragOperation:Ge(t.dragOperation,e),stateId:Me(t.stateId)}}function Le(t,e=void 0,r={},n=!1){const i=Ve(n),o=new pe(i,new Ie(i)),a=new ue(i,o),c=t(a,e,r);return a.receiveBackend(c),a}function Ve(t){const e=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return M.createStore(Ne,t&&e&&e({name:"dnd-core",instanceId:"dnd-core"}))}exports.createDragDropManager=Le;
|
|
1
|
+
"use strict";const M=require("./vendor-DeYnrakH.cjs"),s=require("./react-dnd-vendor-DvbjNa5U.cjs");function j(t,e,r){return e.split(".").reduce((n,i)=>n&&n[i]?n[i]:r||null,t)}function H(t,e){return t.filter(r=>r!==e)}function U(t){return typeof t=="object"}function N(t,e){const r=new Map,n=o=>{r.set(o,r.has(o)?r.get(o)+1:1)};t.forEach(n),e.forEach(n);const i=[];return r.forEach((o,a)=>{o===1&&i.push(a)}),i}function L(t,e){return t.filter(r=>e.indexOf(r)>-1)}const E="dnd-core/INIT_COORDS",p="dnd-core/BEGIN_DRAG",I="dnd-core/PUBLISH_DRAG_SOURCE",h="dnd-core/HOVER",y="dnd-core/DROP",S="dnd-core/END_DRAG";function _(t,e){return{type:E,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}const V={type:E,payload:{clientOffset:null,sourceClientOffset:null}};function k(t){return function(r=[],n={publishSource:!0}){const{publishSource:i=!0,clientOffset:o,getSourceClientOffset:a}=n,c=t.getMonitor(),l=t.getRegistry();t.dispatch(_(o)),q(r,c,l);const f=X(r,c);if(f==null){t.dispatch(V);return}let D=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");B(a),D=a(f)}t.dispatch(_(o,D));const b=l.getSource(f).beginDrag(c,f);if(b==null)return;F(b),l.pinSource(f);const $=l.getSourceType(f);return{type:p,payload:{itemType:$,item:b,sourceId:f,clientOffset:o||null,sourceClientOffset:D||null,isSourcePublic:!!i}}}}function q(t,e,r){s.invariant(!e.isDragging(),"Cannot call beginDrag while dragging."),t.forEach(function(n){s.invariant(r.getSource(n),"Expected sourceIds to be registered.")})}function B(t){s.invariant(typeof t=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function F(t){s.invariant(U(t),"Item must be an object.")}function X(t,e){let r=null;for(let n=t.length-1;n>=0;n--)if(e.canDragSource(t[n])){r=t[n];break}return r}function W(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function z(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){W(t,i,r[i])})}return t}function J(t){return function(r={}){const n=t.getMonitor(),i=t.getRegistry();Q(n),K(n).forEach((a,c)=>{const l=Y(a,c,i,n),f={type:y,payload:{dropResult:z({},r,l)}};t.dispatch(f)})}}function Q(t){s.invariant(t.isDragging(),"Cannot call drop while not dragging."),s.invariant(!t.didDrop(),"Cannot call drop twice during one drag operation.")}function Y(t,e,r,n){const i=r.getTarget(t);let o=i?i.drop(n,t):void 0;return Z(o),typeof o>"u"&&(o=e===0?{}:n.getDropResult()),o}function Z(t){s.invariant(typeof t>"u"||U(t),"Drop result must either be an object or undefined.")}function K(t){const e=t.getTargetIds().filter(t.canDropOnTarget,t);return e.reverse(),e}function ee(t){return function(){const r=t.getMonitor(),n=t.getRegistry();te(r);const i=r.getSourceId();return i!=null&&(n.getSource(i,!0).endDrag(r,i),n.unpinSource()),{type:S}}}function te(t){s.invariant(t.isDragging(),"Cannot call endDrag while not dragging.")}function v(t,e){return e===null?t===null:Array.isArray(t)?t.some(r=>r===e):t===e}function re(t){return function(r,{clientOffset:n}={}){ne(r);const i=r.slice(0),o=t.getMonitor(),a=t.getRegistry(),c=o.getItemType();return oe(i,a,c),ie(i,o,a),se(i,o,a),{type:h,payload:{targetIds:i,clientOffset:n||null}}}}function ne(t){s.invariant(Array.isArray(t),"Expected targetIds to be an array.")}function ie(t,e,r){s.invariant(e.isDragging(),"Cannot call hover while not dragging."),s.invariant(!e.didDrop(),"Cannot call hover after drop.");for(let n=0;n<t.length;n++){const i=t[n];s.invariant(t.lastIndexOf(i)===n,"Expected targetIds to be unique in the passed array.");const o=r.getTarget(i);s.invariant(o,"Expected targetIds to be registered.")}}function oe(t,e,r){for(let n=t.length-1;n>=0;n--){const i=t[n],o=e.getTargetType(i);v(o,r)||t.splice(n,1)}}function se(t,e,r){t.forEach(function(n){r.getTarget(n).hover(e,n)})}function ae(t){return function(){if(t.getMonitor().isDragging())return{type:I}}}function ce(t){return{beginDrag:k(t),publishDragSource:ae(t),hover:re(t),drop:J(t),endDrag:ee(t)}}class ue{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:r}=this.store;function n(o){return(...a)=>{const c=o.apply(e,a);typeof c<"u"&&r(c)}}const i=ce(this);return Object.keys(i).reduce((o,a)=>{const c=i[a];return o[a]=n(c),o},{})}dispatch(e){this.store.dispatch(e)}constructor(e,r){this.isSetUp=!1,this.handleRefCountChange=()=>{const n=this.store.getState().refCount>0;this.backend&&(n&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!n&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=r,e.subscribe(this.handleRefCountChange)}}function fe(t,e){return{x:t.x+e.x,y:t.y+e.y}}function G(t,e){return{x:t.x-e.x,y:t.y-e.y}}function le(t){const{clientOffset:e,initialClientOffset:r,initialSourceClientOffset:n}=t;return!e||!r||!n?null:G(fe(e,n),r)}function de(t){const{clientOffset:e,initialClientOffset:r}=t;return!e||!r?null:G(e,r)}const g=[],m=[];g.__IS_NONE__=!0;m.__IS_ALL__=!0;function ge(t,e){return t===g?!1:t===m||typeof e>"u"?!0:L(e,t).length>0}class pe{subscribeToStateChange(e,r={}){const{handlerIds:n}=r;s.invariant(typeof e=="function","listener must be a function."),s.invariant(typeof n>"u"||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let i=this.store.getState().stateId;const o=()=>{const a=this.store.getState(),c=a.stateId;try{c===i||c===i+1&&!ge(a.dirtyHandlerIds,n)||e()}finally{i=c}};return this.store.subscribe(o)}subscribeToOffsetChange(e){s.invariant(typeof e=="function","listener must be a function.");let r=this.store.getState().dragOffset;const n=()=>{const i=this.store.getState().dragOffset;i!==r&&(r=i,e())};return this.store.subscribe(n)}canDragSource(e){if(!e)return!1;const r=this.registry.getSource(e);return s.invariant(r,`Expected to find a valid source. sourceId=${e}`),this.isDragging()?!1:r.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const r=this.registry.getTarget(e);if(s.invariant(r,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;const n=this.registry.getTargetType(e),i=this.getItemType();return v(n,i)&&r.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;const r=this.registry.getSource(e,!0);if(s.invariant(r,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic())return!1;const n=this.registry.getSourceType(e),i=this.getItemType();return n!==i?!1:r.isDragging(this,e)}isOverTarget(e,r={shallow:!1}){if(!e)return!1;const{shallow:n}=r;if(!this.isDragging())return!1;const i=this.registry.getTargetType(e),o=this.getItemType();if(o&&!v(i,o))return!1;const a=this.getTargetIds();if(!a.length)return!1;const c=a.indexOf(e);return n?c===a.length-1:c>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return le(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return de(this.store.getState().dragOffset)}constructor(e,r){this.store=e,this.registry=r}}const C="dnd-core/ADD_SOURCE",R="dnd-core/ADD_TARGET",x="dnd-core/REMOVE_SOURCE",O="dnd-core/REMOVE_TARGET";function he(t){return{type:C,payload:{sourceId:t}}}function ye(t){return{type:R,payload:{targetId:t}}}function Se(t){return{type:x,payload:{sourceId:t}}}function Oe(t){return{type:O,payload:{targetId:t}}}function De(t){s.invariant(typeof t.canDrag=="function","Expected canDrag to be a function."),s.invariant(typeof t.beginDrag=="function","Expected beginDrag to be a function."),s.invariant(typeof t.endDrag=="function","Expected endDrag to be a function.")}function be(t){s.invariant(typeof t.canDrop=="function","Expected canDrop to be a function."),s.invariant(typeof t.hover=="function","Expected hover to be a function."),s.invariant(typeof t.drop=="function","Expected beginDrag to be a function.")}function T(t,e){if(e&&Array.isArray(t)){t.forEach(r=>T(r,!1));return}s.invariant(typeof t=="string"||typeof t=="symbol",e?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var u;(function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"})(u||(u={}));let ve=0;function Te(){return ve++}function Ee(t){const e=Te().toString();switch(t){case u.SOURCE:return`S${e}`;case u.TARGET:return`T${e}`;default:throw new Error(`Unknown Handler Role: ${t}`)}}function w(t){switch(t[0]){case"S":return u.SOURCE;case"T":return u.TARGET;default:throw new Error(`Cannot parse handler ID: ${t}`)}}function P(t,e){const r=t.entries();let n=!1;do{const{done:i,value:[,o]}=r.next();if(o===e)return!0;n=!!i}while(!n);return!1}class Ie{addSource(e,r){T(e),De(r);const n=this.addHandler(u.SOURCE,e,r);return this.store.dispatch(he(n)),n}addTarget(e,r){T(e,!0),be(r);const n=this.addHandler(u.TARGET,e,r);return this.store.dispatch(ye(n)),n}containsHandler(e){return P(this.dragSources,e)||P(this.dropTargets,e)}getSource(e,r=!1){return s.invariant(this.isSourceId(e),"Expected a valid source ID."),r&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return s.invariant(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return s.invariant(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return s.invariant(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return w(e)===u.SOURCE}isTargetId(e){return w(e)===u.TARGET}removeSource(e){s.invariant(this.getSource(e),"Expected an existing source."),this.store.dispatch(Se(e)),s.asap(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){s.invariant(this.getTarget(e),"Expected an existing target."),this.store.dispatch(Oe(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const r=this.getSource(e);s.invariant(r,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=r}unpinSource(){s.invariant(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,r,n){const i=Ee(e);return this.types.set(i,r),e===u.SOURCE?this.dragSources.set(i,n):e===u.TARGET&&this.dropTargets.set(i,n),i}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const me=(t,e)=>t===e;function Ce(t,e){return!t&&!e?!0:!t||!e?!1:t.x===e.x&&t.y===e.y}function Re(t,e,r=me){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(!r(t[n],e[n]))return!1;return!0}function xe(t=g,e){switch(e.type){case h:break;case C:case R:case O:case x:return g;case p:case I:case S:case y:default:return m}const{targetIds:r=[],prevTargetIds:n=[]}=e.payload,i=N(r,n);if(!(i.length>0||!Re(r,n)))return g;const a=n[n.length-1],c=r[r.length-1];return a!==c&&(a&&i.push(a),c&&i.push(c)),i}function _e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function we(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){_e(t,i,r[i])})}return t}const A={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Pe(t=A,e){const{payload:r}=e;switch(e.type){case E:case p:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case h:return Ce(t.clientOffset,r.clientOffset)?t:we({},t,{clientOffset:r.clientOffset});case S:case y:return A;default:return t}}function Ae(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){Ae(t,i,r[i])})}return t}const Ue={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Ge(t=Ue,e){const{payload:r}=e;switch(e.type){case p:return d({},t,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case I:return d({},t,{isSourcePublic:!0});case h:return d({},t,{targetIds:r.targetIds});case O:return t.targetIds.indexOf(r.targetId)===-1?t:d({},t,{targetIds:H(t.targetIds,r.targetId)});case y:return d({},t,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case S:return d({},t,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return t}}function $e(t=0,e){switch(e.type){case C:case R:return t+1;case x:case O:return t-1;default:return t}}function Me(t=0){return t+1}function je(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function He(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{},n=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable}))),n.forEach(function(i){je(t,i,r[i])})}return t}function Ne(t={},e){return{dirtyHandlerIds:xe(t.dirtyHandlerIds,{type:e.type,payload:He({},e.payload,{prevTargetIds:j(t,"dragOperation.targetIds",[])})}),dragOffset:Pe(t.dragOffset,e),refCount:$e(t.refCount,e),dragOperation:Ge(t.dragOperation,e),stateId:Me(t.stateId)}}function Le(t,e=void 0,r={},n=!1){const i=Ve(n),o=new pe(i,new Ie(i)),a=new ue(i,o),c=t(a,e,r);return a.receiveBackend(c),a}function Ve(t){const e=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return M.createStore(Ne,t&&e&&e({name:"dnd-core",instanceId:"dnd-core"}))}exports.createDragDropManager=Le;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const A=require("./vendor-
|
|
1
|
+
"use strict";const A=require("./vendor-DeYnrakH.cjs");var Z={OPERATION_DEFINITION:"OperationDefinition"};class J extends Error{constructor(t,n,a,c,l,s,f){super(t),this.name="GraphQLError",this.message=t,l&&(this.path=l),n&&(this.nodes=Array.isArray(n)?n:[n]),a&&(this.source=a),c&&(this.positions=c),s&&(this.originalError=s);var p=f;if(!p&&s){var v=s.extensions;v&&typeof v=="object"&&(p=v)}this.extensions=p||{}}toJSON(){return{...this,message:this.message}}toString(){return this.message}get[Symbol.toStringTag](){return"GraphQLError"}}var i,r;function m(e){return new J(`Syntax Error: Unexpected token at ${r} in ${e}`)}function R(e){if(e.lastIndex=r,e.test(i))return i.slice(r,r=e.lastIndex)}var _=/ +(?=[^\s])/y;function ee(e){for(var t=e.split(`
|
|
2
2
|
`),n="",a=0,c=0,l=t.length-1,s=0;s<t.length;s++)_.lastIndex=0,_.test(t[s])&&(s&&(!a||_.lastIndex<a)&&(a=_.lastIndex),c=c||s,l=s);for(var f=c;f<=l;f++)f!==c&&(n+=`
|
|
3
3
|
`),n+=t[f].slice(a).replace(/\\"""/g,'"""');return n}function u(){for(var e=0|i.charCodeAt(r++);e===9||e===10||e===13||e===32||e===35||e===44||e===65279;e=0|i.charCodeAt(r++))if(e===35)for(;(e=0|i.charCodeAt(r++))&&e!==10&&e!==13;);r--}function M(){for(var e=r,t=0|i.charCodeAt(r++);t>=48&&t<=57||t>=65&&t<=90||t===95||t>=97&&t<=122;t=0|i.charCodeAt(r++));if(e===r-1)throw m("Name");var n=i.slice(e,--r);return u(),n}function k(){return{kind:"Name",value:M()}}var te=/(?:"""|(?:[\s\S]*?[^\\])""")/y,re=/(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y;function x(e){var t;switch(i.charCodeAt(r)){case 91:r++,u();for(var n=[];i.charCodeAt(r)!==93;)n.push(x(e));return r++,u(),{kind:"ListValue",values:n};case 123:r++,u();for(var a=[];i.charCodeAt(r)!==125;){var c=k();if(i.charCodeAt(r++)!==58)throw m("ObjectField");u(),a.push({kind:"ObjectField",name:c,value:x(e)})}return r++,u(),{kind:"ObjectValue",fields:a};case 36:if(e)throw m("Variable");return r++,{kind:"Variable",name:k()};case 34:if(i.charCodeAt(r+1)===34&&i.charCodeAt(r+2)===34){if(r+=3,(t=R(te))==null)throw m("StringValue");return u(),{kind:"StringValue",value:ee(t.slice(0,-3)),block:!0}}else{var l=r,s;r++;var f=!1;for(s=0|i.charCodeAt(r++);s===92&&(r++,f=!0)||s!==10&&s!==13&&s!==34&&s;s=0|i.charCodeAt(r++));if(s!==34)throw m("StringValue");return t=i.slice(l,r),u(),{kind:"StringValue",value:f?JSON.parse(t):t.slice(1,-1),block:!1}}case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:for(var p=r++,v;(v=0|i.charCodeAt(r++))>=48&&v<=57;);var h=i.slice(p,--r);if((v=i.charCodeAt(r))===46||v===69||v===101){if((t=R(re))==null)throw m("FloatValue");return u(),{kind:"FloatValue",value:h+t}}else return u(),{kind:"IntValue",value:h};case 110:if(i.charCodeAt(r+1)===117&&i.charCodeAt(r+2)===108&&i.charCodeAt(r+3)===108)return r+=4,u(),{kind:"NullValue"};break;case 116:if(i.charCodeAt(r+1)===114&&i.charCodeAt(r+2)===117&&i.charCodeAt(r+3)===101)return r+=4,u(),{kind:"BooleanValue",value:!0};break;case 102:if(i.charCodeAt(r+1)===97&&i.charCodeAt(r+2)===108&&i.charCodeAt(r+3)===115&&i.charCodeAt(r+4)===101)return r+=5,u(),{kind:"BooleanValue",value:!1};break}return{kind:"EnumValue",value:M()}}function W(e){if(i.charCodeAt(r)===40){var t=[];r++,u();do{var n=k();if(i.charCodeAt(r++)!==58)throw m("Argument");u(),t.push({kind:"Argument",name:n,value:x(e)})}while(i.charCodeAt(r)!==41);return r++,u(),t}}function b(e){if(i.charCodeAt(r)===64){var t=[];do r++,t.push({kind:"Directive",name:k(),arguments:W(e)});while(i.charCodeAt(r)===64);return t}}function ne(){for(var e=0;i.charCodeAt(r)===91;)e++,r++,u();var t={kind:"NamedType",name:k()};do if(i.charCodeAt(r)===33&&(r++,u(),t={kind:"NonNullType",type:t}),e){if(i.charCodeAt(r++)!==93)throw m("NamedType");u(),t={kind:"ListType",type:t}}while(e--);return t}function j(){if(i.charCodeAt(r++)!==123)throw m("SelectionSet");return u(),L()}function L(){var e=[];do if(i.charCodeAt(r)===46){if(i.charCodeAt(++r)!==46||i.charCodeAt(++r)!==46)throw m("SelectionSet");switch(r++,u(),i.charCodeAt(r)){case 64:e.push({kind:"InlineFragment",typeCondition:void 0,directives:b(!1),selectionSet:j()});break;case 111:i.charCodeAt(r+1)===110?(r+=2,u(),e.push({kind:"InlineFragment",typeCondition:{kind:"NamedType",name:k()},directives:b(!1),selectionSet:j()})):e.push({kind:"FragmentSpread",name:k(),directives:b(!1)});break;case 123:r++,u(),e.push({kind:"InlineFragment",typeCondition:void 0,directives:void 0,selectionSet:L()});break;default:e.push({kind:"FragmentSpread",name:k(),directives:b(!1)})}}else{var t=k(),n=void 0;i.charCodeAt(r)===58&&(r++,u(),n=t,t=k());var a=W(!1),c=b(!1),l=void 0;i.charCodeAt(r)===123&&(r++,u(),l=L()),e.push({kind:"Field",alias:n,name:t,arguments:a,directives:c,selectionSet:l})}while(i.charCodeAt(r)!==125);return r++,u(),{kind:"SelectionSet",selections:e}}function ie(){if(u(),i.charCodeAt(r)===40){var e=[];r++,u();do{var t=void 0;if(i.charCodeAt(r)===34&&(t=x(!0)),i.charCodeAt(r++)!==36)throw m("Variable");var n=k();if(i.charCodeAt(r++)!==58)throw m("VariableDefinition");u();var a=ne(),c=void 0;i.charCodeAt(r)===61&&(r++,u(),c=x(!0)),u();var l={kind:"VariableDefinition",variable:{kind:"Variable",name:n},type:a,defaultValue:c,directives:b(!0)};t&&(l.description=t),e.push(l)}while(i.charCodeAt(r)!==41);return r++,u(),e}}function ae(e){var t=k();if(i.charCodeAt(r++)!==111||i.charCodeAt(r++)!==110)throw m("FragmentDefinition");u();var n={kind:"FragmentDefinition",name:t,typeCondition:{kind:"NamedType",name:k()},directives:b(!1),selectionSet:j()};return e&&(n.description=e),n}function B(){var e=[];do{var t=void 0;if(i.charCodeAt(r)===34&&(t=x(!0)),i.charCodeAt(r)===123){if(t)throw m("Document");r++,u(),e.push({kind:"OperationDefinition",operation:"query",name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:L()})}else{var n=M();switch(n){case"fragment":e.push(ae(t));break;case"query":case"mutation":case"subscription":var a,c=void 0;(a=i.charCodeAt(r))!==40&&a!==64&&a!==123&&(c=k());var l={kind:"OperationDefinition",operation:n,name:c,variableDefinitions:ie(),directives:b(!1),selectionSet:j()};t&&(l.description=t),e.push(l);break;default:throw m("Document")}}}while(r<i.length);return e}function oe(e,t){return i=e.body?e.body:e,r=0,u(),t&&t.noLocation?{kind:"Document",definitions:B()}:{kind:"Document",definitions:B(),loc:{start:0,end:i.length,startToken:void 0,endToken:void 0,source:{body:i,name:"graphql.web",locationOffset:{line:1,column:1}}}}}function g(e,t,n){for(var a="",c=0;c<e.length;c++)c&&(a+=t),a+=n(e[c]);return a}function se(e){return JSON.stringify(e)}function ce(e){return`"""
|
|
4
4
|
`+e.replace(/"""/g,'\\"""')+`
|
package/dist/hooks.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),c=require("./services-human-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),c=require("./services-human-DFPelsei.cjs"),l=require("./types.cjs");require("./lodash-vendor-CfNg9qwP.cjs");require("./moment-vendor-1cRqq0AH.cjs");const f=require("./graphql-vendor-CSrUjvOC.cjs"),p=require("urql"),P=require("./providers.cjs");require("./react-jsx-runtime-vendor-Dszzpdy0.cjs");require("./graphql-Dm6zPwG7.cjs");const d=(e,s)=>u.useMemo(()=>e.flatMap(o=>c.getEnabledJointPlanes(o,s).map(t=>({id:{joint:o},plane:t,...c.getDefaultJointRange(o,t),sensorOnly:s===l.AngleDataSource.Sensor}))),[e,s]),b=(e,s)=>{const n=u.useMemo(()=>{const t=c.getAllAvailableLimbs();return e.filter(a=>t.some(r=>r.id===a))},[e]);return u.useMemo(()=>n.flatMap(t=>c.getEnabledSegmentPlanes(t,s).map(a=>({id:{segment:t},plane:a,...c.getDefaultLimbRange(t,a),sensorOnly:s===l.AngleDataSource.Sensor}))),[n,s])},S=()=>{const e=u.useMemo(()=>c.getAllAvailableLimbs(),[]),s=u.useMemo(()=>c.getAllAvailablePoseJoints(),[]),n=b(e.map(r=>r.id),l.AngleDataSource.Pose),o=d(s.map(r=>r.id),l.AngleDataSource.Pose),t=b(e.map(r=>r.id),l.AngleDataSource.Sensor),a=d(s.map(r=>r.id),l.AngleDataSource.Sensor);return u.useMemo(()=>{const r=new Map;return[...o,...n].forEach(i=>{const m="joint"in i.id?`joint:${i.id.joint}:${i.plane}`:`segment:${i.id.segment}:${i.plane}`;r.set(m,{...i,sensorOnly:!1})}),[...a,...t].forEach(i=>{const m="joint"in i.id?`joint:${i.id.joint}:${i.plane}`:`segment:${i.id.segment}:${i.plane}`;r.has(m)||r.set(m,{...i,sensorOnly:!0})}),Array.from(r.values())},[o,n,a,t])},h=({url:e,getAuthToken:s})=>new p.Client({url:e,requestPolicy:"cache-and-network",exchanges:[f.authExchange(n=>{const o=s();return Promise.resolve({addAuthToOperation(t){return o?n.appendHeaders(t,{Authorization:`Bearer ${o}`}):t},didAuthError:t=>/unauthorized/gi.test(t?.message),refreshAuth:()=>Promise.resolve()})}),p.fetchExchange]}),q=({url:e,getAuthToken:s})=>u.useMemo(()=>h({url:e,getAuthToken:s}),[e,s]),g=e=>{const s=c.getAllAvailableJoints();return u.useMemo(()=>s.filter(n=>n.id==="NavalSpine"||n.id==="ChestSpine"?!1:c.limbsRequiredForJoints[n.id].every(t=>e.includes(t))),[e,s])},L=e=>{const s=u.useMemo(()=>e.map(l.sensorLocationToLimbId).filter(o=>!!o),[e]);return g(s)},A=e=>u.useMemo(()=>{const n=c.getAllAvailableLimbs(),o=e.map(l.sensorLocationToLimbId);return n.filter(t=>o.includes(t.id))},[e]),O=e=>{const s=A(e),n=L(e),o=d(n.map(a=>a.id),l.AngleDataSource.Sensor),t=b(s.map(a=>a.id),l.AngleDataSource.Sensor);return[...o,...t]},v=()=>{const e=u.useContext(P.UiLabelContext);if(e===void 0)throw new Error("useUiLabelContext must be used within a UiLabelProvider");return e};exports.useAllPartParameters=S;exports.useGraphqlClient=q;exports.useJointsForLimbIds=g;exports.useJointsForSensorLocations=L;exports.useLimbsForSensorLocations=A;exports.usePartOptionsForJoints=d;exports.usePartOptionsForLimbs=b;exports.usePartOptionsForSensorLocations=O;exports.useUiLabelContext=v;
|
package/dist/hooks.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useMemo as l, useContext as b } from "react";
|
|
2
|
-
import { h as g, i as h, j as p, k as L, l as P, m as O, n as A, o as J } from "./services-human-
|
|
2
|
+
import { h as g, i as h, j as p, k as L, l as P, m as O, n as A, o as J } from "./services-human-D5IllQkM.js";
|
|
3
3
|
import { AngleDataSource as m, sensorLocationToLimbId as f } from "./types.js";
|
|
4
|
-
import "./lodash-vendor-
|
|
4
|
+
import "./lodash-vendor-CY4G3-79.js";
|
|
5
5
|
import "./moment-vendor-DMLRxgRE.js";
|
|
6
|
-
import { a as v } from "./graphql-vendor-
|
|
6
|
+
import { a as v } from "./graphql-vendor-ipMKtdBu.js";
|
|
7
7
|
import { Client as x, fetchExchange as y } from "urql";
|
|
8
8
|
import { UiLabelContext as S } from "./providers.js";
|
|
9
9
|
import "./react-jsx-runtime-vendor-OVHDjVDe.js";
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./other-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./other-B_xypnnb.cjs");const r=require("./components.cjs"),o=require("./hooks.cjs"),s=require("./providers.cjs"),n=require("./services-action-DBOzfgMl.cjs"),e=require("./services-human-DFPelsei.cjs"),m=require("./services.cjs"),t=require("./types.cjs"),g=require("./utils-cn-FIKrq5Mb.cjs"),i=require("./utils-conversion-DFO1UVSN.cjs"),d=require("./utils-memo-BJJP2KfI.cjs"),a=require("./utils-parameters-dwKmz1VU.cjs"),l=require("./utils-text-lORqO4uI.cjs");exports.ActivityList=r.ActivityList;exports.CopyActivityForm=r.CopyActivityForm;exports.CopyModuleForm=r.CopyModuleForm;exports.ModuleForm=r.ModuleForm;exports.ParameterEditList=r.ParameterEditList;exports.ParameterEditSelect=r.ParameterEditSelect;exports.UpsertActivityForm=r.UpsertActivityForm;exports.UpsertModuleForm=r.UpsertModuleForm;exports.useAllPartParameters=o.useAllPartParameters;exports.useGraphqlClient=o.useGraphqlClient;exports.useJointsForLimbIds=o.useJointsForLimbIds;exports.useJointsForSensorLocations=o.useJointsForSensorLocations;exports.useLimbsForSensorLocations=o.useLimbsForSensorLocations;exports.usePartOptionsForJoints=o.usePartOptionsForJoints;exports.usePartOptionsForLimbs=o.usePartOptionsForLimbs;exports.usePartOptionsForSensorLocations=o.usePartOptionsForSensorLocations;exports.useUiLabelContext=o.useUiLabelContext;exports.QuantumLibraryProvider=s.QuantumLibraryProvider;exports.UiLabelContext=s.UiLabelContext;exports.UiLabelProvider=s.UiLabelProvider;exports.getActivityKindFromActivityType=n.getActivityKindFromActivityType;exports.mapActivityTypeEnumToLabel=n.mapActivityTypeEnumToLabel;exports.mapSessionTypeEnumToLabel=n.mapSessionTypeEnumToLabel;exports.getAllAvailableJoints=e.getAllAvailableJoints;exports.getAllAvailableLimbs=e.getAllAvailableLimbs;exports.getAllAvailablePoseJoints=e.getAllAvailablePoseJoints;exports.getAllAvailablePoseLimbs=e.getAllAvailablePoseLimbs;exports.getAllAvailableSensorJoints=e.getAllAvailableSensorJoints;exports.getAngleDirectionNames=e.getAngleDirectionNames;exports.getAvailableLimbsForLimbIds=e.getAvailableLimbsForLimbIds;exports.getAvailablePoseJointsForLimbIds=e.getAvailablePoseJointsForLimbIds;exports.getAvailableSensorJointsForLimbIds=e.getAvailableSensorJointsForLimbIds;exports.getAxis=e.getAxis;exports.getDefaultAngleSource=e.getDefaultAngleSource;exports.getDefaultJointRange=e.getDefaultJointRange;exports.getDefaultLimbRange=e.getDefaultLimbRange;exports.getEnabledJointPlanes=e.getEnabledJointPlanes;exports.getEnabledSegmentPlanes=e.getEnabledSegmentPlanes;exports.getHumanBodyAngle=e.getHumanBodyAngle;exports.getIsDefaultAngleAllowed=e.getIsDefaultAngleAllowed;exports.getJointAngleDirectionAbbr=e.getJointAngleDirectionAbbr;exports.getJointAngleDirectionName=e.getJointAngleDirectionName;exports.getJointNameWithPlane=e.getJointNameWithPlane;exports.getJointOrSegmentNameWithPlane=e.getJointOrSegmentNameWithPlane;exports.getJointPlaneName=e.getJointPlaneName;exports.getNormativeJointRange=e.getNormativeJointRange;exports.getParameterAngleDirectionName=e.getParameterAngleDirectionName;exports.getParameterDirectionNames=e.getParameterDirectionNames;exports.getPartName=e.getPartName;exports.getPartNameNoSide=e.getPartNameNoSide;exports.getPlane=e.getPlane;exports.getSegmentAngleDirectionAbbr=e.getSegmentAngleDirectionAbbr;exports.getSegmentAngleDirectionName=e.getSegmentAngleDirectionName;exports.getSegmentNameWithPlane=e.getSegmentNameWithPlane;exports.getSegmentXyzName=e.getSegmentXyzName;exports.getSuggestedSensorLocations=e.getSuggestedSensorLocations;exports.getTypicalRom=e.getTypicalRom;exports.getTypicalRomSize=e.getTypicalRomSize;exports.isAxis=e.isAxis;exports.isJoint=e.isJoint;exports.isLimb=e.isLimb;exports.isPlane=e.isPlane;exports.jointNames=e.jointNames;exports.jointsUsedByLimbs=e.jointsUsedByLimbs;exports.limbNames=e.limbNames;exports.limbsRequiredForJoints=e.limbsRequiredForJoints;exports.mkAccelerationPart=e.mkAccelerationPart;exports.mkAngularVelocityPart=e.mkAngularVelocityPart;exports.mkHumanPart=e.mkHumanPart;exports.mkJointPart=e.mkJointPart;exports.mkLimbPart=e.mkLimbPart;exports.planeOrAxis=e.planeOrAxis;exports.reportKindName=m.reportKindName;exports.AngleDataSource=t.AngleDataSource;exports.analysisStatBuilder=t.analysisStatBuilder;exports.areThresholdsEmpty=t.areThresholdsEmpty;exports.availablePlanes=t.availablePlanes;exports.axes=t.axes;exports.canBeVerticalForce=t.canBeVerticalForce;exports.dimensionName=t.dimensionName;exports.dimensionToLegacy=t.dimensionToLegacy;exports.getAnalysisName=t.getAnalysisName;exports.getAnalysisPartIdNoSide=t.getAnalysisPartIdNoSide;exports.getJointIdNoSide=t.getJointIdNoSide;exports.getJointIdWithSide=t.getJointIdWithSide;exports.getLimbIdNoSide=t.getLimbIdNoSide;exports.getLimbIdWithSide=t.getLimbIdWithSide;exports.getPointSide=t.getPointSide;exports.isDeviceEqual=t.isDeviceEqual;exports.isLimbTrackingFrame=t.isLimbTrackingFrame;exports.isSyncError=t.isSyncError;exports.jointAngle=t.jointAngle;exports.jointOrLimbHasThreshold=t.jointOrLimbHasThreshold;exports.jointOrLimbThresholdCount=t.jointOrLimbThresholdCount;exports.limbAngle=t.limbAngle;exports.mkUnit=t.mkUnit;exports.partAndPlaneHasThreshold=t.partAndPlaneHasThreshold;exports.partIdName=t.partIdName;exports.partIdToJointLimbId=t.partIdToJointLimbId;exports.partIdToString=t.partIdToString;exports.partKinds=t.partKinds;exports.planes=t.planes;exports.sensorLocationName=t.sensorLocationName;exports.sensorLocationToLimbId=t.sensorLocationToLimbId;exports.thresholdForPart=t.thresholdForPart;exports.thresholdFragmentsToThresholds=t.thresholdFragmentsToThresholds;exports.thresholdsToInput=t.thresholdsToInput;exports.tryMkUnit=t.tryMkUnit;exports.updateThreshold=t.updateThreshold;exports.cn=g.cn;exports.degToRad=i.degToRad;exports.getFormatterForParameter=i.getFormatterForParameter;exports.getUnitFormatted=i.getUnitFormatted;exports.getUnitValueFormatted=i.getUnitValueFormatted;exports.hourMinSecStrToMs=i.hourMinSecStrToMs;exports.inchesToMeters=i.inchesToMeters;exports.kgToPounds=i.kgToPounds;exports.metersToInches=i.metersToInches;exports.msToDurationStr=i.msToDurationStr;exports.msToHourMinSecStr=i.msToHourMinSecStr;exports.msToPrettyStr=i.msToPrettyStr;exports.msToTimestampStr=i.msToTimestampStr;exports.poundsToKg=i.poundsToKg;exports.radToDeg=i.radToDeg;exports.sToTimestampStr=i.sToTimestampStr;exports.safelyConvertEnum=i.safelyConvertEnum;exports.secondsToTimestampStr=i.secondsToTimestampStr;exports.memo=d.memo;exports.parameterToThreshold=a.parameterToThreshold;exports.parametersToThresholds=a.parametersToThresholds;exports.thresholdToParameter=a.thresholdToParameter;exports.thresholdsToParameters=a.thresholdsToParameters;exports.capitalizeAll=l.capitalizeAll;exports.pluralize=l.pluralize;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import "./other-
|
|
1
|
+
import "./other-CPHWCRXi.js";
|
|
2
2
|
import { ActivityList as s, CopyActivityForm as o, CopyModuleForm as i, ModuleForm as r, ParameterEditList as n, ParameterEditSelect as m, UpsertActivityForm as l, UpsertModuleForm as g } from "./components.js";
|
|
3
3
|
import { useAllPartParameters as p, useGraphqlClient as b, useJointsForLimbIds as c, useJointsForSensorLocations as A, useLimbsForSensorLocations as T, usePartOptionsForJoints as u, usePartOptionsForLimbs as P, usePartOptionsForSensorLocations as S, useUiLabelContext as h } from "./hooks.js";
|
|
4
4
|
import { QuantumLibraryProvider as y, UiLabelContext as F, UiLabelProvider as N } from "./providers.js";
|
|
5
5
|
import { g as v, m as f, a as x } from "./services-action-CfZFwhy-.js";
|
|
6
|
-
import { n as D, j as k, m as E, u as U, t as M, U as C, s as O, w as R, v as j, J as H, O as W, i as z, l as B, h as K, k as q, Q as V, P as w, x as G, b as Q, a as X, T as Y, R as Z, d as _, W as $, V as ee, e as ae, L as te, K as se, y as oe, c as ie, g as re, S as ne, f as me, M as le, N as ge, D as de, G as pe, F as be, E as ce, q as Ae, r as Te, p as ue, o as Pe, B as Se, C as he, H as Le, z as ye, A as Fe, I as Ne } from "./services-human-
|
|
6
|
+
import { n as D, j as k, m as E, u as U, t as M, U as C, s as O, w as R, v as j, J as H, O as W, i as z, l as B, h as K, k as q, Q as V, P as w, x as G, b as Q, a as X, T as Y, R as Z, d as _, W as $, V as ee, e as ae, L as te, K as se, y as oe, c as ie, g as re, S as ne, f as me, M as le, N as ge, D as de, G as pe, F as be, E as ce, q as Ae, r as Te, p as ue, o as Pe, B as Se, C as he, H as Le, z as ye, A as Fe, I as Ne } from "./services-human-D5IllQkM.js";
|
|
7
7
|
import { reportKindName as ve } from "./services.js";
|
|
8
8
|
import { AngleDataSource as xe, analysisStatBuilder as Ie, areThresholdsEmpty as De, availablePlanes as ke, axes as Ee, canBeVerticalForce as Ue, dimensionName as Me, dimensionToLegacy as Ce, getAnalysisName as Oe, getAnalysisPartIdNoSide as Re, getJointIdNoSide as je, getJointIdWithSide as He, getLimbIdNoSide as We, getLimbIdWithSide as ze, getPointSide as Be, isDeviceEqual as Ke, isLimbTrackingFrame as qe, isSyncError as Ve, jointAngle as we, jointOrLimbHasThreshold as Ge, jointOrLimbThresholdCount as Qe, limbAngle as Xe, mkUnit as Ye, partAndPlaneHasThreshold as Ze, partIdName as _e, partIdToJointLimbId as $e, partIdToString as ea, partKinds as aa, planes as ta, sensorLocationName as sa, sensorLocationToLimbId as oa, thresholdForPart as ia, thresholdFragmentsToThresholds as ra, thresholdsToInput as na, tryMkUnit as ma, updateThreshold as la } from "./types.js";
|
|
9
9
|
import { c as da } from "./utils-cn-CgdSr4hO.js";
|
|
10
|
-
import { d as ba, n as ca, j as Aa, g as Ta, h as ua, i as Pa, k as Sa, m as ha, a as La, e as ya, c as Fa, b as Na, p as Ja, r as va, s as fa, l as xa, f as Ia } from "./utils-conversion-
|
|
10
|
+
import { d as ba, n as ca, j as Aa, g as Ta, h as ua, i as Pa, k as Sa, m as ha, a as La, e as ya, c as Fa, b as Na, p as Ja, r as va, s as fa, l as xa, f as Ia } from "./utils-conversion-BQfLNP0g.js";
|
|
11
11
|
import { m as ka } from "./utils-memo-DtXdOqCT.js";
|
|
12
12
|
import { p as Ua, a as Ma, t as Ca, b as Oa } from "./utils-parameters-DkefNhWo.js";
|
|
13
13
|
import { c as ja, p as Ha } from "./utils-text-CN3zLiZ7.js";
|