quantum-component-library 1.4.47-dev.11 → 1.4.47-dev.3

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/services.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./generated-graphql.cjs"),l=require("./types.cjs");require("./moment-vendor-1cRqq0AH.cjs");const m=require("./utils.cjs"),j=e=>{switch(e){case o.ActivityType.IsolatedMovement:return"Isolated Movement";case o.ActivityType.FunctionalMovement:return"Functional Movement";case o.ActivityType.ActionPrecursor:return"Action Precursor";case o.ActivityType.IsolatedAction:return"Isolated Action"}},I=e=>{switch(e){case o.SessionType.BiofeedbackTraining:return"Biofeedback (Training)";case o.SessionType.BiofeedbackTesting:return"Biofeedback (Testing)";case o.SessionType.RecordedTesting:return"Recorded (Testing)"}},$=e=>{switch(e){case o.ActivityType.IsolatedMovement:return o.ActionActivityKind.Movement;case o.ActivityType.FunctionalMovement:return o.ActionActivityKind.Movement;case o.ActivityType.ActionPrecursor:return o.ActionActivityKind.Action;case o.ActivityType.IsolatedAction:return o.ActionActivityKind.Action;default:return o.ActionActivityKind.Action}},z={sagittal:{__COMMENT__:"-Plantar Flexion, +Dorsi flexion",min:-20,max:30},frontal:{__COMMENT__:"-Inversion, +Eversion",min:-30,max:20},transverse:{__COMMENT__:"-Pronation, +Supination",min:-10,max:10}},q={sagittal:{__COMMENT__:"-Plantar Flexion, +Dorsi flexion",min:-20,max:30},frontal:{__COMMENT__:"-Inversion, +Eversion",min:-30,max:20},transverse:{__COMMENT__:"-Pronation, +Supination",min:-10,max:10}},W={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-5,max:142},frontal:{__COMMENT__:"N/A",min:0,max:0},transverse:{__COMMENT__:"N/A",min:0,max:0}},V={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-5,max:142},frontal:{__COMMENT__:"N/A",min:0,max:0},transverse:{__COMMENT__:"N/A",min:0,max:0}},X={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-18,max:134},frontal:{__COMMENT__:"-Adduction, +Abduction",min:-20,max:40},transverse:{__COMMENT__:"-Internal Rotation, +External Rotation",min:-40,max:50}},G={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-18,max:134},frontal:{__COMMENT__:"-Adduction, +Abduction",min:-20,max:40},transverse:{__COMMENT__:"-Internal Rotation, +External Rotation",min:-40,max:50}},Q={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-75,max:60},frontal:{__COMMENT__:"-Bend Right, +Bend Left",min:-45,max:45},transverse:{__COMMENT__:"-Twist Right, +Twist Left",min:-80,max:80}},Y={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-25,max:50},frontal:{__COMMENT__:"-Bend Right, +Bend Left",min:-25,max:25},transverse:{__COMMENT__:"-Twist Right, +Twist Left",min:-30,max:30}},Z={__COMMENT__:"This is the sum of the ChestSpine and NavalSpine",sagittal:{__COMMENT__:"-Extension, +Flexion",min:-100,max:110},frontal:{__COMMENT__:"-Bend Right, +Bend Left",min:-70,max:70},transverse:{__COMMENT__:"-Twist Right, +Twist Left",min:-110,max:110}},ee={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-50,max:180},frontal:{__COMMENT__:"-Adduction, +Abduction",min:-50,max:180},transverse:{__COMMENT__:"-Internal Rotation, +External Rotation",min:-90,max:90}},te={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-50,max:180},frontal:{__COMMENT__:"-Adduction, +Abduction",min:-50,max:180},transverse:{__COMMENT__:"-Internal Rotation, +External Rotation",min:-90,max:90}},ne={sagittal:{__COMMENT__:"-Extension, +Flexion",min:0,max:140},frontal:{__COMMENT__:"N/A",min:0,max:0},transverse:{__COMMENT__:"-Pronation/+Supination (of forearm)",min:-80,max:80}},ae={sagittal:{__COMMENT__:"-Extension, +Flexion",min:0,max:140},frontal:{__COMMENT__:"N/A",min:0,max:0},transverse:{__COMMENT__:"-Pronation/+Supination (of forearm)",min:-80,max:80}},p={LeftAnkle:z,RightAnkle:q,LeftKnee:W,RightKnee:V,LeftHip:X,RightHip:G,NavalSpine:Q,ChestSpine:Y,TotalSpine:Z,LeftShoulder:ee,RightShoulder:te,LeftElbow:ne,RightElbow:ae},i={LeftFoot:"Left Foot",RightFoot:"Right Foot",LeftShank:"Left Shank",RightShank:"Right Shank",LeftThigh:"Left Thigh",RightThigh:"Right Thigh",LeftPelvis:"Left Pelvis",RightPelvis:"Right Pelvis",LowerBack:"Pelvis",CenterBack:"Center Back",UpperBack:"Thorax",Head:"Head",LeftClavicle:"Left Clavicle",RightClavicle:"Right Clavicle",LeftUpperArm:"Left Upper Arm",RightUpperArm:"Right Upper Arm",LeftForearm:"Left Forearm",RightForearm:"Right Forearm"},a={LeftAnkle:"Left Ankle",RightAnkle:"Right Ankle",LeftKnee:"Left Knee",RightKnee:"Right Knee",LeftHip:"Left Hip",RightHip:"Right Hip",NavalSpine:"Lower Back",ChestSpine:"Upper Back",TotalSpine:"Total Spine",LeftShoulder:"Left Shoulder",RightShoulder:"Right Shoulder",LeftElbow:"Left Elbow",RightElbow:"Right Elbow",Neck:"Neck"},ie={LeftFoot:["LeftAnkle"],RightFoot:["RightAnkle"],LeftShank:["LeftKnee","LeftAnkle"],RightShank:["RightKnee","RightAnkle"],LeftThigh:["LeftHip","LeftKnee"],RightThigh:["RightHip","RightKnee"],LeftPelvis:["LeftHip"],RightPelvis:["RightHip"],LowerBack:["LeftHip","RightHip","NavalSpine","TotalSpine"],CenterBack:["NavalSpine","ChestSpine"],UpperBack:["ChestSpine","TotalSpine"],Head:["Neck"],LeftClavicle:["LeftShoulder"],RightClavicle:["RightShoulder"],LeftUpperArm:["LeftShoulder","LeftElbow"],RightUpperArm:["RightShoulder","RightElbow"],LeftForearm:["LeftElbow"],RightForearm:["RightElbow"]},d={LeftAnkle:["LeftFoot","LeftShank"],RightAnkle:["RightFoot","RightShank"],LeftKnee:["LeftShank","LeftThigh"],RightKnee:["RightShank","RightThigh"],LeftHip:["LeftThigh","LowerBack"],RightHip:["RightThigh","LowerBack"],NavalSpine:["LowerBack","CenterBack"],ChestSpine:["CenterBack","UpperBack"],TotalSpine:["UpperBack","LowerBack"],LeftShoulder:["LeftClavicle","LeftUpperArm"],RightShoulder:["RightClavicle","RightUpperArm"],LeftElbow:["LeftUpperArm","LeftForearm"],RightElbow:["RightUpperArm","RightForearm"],Neck:["Head","UpperBack"]},A=()=>[{id:"LeftFoot",name:i.LeftFoot},{id:"RightFoot",name:i.RightFoot},{id:"LeftShank",name:i.LeftShank},{id:"RightShank",name:i.RightShank},{id:"LeftThigh",name:i.LeftThigh},{id:"RightThigh",name:i.RightThigh},{id:"LowerBack",name:i.LowerBack},{id:"CenterBack",name:i.CenterBack},{id:"UpperBack",name:i.UpperBack},{id:"Head",name:i.Head},{id:"LeftUpperArm",name:i.LeftUpperArm},{id:"RightUpperArm",name:i.RightUpperArm},{id:"LeftForearm",name:i.LeftForearm},{id:"RightForearm",name:i.RightForearm}],re=e=>A().filter(t=>e.find(n=>n==t.id)),x=()=>[{id:"LeftAnkle",name:a.LeftAnkle},{id:"RightAnkle",name:a.RightAnkle},{id:"LeftKnee",name:a.LeftKnee},{id:"RightKnee",name:a.RightKnee},{id:"LeftHip",name:a.LeftHip},{id:"RightHip",name:a.RightHip},{id:"NavalSpine",name:a.NavalSpine},{id:"ChestSpine",name:a.ChestSpine},{id:"TotalSpine",name:a.TotalSpine},{id:"LeftShoulder",name:a.LeftShoulder},{id:"RightShoulder",name:a.RightShoulder},{id:"LeftElbow",name:a.LeftElbow},{id:"RightElbow",name:a.RightElbow},{id:"Neck",name:a.Neck}],_=()=>[{id:"LeftAnkle",name:a.LeftAnkle},{id:"RightAnkle",name:a.RightAnkle},{id:"LeftKnee",name:a.LeftKnee},{id:"RightKnee",name:a.RightKnee},{id:"LeftHip",name:a.LeftHip},{id:"RightHip",name:a.RightHip},{id:"NavalSpine",name:a.NavalSpine},{id:"ChestSpine",name:a.ChestSpine},{id:"TotalSpine",name:a.TotalSpine},{id:"LeftShoulder",name:a.LeftShoulder},{id:"RightShoulder",name:a.RightShoulder},{id:"Neck",name:a.Neck}],S=()=>[{id:"LeftAnkle",name:a.LeftAnkle},{id:"RightAnkle",name:a.RightAnkle},{id:"LeftKnee",name:a.LeftKnee},{id:"RightKnee",name:a.RightKnee},{id:"LeftHip",name:a.LeftHip},{id:"RightHip",name:a.RightHip},{id:"TotalSpine",name:a.TotalSpine},{id:"LeftShoulder",name:a.LeftShoulder},{id:"RightShoulder",name:a.RightShoulder},{id:"LeftElbow",name:a.LeftElbow},{id:"RightElbow",name:a.RightElbow},{id:"Neck",name:a.Neck}],se=()=>[{id:"Head",name:i.Head},{id:"LeftThigh",name:i.LeftThigh},{id:"RightThigh",name:i.RightThigh},{id:"LeftShank",name:i.LeftShank},{id:"RightShank",name:i.RightShank},{id:"LeftFoot",name:i.LeftFoot},{id:"RightFoot",name:i.RightFoot},{id:"LowerBack",name:i.LowerBack},{id:"UpperBack",name:i.UpperBack},{id:"LeftUpperArm",name:i.LeftUpperArm},{id:"RightUpperArm",name:i.RightUpperArm},{id:"LeftForearm",name:i.LeftForearm},{id:"RightForearm",name:i.RightForearm}],oe=e=>_().filter(n=>d[n.id].every(r=>e.includes(r))),ce=e=>S().filter(n=>d[n.id].every(r=>e.includes(r))),k=(e,t,n)=>{if(n)return["frontal","sagittal","transverse"];switch(e){case"LeftKnee":case"RightKnee":return["sagittal"];case"LeftAnkle":case"RightAnkle":return t&&t==l.AngleDataSource.Pose?["sagittal"]:["frontal","sagittal"];case"TotalSpine":return t&&t==l.AngleDataSource.Pose?["frontal"]:["frontal","sagittal","transverse"];case"LeftElbow":case"RightElbow":return t&&t==l.AngleDataSource.Pose?["sagittal"]:["frontal","sagittal","transverse"]}return t&&t==l.AngleDataSource.Pose?["frontal","sagittal"]:["frontal","sagittal","transverse"]},v=(e,t)=>{if(t===l.AngleDataSource.Sensor)return["frontal","sagittal","transverse"];switch(e){case"Head":case"LeftThigh":case"RightThigh":case"LeftShank":case"RightShank":case"LeftUpperArm":case"RightUpperArm":case"LeftForearm":case"RightForearm":return["frontal","sagittal"];case"LeftFoot":case"RightFoot":return["sagittal"];case"LowerBack":return["frontal"];case"UpperBack":return["frontal","sagittal"]}return[]},T=m.memo((e,t,n)=>{switch(e){case"LeftAnkle":case"RightAnkle":switch(t){case"frontal":return n<0?"inversion":"eversion";case"sagittal":return n<0?"plantar flexion":"dorsi flexion";case"transverse":return n<0?"internal rotation":"external rotation"}case"LeftKnee":case"RightKnee":switch(t){case"frontal":return n<0?"adduction":"abduction";case"sagittal":return n<0?"extension":"flexion";case"transverse":return n<0?"internal rotation":"external rotation"}case"LeftHip":case"RightHip":case"LeftShoulder":case"RightShoulder":switch(t){case"frontal":return n<0?"adduction":"abduction";case"sagittal":return n<0?"extension":"flexion";case"transverse":return n<0?"internal rotation":"external rotation"}case"NavalSpine":case"ChestSpine":case"TotalSpine":case"Neck":switch(t){case"frontal":return n<0?"right lateral flexion":"left lateral flexion";case"sagittal":return n<0?"extension":"flexion";case"transverse":return n<0?"right rotation":"left rotation"}case"LeftElbow":case"RightElbow":switch(t){case"frontal":return null;case"sagittal":return n<0?"extension":"flexion";case"transverse":return n<0?"pronation":"supination"}}return null}),b=m.memo((e,t,n)=>{switch(e){case"LeftAnkle":case"RightAnkle":switch(t){case"frontal":return n<0?"Inv.":"Ev.";case"sagittal":return n<0?"PF.":"DF.";case"transverse":return n<0?"IR.":"ER."}case"LeftKnee":case"RightKnee":switch(t){case"frontal":return n<0?"Add.":"Abd.";case"sagittal":return n<0?"Ext.":"Flex.";case"transverse":return n<0?"IR.":"ER."}case"LeftHip":case"RightHip":case"LeftShoulder":case"RightShoulder":switch(t){case"frontal":return n<0?"Add.":"Abd.";case"sagittal":return n<0?"Ext.":"Flex.";case"transverse":return n<0?"IR.":"ER."}case"NavalSpine":case"ChestSpine":case"TotalSpine":case"Neck":switch(t){case"frontal":return n<0?"R. Bend":"L. Bend";case"sagittal":return n<0?"Ext.":"Flex.";case"transverse":return n<0?"R. Rot.":"L. Rot."}case"LeftElbow":case"RightElbow":switch(t){case"frontal":return null;case"sagittal":return n<0?"Ext.":"Flex.";case"transverse":return n<0?"Pro.":"Sup."}}return null}),L=m.memo((e,t,n)=>{switch(e){case"LowerBack":case"LeftPelvis":case"RightPelvis":switch(t){case"frontal":return n<0?"right drop":"left drop";case"sagittal":return n<0?"anterior tilt":"posterior tilt";case"transverse":return n<0?"right rotation":"left rotation"}case"Head":case"UpperBack":case"CenterBack":case"LeftShank":case"RightShank":case"LeftThigh":case"RightThigh":case"LeftFoot":case"RightFoot":case"LeftUpperArm":case"RightUpperArm":case"LeftForearm":case"RightForearm":switch(t){case"frontal":return n<0?"right tilt":"left tilt";case"sagittal":return n<0?"anterior tilt":"posterior tilt";case"transverse":return n<0?"right rotation":"left rotation"}default:return null}}),E=m.memo((e,t,n)=>{switch(e){case"LowerBack":case"LeftPelvis":case"RightPelvis":switch(t){case"frontal":return n<0?"R. Drop":"L. Drop";case"sagittal":return n<0?"Ant. Tilt":"Pos. Tilt";case"transverse":return n<0?"R. Rot.":"L. Rot."}case"Head":case"UpperBack":case"CenterBack":case"LeftShank":case"RightShank":case"LeftThigh":case"RightThigh":case"LeftFoot":case"RightFoot":case"LeftUpperArm":case"RightUpperArm":case"LeftForearm":case"RightForearm":switch(t){case"frontal":return n<0?"R. Tilt":"L. Tilt";case"sagittal":return n<0?"Ant. Tilt":"Pos. Tilt";case"transverse":return n<0?"R. Rot.":"L. Rot."}default:return null}}),le=m.memo((e,t)=>{switch(e){case"LeftAnkle":case"RightAnkle":switch(t){case"frontal":return{min:-20,max:20};case"sagittal":return{min:-30,max:30};case"transverse":return{min:-5,max:5}}case"LeftKnee":case"RightKnee":switch(t){case"frontal":return{min:-5,max:5};case"sagittal":return{min:-5,max:90};case"transverse":return{min:-5,max:5}}case"LeftHip":case"RightHip":return{min:-30,max:30};case"LeftShoulder":case"RightShoulder":return{min:-50,max:50};case"NavalSpine":case"ChestSpine":case"TotalSpine":case"Neck":switch(t){case"frontal":return{min:-5,max:5};case"sagittal":return{min:-5,max:5};case"transverse":return{min:-5,max:5}}case"LeftElbow":case"RightElbow":switch(t){case"frontal":return{min:-5,max:5};case"sagittal":return{min:-5,max:50};case"transverse":return{min:-5,max:5}}}return{min:-10,max:10}}),me=m.memo((e,t)=>{switch(e){case"LeftFoot":case"RightFoot":switch(t){case"frontal":return{min:-20,max:20};case"sagittal":return{min:-30,max:30};case"transverse":return{min:-5,max:5}}case"LeftShank":case"RightShank":switch(t){case"frontal":return{min:-35,max:35};case"sagittal":return{min:-35,max:35};case"transverse":return{min:-5,max:5}}case"LeftThigh":case"RightThigh":switch(t){case"frontal":return{min:-35,max:35};case"sagittal":return{min:-35,max:35};case"transverse":return{min:-10,max:5}}case"LeftPelvis":case"RightPelvis":switch(t){case"frontal":return{min:-15,max:15};case"sagittal":return{min:-10,max:10};case"transverse":return{min:-10,max:10}}case"LowerBack":case"CenterBack":case"UpperBack":case"Head":return{min:-5,max:5};case"LeftClavicle":case"RightClavicle":switch(t){case"frontal":return{min:-15,max:15};case"sagittal":return{min:-10,max:10};case"transverse":return{min:-10,max:10}}case"LeftUpperArm":case"RightUpperArm":case"LeftForearm":case"RightForearm":switch(t){case"frontal":return{min:-45,max:45};case"sagittal":return{min:-45,max:45};case"transverse":return{min:-20,max:20}}}return{min:-10,max:10}}),ge=m.memo((e,t)=>{switch(e){case"LeftAnkle":case"RightAnkle":switch(t){case"frontal":return{min:-40,max:30};case"sagittal":return{min:-80,max:50};case"transverse":return{min:-90,max:90}}case"LeftKnee":case"RightKnee":switch(t){case"frontal":return{min:-15,max:5};case"sagittal":return{min:-10,max:160};case"transverse":return{min:-35,max:45}}case"LeftHip":case"RightHip":switch(t){case"frontal":return{min:-50,max:60};case"sagittal":return{min:-50,max:150};case"transverse":return{min:-60,max:70}}case"TotalSpine":switch(t){case"frontal":return{min:-60,max:60};case"sagittal":return{min:-50,max:150};case"transverse":return{min:-50,max:50}}case"ChestSpine":switch(t){case"frontal":return{min:-25,max:25};case"sagittal":return{min:-25,max:40};case"transverse":return{min:-35,max:35}}case"NavalSpine":switch(t){case"frontal":return{min:-25,max:25};case"sagittal":return{min:-35,max:60};case"transverse":return{min:-15,max:15}}default:return{min:-180,max:180}}}),w=(e,t)=>({kind:"joint",value:e,plane:t}),N=(e,t)=>({kind:"limb",value:e,plane:t}),F=(e,t)=>({kind:"acceleration",value:e,axis:t}),M=(e,t)=>({kind:"angular_velocity",value:e,plane:t}),P=e=>l.axes.includes(e),he=e=>l.planes.includes(e),C=e=>typeof e=="object"&&e!==null&&"id"in e&&"name"in e&&!!A().find(t=>t.id===e.id),y=e=>typeof e=="object"&&e!==null&&"id"in e&&"name"in e&&!!x().find(t=>t.id===e.id),fe=(e,t,n=!1)=>P(t)?C(e)?F(e,t):de(`Can't make acceleration part from joint: ${e} ${t}`):y(e)?n?M(e,t):w(e,t):N(e,t),ue=e=>e.kind==="acceleration"?e.axis:e.plane,Le=e=>e?.kind==="acceleration"?e.axis:null,Re=e=>e?.kind==="acceleration"?null:e?.plane??null,de=e=>{throw new Error(e)},g=e=>e in a?a[e]:e in i?i[e]:"Unknown",Ae=e=>g(e).replace(/Left|Right/g,""),pe=e=>e in p,B=(e,t)=>{if(!pe(e))return null;const n=p[e];if(t in n){const{min:s,max:r}=n[t];return{min:s??0,max:r??0}}return null},xe=(...e)=>{const t=B(...e);return t?Math.abs(t.max-t.min):0},H=(e,t)=>{const n=Object.keys(i).find(r=>r===t),s=Object.keys(a).find(r=>r===t);return!n&&!s?null:n?e.limbs[t].sensor_angle?l.AngleDataSource.Sensor:l.AngleDataSource.Pose:e.joints[t].sensor_angle?l.AngleDataSource.Sensor:l.AngleDataSource.Pose},_e=(e,t,n)=>{const s=Object.keys(a).find(c=>c===t),r=H(e,t);return r?s?k(t,r).includes(n):v(t,r).includes(n):!1},Se=(e,t,n)=>{const s=Object.keys(i).find(c=>c===t),r=Object.keys(a).find(c=>c===t);if(!s&&!r)throw new Error(`Unknown partId: ${t} - this invariant should've been enforced by typescript`);return s?l.limbAngle(e.limbs[t])?.[n]??null:l.jointAngle(e.joints[t],void 0,e.direction)?.[n]??null},u=(e=!1)=>e?"Internal/External Rotation":"External/Internal Rotation",O=(e,t,n=!1)=>{switch(e){case"LeftAnkle":case"RightAnkle":switch(t){case"frontal":return n?"Inversion/Eversion":"Eversion/Inversion";case"sagittal":return n?"Plantar/Dorsi Flexion":"Dorsi/Plantar Flexion";case"transverse":return u(n)}case"LeftKnee":case"RightKnee":switch(t){case"frontal":return n?"Adduction/Abduction":"Abduction/Adduction";case"sagittal":return n?"Extension/Flexion":"Flexion/Extension";case"transverse":return u(n)}case"LeftHip":case"RightHip":switch(t){case"frontal":return n?"Adduction/Abduction":"Abduction/Adduction";case"sagittal":return n?"Extension/Flexion":"Flexion/Extension";case"transverse":return u(n)}case"NavalSpine":case"ChestSpine":case"TotalSpine":case"Neck":switch(t){case"frontal":return"Lateral Bend";case"sagittal":return n?"Extension/Flexion":"Flexion/Extension";case"transverse":return"Rotation"}case"LeftShoulder":case"RightShoulder":switch(t){case"frontal":return n?"Adduction/Abduction":"Abduction/Adduction";case"sagittal":return n?"Extension/Flexion":"Flexion/Extension";case"transverse":return u(n)}case"LeftElbow":case"RightElbow":switch(t){case"frontal":return n?"Adduction/Abduction":"Abduction/Adduction";case"sagittal":return n?"Extension/Flexion":"Flexion/Extension";case"transverse":return n?"Pronation/Supination":"Supination/Pronation"}}},K=(e,t,n=!1)=>{const s=g(e),r=L(e,t,1),c=L(e,t,-1);if(r&&c){const h=m.capitalizeAll(r),f=m.capitalizeAll(c),D=n?`${f}/${h}`:`${h}/${f}`;return`${s} (${D})`}return`${s} (${t})`},ke=(e,t)=>{let n;switch(t){case"x":n="Med./Lat.";break;case"y":n="Vertical";break;case"z":n="Ant./Post."}return`${g(e)} ${n}`},U=(e,t,n=!1)=>{const s=g(e),r=O(e,t,n);return r?`${s} (${r})`:null},ve=(e,t)=>U(e,t)||K(e,t),R=(e,t,n,s=!1)=>{const r=s?b:T,c=s?E:L,[h,f]=e==="joint"?[r(t,n,1),r(t,n,-1)]:[c(t,n,1),c(t,n,-1)];return{positive:h,negative:f}},J=(e,t=!1)=>e.partKind==="joint"?R("joint",e.partId,e.partDimension,t):R("segment",e.partId,e.partDimension,t),Te=(e,t,n=!1)=>{const{positive:s,negative:r}=J(t,n);return e>=0?s:r};exports.getActivityKindFromActivityType=$;exports.getAllAvailableJoints=x;exports.getAllAvailableLimbs=A;exports.getAllAvailablePoseJoints=S;exports.getAllAvailablePoseLimbs=se;exports.getAllAvailableSensorJoints=_;exports.getAngleDirectionNames=R;exports.getAvailableLimbsForLimbIds=re;exports.getAvailablePoseJointsForLimbIds=ce;exports.getAvailableSensorJointsForLimbIds=oe;exports.getAxis=Le;exports.getDefaultAngleSource=H;exports.getDefaultJointRange=le;exports.getDefaultLimbRange=me;exports.getEnabledJointPlanes=k;exports.getEnabledSegmentPlanes=v;exports.getHumanBodyAngle=Se;exports.getIsDefaultAngleAllowed=_e;exports.getJointAngleDirectionAbbr=b;exports.getJointAngleDirectionName=T;exports.getJointNameWithPlane=U;exports.getJointOrSegmentNameWithPlane=ve;exports.getJointPlaneName=O;exports.getNormativeJointRange=ge;exports.getParameterAngleDirectionName=Te;exports.getParameterDirectionNames=J;exports.getPartName=g;exports.getPartNameNoSide=Ae;exports.getPlane=Re;exports.getSegmentAngleDirectionAbbr=E;exports.getSegmentAngleDirectionName=L;exports.getSegmentNameWithPlane=K;exports.getSegmentXyzName=ke;exports.getTypicalRom=B;exports.getTypicalRomSize=xe;exports.isAxis=P;exports.isJoint=y;exports.isLimb=C;exports.isPlane=he;exports.jointNames=a;exports.jointsUsedByLimbs=ie;exports.limbNames=i;exports.limbsRequiredForJoints=d;exports.mapActivityTypeEnumToLabel=j;exports.mapSessionTypeEnumToLabel=I;exports.mkAccelerationPart=F;exports.mkAngularVelocityPart=M;exports.mkHumanPart=fe;exports.mkJointPart=w;exports.mkLimbPart=N;exports.planeOrAxis=ue;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./generated-Cis5yU-9.cjs"),l=require("./types.cjs");require("./moment-vendor-1cRqq0AH.cjs");const m=require("./utils.cjs"),j=e=>{switch(e){case o.ActivityType.IsolatedMovement:return"Isolated Movement";case o.ActivityType.FunctionalMovement:return"Functional Movement";case o.ActivityType.ActionPrecursor:return"Action Precursor";case o.ActivityType.IsolatedAction:return"Isolated Action"}},I=e=>{switch(e){case o.SessionType.BiofeedbackTraining:return"Biofeedback (Training)";case o.SessionType.BiofeedbackTesting:return"Biofeedback (Testing)";case o.SessionType.RecordedTesting:return"Recorded (Testing)"}},$=e=>{switch(e){case o.ActivityType.IsolatedMovement:return o.ActionActivityKind.Movement;case o.ActivityType.FunctionalMovement:return o.ActionActivityKind.Movement;case o.ActivityType.ActionPrecursor:return o.ActionActivityKind.Action;case o.ActivityType.IsolatedAction:return o.ActionActivityKind.Action;default:return o.ActionActivityKind.Action}},z={sagittal:{__COMMENT__:"-Plantar Flexion, +Dorsi flexion",min:-20,max:30},frontal:{__COMMENT__:"-Inversion, +Eversion",min:-30,max:20},transverse:{__COMMENT__:"-Pronation, +Supination",min:-10,max:10}},q={sagittal:{__COMMENT__:"-Plantar Flexion, +Dorsi flexion",min:-20,max:30},frontal:{__COMMENT__:"-Inversion, +Eversion",min:-30,max:20},transverse:{__COMMENT__:"-Pronation, +Supination",min:-10,max:10}},W={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-5,max:142},frontal:{__COMMENT__:"N/A",min:0,max:0},transverse:{__COMMENT__:"N/A",min:0,max:0}},V={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-5,max:142},frontal:{__COMMENT__:"N/A",min:0,max:0},transverse:{__COMMENT__:"N/A",min:0,max:0}},X={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-18,max:134},frontal:{__COMMENT__:"-Adduction, +Abduction",min:-20,max:40},transverse:{__COMMENT__:"-Internal Rotation, +External Rotation",min:-40,max:50}},G={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-18,max:134},frontal:{__COMMENT__:"-Adduction, +Abduction",min:-20,max:40},transverse:{__COMMENT__:"-Internal Rotation, +External Rotation",min:-40,max:50}},Q={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-75,max:60},frontal:{__COMMENT__:"-Bend Right, +Bend Left",min:-45,max:45},transverse:{__COMMENT__:"-Twist Right, +Twist Left",min:-80,max:80}},Y={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-25,max:50},frontal:{__COMMENT__:"-Bend Right, +Bend Left",min:-25,max:25},transverse:{__COMMENT__:"-Twist Right, +Twist Left",min:-30,max:30}},Z={__COMMENT__:"This is the sum of the ChestSpine and NavalSpine",sagittal:{__COMMENT__:"-Extension, +Flexion",min:-100,max:110},frontal:{__COMMENT__:"-Bend Right, +Bend Left",min:-70,max:70},transverse:{__COMMENT__:"-Twist Right, +Twist Left",min:-110,max:110}},ee={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-50,max:180},frontal:{__COMMENT__:"-Adduction, +Abduction",min:-50,max:180},transverse:{__COMMENT__:"-Internal Rotation, +External Rotation",min:-90,max:90}},te={sagittal:{__COMMENT__:"-Extension, +Flexion",min:-50,max:180},frontal:{__COMMENT__:"-Adduction, +Abduction",min:-50,max:180},transverse:{__COMMENT__:"-Internal Rotation, +External Rotation",min:-90,max:90}},ne={sagittal:{__COMMENT__:"-Extension, +Flexion",min:0,max:140},frontal:{__COMMENT__:"N/A",min:0,max:0},transverse:{__COMMENT__:"-Pronation/+Supination (of forearm)",min:-80,max:80}},ae={sagittal:{__COMMENT__:"-Extension, +Flexion",min:0,max:140},frontal:{__COMMENT__:"N/A",min:0,max:0},transverse:{__COMMENT__:"-Pronation/+Supination (of forearm)",min:-80,max:80}},p={LeftAnkle:z,RightAnkle:q,LeftKnee:W,RightKnee:V,LeftHip:X,RightHip:G,NavalSpine:Q,ChestSpine:Y,TotalSpine:Z,LeftShoulder:ee,RightShoulder:te,LeftElbow:ne,RightElbow:ae},i={LeftFoot:"Left Foot",RightFoot:"Right Foot",LeftShank:"Left Shank",RightShank:"Right Shank",LeftThigh:"Left Thigh",RightThigh:"Right Thigh",LeftPelvis:"Left Pelvis",RightPelvis:"Right Pelvis",LowerBack:"Pelvis",CenterBack:"Center Back",UpperBack:"Thorax",Head:"Head",LeftClavicle:"Left Clavicle",RightClavicle:"Right Clavicle",LeftUpperArm:"Left Upper Arm",RightUpperArm:"Right Upper Arm",LeftForearm:"Left Forearm",RightForearm:"Right Forearm"},a={LeftAnkle:"Left Ankle",RightAnkle:"Right Ankle",LeftKnee:"Left Knee",RightKnee:"Right Knee",LeftHip:"Left Hip",RightHip:"Right Hip",NavalSpine:"Lower Back",ChestSpine:"Upper Back",TotalSpine:"Total Spine",LeftShoulder:"Left Shoulder",RightShoulder:"Right Shoulder",LeftElbow:"Left Elbow",RightElbow:"Right Elbow",Neck:"Neck"},ie={LeftFoot:["LeftAnkle"],RightFoot:["RightAnkle"],LeftShank:["LeftKnee","LeftAnkle"],RightShank:["RightKnee","RightAnkle"],LeftThigh:["LeftHip","LeftKnee"],RightThigh:["RightHip","RightKnee"],LeftPelvis:["LeftHip"],RightPelvis:["RightHip"],LowerBack:["LeftHip","RightHip","NavalSpine","TotalSpine"],CenterBack:["NavalSpine","ChestSpine"],UpperBack:["ChestSpine","TotalSpine"],Head:["Neck"],LeftClavicle:["LeftShoulder"],RightClavicle:["RightShoulder"],LeftUpperArm:["LeftShoulder","LeftElbow"],RightUpperArm:["RightShoulder","RightElbow"],LeftForearm:["LeftElbow"],RightForearm:["RightElbow"]},d={LeftAnkle:["LeftFoot","LeftShank"],RightAnkle:["RightFoot","RightShank"],LeftKnee:["LeftShank","LeftThigh"],RightKnee:["RightShank","RightThigh"],LeftHip:["LeftThigh","LowerBack"],RightHip:["RightThigh","LowerBack"],NavalSpine:["LowerBack","CenterBack"],ChestSpine:["CenterBack","UpperBack"],TotalSpine:["UpperBack","LowerBack"],LeftShoulder:["LeftClavicle","LeftUpperArm"],RightShoulder:["RightClavicle","RightUpperArm"],LeftElbow:["LeftUpperArm","LeftForearm"],RightElbow:["RightUpperArm","RightForearm"],Neck:["Head","UpperBack"]},A=()=>[{id:"LeftFoot",name:i.LeftFoot},{id:"RightFoot",name:i.RightFoot},{id:"LeftShank",name:i.LeftShank},{id:"RightShank",name:i.RightShank},{id:"LeftThigh",name:i.LeftThigh},{id:"RightThigh",name:i.RightThigh},{id:"LowerBack",name:i.LowerBack},{id:"CenterBack",name:i.CenterBack},{id:"UpperBack",name:i.UpperBack},{id:"Head",name:i.Head},{id:"LeftUpperArm",name:i.LeftUpperArm},{id:"RightUpperArm",name:i.RightUpperArm},{id:"LeftForearm",name:i.LeftForearm},{id:"RightForearm",name:i.RightForearm}],se=e=>A().filter(t=>e.find(n=>n==t.id)),x=()=>[{id:"LeftAnkle",name:a.LeftAnkle},{id:"RightAnkle",name:a.RightAnkle},{id:"LeftKnee",name:a.LeftKnee},{id:"RightKnee",name:a.RightKnee},{id:"LeftHip",name:a.LeftHip},{id:"RightHip",name:a.RightHip},{id:"NavalSpine",name:a.NavalSpine},{id:"ChestSpine",name:a.ChestSpine},{id:"TotalSpine",name:a.TotalSpine},{id:"LeftShoulder",name:a.LeftShoulder},{id:"RightShoulder",name:a.RightShoulder},{id:"LeftElbow",name:a.LeftElbow},{id:"RightElbow",name:a.RightElbow},{id:"Neck",name:a.Neck}],_=()=>[{id:"LeftAnkle",name:a.LeftAnkle},{id:"RightAnkle",name:a.RightAnkle},{id:"LeftKnee",name:a.LeftKnee},{id:"RightKnee",name:a.RightKnee},{id:"LeftHip",name:a.LeftHip},{id:"RightHip",name:a.RightHip},{id:"NavalSpine",name:a.NavalSpine},{id:"ChestSpine",name:a.ChestSpine},{id:"TotalSpine",name:a.TotalSpine},{id:"LeftShoulder",name:a.LeftShoulder},{id:"RightShoulder",name:a.RightShoulder},{id:"Neck",name:a.Neck}],S=()=>[{id:"LeftAnkle",name:a.LeftAnkle},{id:"RightAnkle",name:a.RightAnkle},{id:"LeftKnee",name:a.LeftKnee},{id:"RightKnee",name:a.RightKnee},{id:"LeftHip",name:a.LeftHip},{id:"RightHip",name:a.RightHip},{id:"TotalSpine",name:a.TotalSpine},{id:"LeftShoulder",name:a.LeftShoulder},{id:"RightShoulder",name:a.RightShoulder},{id:"LeftElbow",name:a.LeftElbow},{id:"RightElbow",name:a.RightElbow},{id:"Neck",name:a.Neck}],re=()=>[{id:"Head",name:i.Head},{id:"LeftThigh",name:i.LeftThigh},{id:"RightThigh",name:i.RightThigh},{id:"LeftShank",name:i.LeftShank},{id:"RightShank",name:i.RightShank},{id:"LeftFoot",name:i.LeftFoot},{id:"RightFoot",name:i.RightFoot},{id:"LowerBack",name:i.LowerBack},{id:"UpperBack",name:i.UpperBack},{id:"LeftUpperArm",name:i.LeftUpperArm},{id:"RightUpperArm",name:i.RightUpperArm},{id:"LeftForearm",name:i.LeftForearm},{id:"RightForearm",name:i.RightForearm}],oe=e=>_().filter(n=>d[n.id].every(s=>e.includes(s))),ce=e=>S().filter(n=>d[n.id].every(s=>e.includes(s))),k=(e,t,n)=>{if(n)return["frontal","sagittal","transverse"];switch(e){case"LeftKnee":case"RightKnee":return["sagittal"];case"LeftAnkle":case"RightAnkle":return t&&t==l.AngleDataSource.Pose?["sagittal"]:["frontal","sagittal"];case"TotalSpine":return t&&t==l.AngleDataSource.Pose?["frontal"]:["frontal","sagittal","transverse"];case"LeftElbow":case"RightElbow":return t&&t==l.AngleDataSource.Pose?["sagittal"]:["frontal","sagittal","transverse"]}return t&&t==l.AngleDataSource.Pose?["frontal","sagittal"]:["frontal","sagittal","transverse"]},v=(e,t)=>{if(t===l.AngleDataSource.Sensor)return["frontal","sagittal","transverse"];switch(e){case"Head":case"LeftThigh":case"RightThigh":case"LeftShank":case"RightShank":case"LeftUpperArm":case"RightUpperArm":case"LeftForearm":case"RightForearm":return["frontal","sagittal"];case"LeftFoot":case"RightFoot":return["sagittal"];case"LowerBack":return["frontal"];case"UpperBack":return["frontal","sagittal"]}return[]},T=m.memo((e,t,n)=>{switch(e){case"LeftAnkle":case"RightAnkle":switch(t){case"frontal":return n<0?"inversion":"eversion";case"sagittal":return n<0?"plantar flexion":"dorsi flexion";case"transverse":return n<0?"internal rotation":"external rotation"}case"LeftKnee":case"RightKnee":switch(t){case"frontal":return n<0?"adduction":"abduction";case"sagittal":return n<0?"extension":"flexion";case"transverse":return n<0?"internal rotation":"external rotation"}case"LeftHip":case"RightHip":case"LeftShoulder":case"RightShoulder":switch(t){case"frontal":return n<0?"adduction":"abduction";case"sagittal":return n<0?"extension":"flexion";case"transverse":return n<0?"internal rotation":"external rotation"}case"NavalSpine":case"ChestSpine":case"TotalSpine":case"Neck":switch(t){case"frontal":return n<0?"right lateral flexion":"left lateral flexion";case"sagittal":return n<0?"extension":"flexion";case"transverse":return n<0?"right rotation":"left rotation"}case"LeftElbow":case"RightElbow":switch(t){case"frontal":return null;case"sagittal":return n<0?"extension":"flexion";case"transverse":return n<0?"pronation":"supination"}}return null}),b=m.memo((e,t,n)=>{switch(e){case"LeftAnkle":case"RightAnkle":switch(t){case"frontal":return n<0?"Inv.":"Ev.";case"sagittal":return n<0?"PF.":"DF.";case"transverse":return n<0?"IR.":"ER."}case"LeftKnee":case"RightKnee":switch(t){case"frontal":return n<0?"Add.":"Abd.";case"sagittal":return n<0?"Ext.":"Flex.";case"transverse":return n<0?"IR.":"ER."}case"LeftHip":case"RightHip":case"LeftShoulder":case"RightShoulder":switch(t){case"frontal":return n<0?"Add.":"Abd.";case"sagittal":return n<0?"Ext.":"Flex.";case"transverse":return n<0?"IR.":"ER."}case"NavalSpine":case"ChestSpine":case"TotalSpine":case"Neck":switch(t){case"frontal":return n<0?"R. Bend":"L. Bend";case"sagittal":return n<0?"Ext.":"Flex.";case"transverse":return n<0?"R. Rot.":"L. Rot."}case"LeftElbow":case"RightElbow":switch(t){case"frontal":return null;case"sagittal":return n<0?"Ext.":"Flex.";case"transverse":return n<0?"Pro.":"Sup."}}return null}),L=m.memo((e,t,n)=>{switch(e){case"LowerBack":case"LeftPelvis":case"RightPelvis":switch(t){case"frontal":return n<0?"right drop":"left drop";case"sagittal":return n<0?"anterior tilt":"posterior tilt";case"transverse":return n<0?"right rotation":"left rotation"}case"Head":case"UpperBack":case"CenterBack":case"LeftShank":case"RightShank":case"LeftThigh":case"RightThigh":case"LeftFoot":case"RightFoot":case"LeftUpperArm":case"RightUpperArm":case"LeftForearm":case"RightForearm":switch(t){case"frontal":return n<0?"right tilt":"left tilt";case"sagittal":return n<0?"anterior tilt":"posterior tilt";case"transverse":return n<0?"right rotation":"left rotation"}default:return null}}),E=m.memo((e,t,n)=>{switch(e){case"LowerBack":case"LeftPelvis":case"RightPelvis":switch(t){case"frontal":return n<0?"R. Drop":"L. Drop";case"sagittal":return n<0?"Ant. Tilt":"Pos. Tilt";case"transverse":return n<0?"R. Rot.":"L. Rot."}case"Head":case"UpperBack":case"CenterBack":case"LeftShank":case"RightShank":case"LeftThigh":case"RightThigh":case"LeftFoot":case"RightFoot":case"LeftUpperArm":case"RightUpperArm":case"LeftForearm":case"RightForearm":switch(t){case"frontal":return n<0?"R. Tilt":"L. Tilt";case"sagittal":return n<0?"Ant. Tilt":"Pos. Tilt";case"transverse":return n<0?"R. Rot.":"L. Rot."}default:return null}}),le=m.memo((e,t)=>{switch(e){case"LeftAnkle":case"RightAnkle":switch(t){case"frontal":return{min:-20,max:20};case"sagittal":return{min:-30,max:30};case"transverse":return{min:-5,max:5}}case"LeftKnee":case"RightKnee":switch(t){case"frontal":return{min:-5,max:5};case"sagittal":return{min:-5,max:90};case"transverse":return{min:-5,max:5}}case"LeftHip":case"RightHip":return{min:-30,max:30};case"LeftShoulder":case"RightShoulder":return{min:-50,max:50};case"NavalSpine":case"ChestSpine":case"TotalSpine":case"Neck":switch(t){case"frontal":return{min:-5,max:5};case"sagittal":return{min:-5,max:5};case"transverse":return{min:-5,max:5}}case"LeftElbow":case"RightElbow":switch(t){case"frontal":return{min:-5,max:5};case"sagittal":return{min:-5,max:50};case"transverse":return{min:-5,max:5}}}return{min:-10,max:10}}),me=m.memo((e,t)=>{switch(e){case"LeftFoot":case"RightFoot":switch(t){case"frontal":return{min:-20,max:20};case"sagittal":return{min:-30,max:30};case"transverse":return{min:-5,max:5}}case"LeftShank":case"RightShank":switch(t){case"frontal":return{min:-35,max:35};case"sagittal":return{min:-35,max:35};case"transverse":return{min:-5,max:5}}case"LeftThigh":case"RightThigh":switch(t){case"frontal":return{min:-35,max:35};case"sagittal":return{min:-35,max:35};case"transverse":return{min:-10,max:5}}case"LeftPelvis":case"RightPelvis":switch(t){case"frontal":return{min:-15,max:15};case"sagittal":return{min:-10,max:10};case"transverse":return{min:-10,max:10}}case"LowerBack":case"CenterBack":case"UpperBack":case"Head":return{min:-5,max:5};case"LeftClavicle":case"RightClavicle":switch(t){case"frontal":return{min:-15,max:15};case"sagittal":return{min:-10,max:10};case"transverse":return{min:-10,max:10}}case"LeftUpperArm":case"RightUpperArm":case"LeftForearm":case"RightForearm":switch(t){case"frontal":return{min:-45,max:45};case"sagittal":return{min:-45,max:45};case"transverse":return{min:-20,max:20}}}return{min:-10,max:10}}),ge=m.memo((e,t)=>{switch(e){case"LeftAnkle":case"RightAnkle":switch(t){case"frontal":return{min:-40,max:30};case"sagittal":return{min:-80,max:50};case"transverse":return{min:-90,max:90}}case"LeftKnee":case"RightKnee":switch(t){case"frontal":return{min:-15,max:5};case"sagittal":return{min:-10,max:160};case"transverse":return{min:-35,max:45}}case"LeftHip":case"RightHip":switch(t){case"frontal":return{min:-50,max:60};case"sagittal":return{min:-50,max:150};case"transverse":return{min:-60,max:70}}case"TotalSpine":switch(t){case"frontal":return{min:-60,max:60};case"sagittal":return{min:-50,max:150};case"transverse":return{min:-50,max:50}}case"ChestSpine":switch(t){case"frontal":return{min:-25,max:25};case"sagittal":return{min:-25,max:40};case"transverse":return{min:-35,max:35}}case"NavalSpine":switch(t){case"frontal":return{min:-25,max:25};case"sagittal":return{min:-35,max:60};case"transverse":return{min:-15,max:15}}default:return{min:-180,max:180}}}),w=(e,t)=>({kind:"joint",value:e,plane:t}),N=(e,t)=>({kind:"limb",value:e,plane:t}),F=(e,t)=>({kind:"acceleration",value:e,axis:t}),M=(e,t)=>({kind:"angular_velocity",value:e,plane:t}),P=e=>l.axes.includes(e),he=e=>l.planes.includes(e),C=e=>typeof e=="object"&&e!==null&&"id"in e&&"name"in e&&!!A().find(t=>t.id===e.id),y=e=>typeof e=="object"&&e!==null&&"id"in e&&"name"in e&&!!x().find(t=>t.id===e.id),fe=(e,t,n=!1)=>P(t)?C(e)?F(e,t):de(`Can't make acceleration part from joint: ${e} ${t}`):y(e)?n?M(e,t):w(e,t):N(e,t),ue=e=>e.kind==="acceleration"?e.axis:e.plane,Le=e=>e?.kind==="acceleration"?e.axis:null,Re=e=>e?.kind==="acceleration"?null:e?.plane??null,de=e=>{throw new Error(e)},g=e=>e in a?a[e]:e in i?i[e]:"Unknown",Ae=e=>g(e).replace(/Left|Right/g,""),pe=e=>e in p,B=(e,t)=>{if(!pe(e))return null;const n=p[e];if(t in n){const{min:r,max:s}=n[t];return{min:r??0,max:s??0}}return null},xe=(...e)=>{const t=B(...e);return t?Math.abs(t.max-t.min):0},H=(e,t)=>{const n=Object.keys(i).find(s=>s===t),r=Object.keys(a).find(s=>s===t);return!n&&!r?null:n?e.limbs[t].sensor_angle?l.AngleDataSource.Sensor:l.AngleDataSource.Pose:e.joints[t].sensor_angle?l.AngleDataSource.Sensor:l.AngleDataSource.Pose},_e=(e,t,n)=>{const r=Object.keys(a).find(c=>c===t),s=H(e,t);return s?r?k(t,s).includes(n):v(t,s).includes(n):!1},Se=(e,t,n)=>{const r=Object.keys(i).find(c=>c===t),s=Object.keys(a).find(c=>c===t);if(!r&&!s)throw new Error(`Unknown partId: ${t} - this invariant should've been enforced by typescript`);return r?l.limbAngle(e.limbs[t])?.[n]??null:l.jointAngle(e.joints[t],void 0,e.direction)?.[n]??null},u=(e=!1)=>e?"Internal/External Rotation":"External/Internal Rotation",O=(e,t,n=!1)=>{switch(e){case"LeftAnkle":case"RightAnkle":switch(t){case"frontal":return n?"Inversion/Eversion":"Eversion/Inversion";case"sagittal":return n?"Plantar/Dorsi Flexion":"Dorsi/Plantar Flexion";case"transverse":return u(n)}case"LeftKnee":case"RightKnee":switch(t){case"frontal":return n?"Adduction/Abduction":"Abduction/Adduction";case"sagittal":return n?"Extension/Flexion":"Flexion/Extension";case"transverse":return u(n)}case"LeftHip":case"RightHip":switch(t){case"frontal":return n?"Adduction/Abduction":"Abduction/Adduction";case"sagittal":return n?"Extension/Flexion":"Flexion/Extension";case"transverse":return u(n)}case"NavalSpine":case"ChestSpine":case"TotalSpine":case"Neck":switch(t){case"frontal":return"Lateral Bend";case"sagittal":return n?"Extension/Flexion":"Flexion/Extension";case"transverse":return"Rotation"}case"LeftShoulder":case"RightShoulder":switch(t){case"frontal":return n?"Adduction/Abduction":"Abduction/Adduction";case"sagittal":return n?"Extension/Flexion":"Flexion/Extension";case"transverse":return u(n)}case"LeftElbow":case"RightElbow":switch(t){case"frontal":return n?"Adduction/Abduction":"Abduction/Adduction";case"sagittal":return n?"Extension/Flexion":"Flexion/Extension";case"transverse":return n?"Pronation/Supination":"Supination/Pronation"}}},K=(e,t,n=!1)=>{const r=g(e),s=L(e,t,1),c=L(e,t,-1);if(s&&c){const h=m.capitalizeAll(s),f=m.capitalizeAll(c),D=n?`${f}/${h}`:`${h}/${f}`;return`${r} (${D})`}return`${r} (${t})`},ke=(e,t)=>{let n;switch(t){case"x":n="Med./Lat.";break;case"y":n="Vertical";break;case"z":n="Ant./Post."}return`${g(e)} ${n}`},U=(e,t,n=!1)=>{const r=g(e),s=O(e,t,n);return s?`${r} (${s})`:null},ve=(e,t)=>U(e,t)||K(e,t),R=(e,t,n,r=!1)=>{const s=r?b:T,c=r?E:L,[h,f]=e==="joint"?[s(t,n,1),s(t,n,-1)]:[c(t,n,1),c(t,n,-1)];return{positive:h,negative:f}},J=(e,t=!1)=>e.partKind==="joint"?R("joint",e.partId,e.partDimension,t):R("segment",e.partId,e.partDimension,t),Te=(e,t,n=!1)=>{const{positive:r,negative:s}=J(t,n);return e>=0?r:s};exports.getActivityKindFromActivityType=$;exports.getAllAvailableJoints=x;exports.getAllAvailableLimbs=A;exports.getAllAvailablePoseJoints=S;exports.getAllAvailablePoseLimbs=re;exports.getAllAvailableSensorJoints=_;exports.getAngleDirectionNames=R;exports.getAvailableLimbsForLimbIds=se;exports.getAvailablePoseJointsForLimbIds=ce;exports.getAvailableSensorJointsForLimbIds=oe;exports.getAxis=Le;exports.getDefaultAngleSource=H;exports.getDefaultJointRange=le;exports.getDefaultLimbRange=me;exports.getEnabledJointPlanes=k;exports.getEnabledSegmentPlanes=v;exports.getHumanBodyAngle=Se;exports.getIsDefaultAngleAllowed=_e;exports.getJointAngleDirectionAbbr=b;exports.getJointAngleDirectionName=T;exports.getJointNameWithPlane=U;exports.getJointOrSegmentNameWithPlane=ve;exports.getJointPlaneName=O;exports.getNormativeJointRange=ge;exports.getParameterAngleDirectionName=Te;exports.getParameterDirectionNames=J;exports.getPartName=g;exports.getPartNameNoSide=Ae;exports.getPlane=Re;exports.getSegmentAngleDirectionAbbr=E;exports.getSegmentAngleDirectionName=L;exports.getSegmentNameWithPlane=K;exports.getSegmentXyzName=ke;exports.getTypicalRom=B;exports.getTypicalRomSize=xe;exports.isAxis=P;exports.isJoint=y;exports.isLimb=C;exports.isPlane=he;exports.jointNames=a;exports.jointsUsedByLimbs=ie;exports.limbNames=i;exports.limbsRequiredForJoints=d;exports.mapActivityTypeEnumToLabel=j;exports.mapSessionTypeEnumToLabel=I;exports.mkAccelerationPart=F;exports.mkAngularVelocityPart=M;exports.mkHumanPart=fe;exports.mkJointPart=w;exports.mkLimbPart=N;exports.planeOrAxis=ue;
package/dist/services.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ActivityType as l, SessionType as L, ActionActivityKind as h } from "./generated-graphql.js";
1
+ import { b as l, a as L, d as h } from "./generated-BTI7tPmv.js";
2
2
  import { axes as E, planes as T, AngleDataSource as c, limbAngle as v, jointAngle as w } from "./types.js";
3
3
  import "./moment-vendor-DMLRxgRE.js";
4
4
  import { memo as m, capitalizeAll as x } from "./utils.js";
@@ -194,7 +194,7 @@ const ue = (e) => {
194
194
  { id: "RightUpperArm", name: i.RightUpperArm },
195
195
  { id: "LeftForearm", name: i.LeftForearm },
196
196
  { id: "RightForearm", name: i.RightForearm }
197
- ], _e = (e) => $().filter((n) => A[n.id].every((r) => e.includes(r))), Ae = (e) => D().filter((n) => A[n.id].every((r) => e.includes(r))), I = (e, t, n) => {
197
+ ], _e = (e) => $().filter((n) => A[n.id].every((s) => e.includes(s))), Ae = (e) => D().filter((n) => A[n.id].every((s) => e.includes(s))), I = (e, t, n) => {
198
198
  if (n)
199
199
  return ["frontal", "sagittal", "transverse"];
200
200
  switch (e) {
@@ -648,34 +648,34 @@ const ue = (e) => {
648
648
  return null;
649
649
  const n = _[e];
650
650
  if (t in n) {
651
- const { min: s, max: r } = n[t];
651
+ const { min: r, max: s } = n[t];
652
652
  return {
653
- min: s ?? 0,
654
- max: r ?? 0
653
+ min: r ?? 0,
654
+ max: s ?? 0
655
655
  };
656
656
  }
657
657
  return null;
658
658
  }, Me = (...e) => {
659
659
  const t = ie(...e);
660
660
  return t ? Math.abs(t.max - t.min) : 0;
661
- }, re = (e, t) => {
662
- const n = Object.keys(i).find((r) => r === t), s = Object.keys(a).find((r) => r === t);
663
- return !n && !s ? null : n ? e.limbs[t].sensor_angle ? c.Sensor : c.Pose : e.joints[t].sensor_angle ? c.Sensor : c.Pose;
661
+ }, se = (e, t) => {
662
+ const n = Object.keys(i).find((s) => s === t), r = Object.keys(a).find((s) => s === t);
663
+ return !n && !r ? null : n ? e.limbs[t].sensor_angle ? c.Sensor : c.Pose : e.joints[t].sensor_angle ? c.Sensor : c.Pose;
664
664
  }, Ce = (e, t, n) => {
665
- const s = Object.keys(a).find((o) => o === t), r = re(e, t);
666
- return r ? s ? I(t, r).includes(n) : z(t, r).includes(n) : !1;
665
+ const r = Object.keys(a).find((o) => o === t), s = se(e, t);
666
+ return s ? r ? I(t, s).includes(n) : z(t, s).includes(n) : !1;
667
667
  }, Pe = (e, t, n) => {
668
- const s = Object.keys(i).find((o) => o === t), r = Object.keys(a).find((o) => o === t);
669
- if (!s && !r)
668
+ const r = Object.keys(i).find((o) => o === t), s = Object.keys(a).find((o) => o === t);
669
+ if (!r && !s)
670
670
  throw new Error(
671
671
  `Unknown partId: ${t} - this invariant should've been enforced by typescript`
672
672
  );
673
- return s ? v(e.limbs[t])?.[n] ?? null : w(
673
+ return r ? v(e.limbs[t])?.[n] ?? null : w(
674
674
  e.joints[t],
675
675
  void 0,
676
676
  e.direction
677
677
  )?.[n] ?? null;
678
- }, u = (e = !1) => e ? "Internal/External Rotation" : "External/Internal Rotation", se = (e, t, n = !1) => {
678
+ }, u = (e = !1) => e ? "Internal/External Rotation" : "External/Internal Rotation", re = (e, t, n = !1) => {
679
679
  switch (e) {
680
680
  case "LeftAnkle":
681
681
  case "RightAnkle":
@@ -741,12 +741,12 @@ const ue = (e) => {
741
741
  }
742
742
  }
743
743
  }, oe = (e, t, n = !1) => {
744
- const s = R(e), r = d(e, t, 1), o = d(e, t, -1);
745
- if (r && o) {
746
- const g = x(r), f = x(o), S = n ? `${f}/${g}` : `${g}/${f}`;
747
- return `${s} (${S})`;
744
+ const r = R(e), s = d(e, t, 1), o = d(e, t, -1);
745
+ if (s && o) {
746
+ const g = x(s), f = x(o), S = n ? `${f}/${g}` : `${g}/${f}`;
747
+ return `${r} (${S})`;
748
748
  }
749
- return `${s} (${t})`;
749
+ return `${r} (${t})`;
750
750
  }, Be = (e, t) => {
751
751
  let n;
752
752
  switch (t) {
@@ -761,12 +761,12 @@ const ue = (e) => {
761
761
  }
762
762
  return `${R(e)} ${n}`;
763
763
  }, ce = (e, t, n = !1) => {
764
- const s = R(e), r = se(e, t, n);
765
- return r ? `${s} (${r})` : null;
766
- }, He = (e, t) => ce(e, t) || oe(e, t), p = (e, t, n, s = !1) => {
767
- const r = s ? V : W, o = s ? q : d, [g, f] = e === "joint" ? [
768
- r(t, n, 1),
769
- r(t, n, -1)
764
+ const r = R(e), s = re(e, t, n);
765
+ return s ? `${r} (${s})` : null;
766
+ }, He = (e, t) => ce(e, t) || oe(e, t), p = (e, t, n, r = !1) => {
767
+ const s = r ? V : W, o = r ? q : d, [g, f] = e === "joint" ? [
768
+ s(t, n, 1),
769
+ s(t, n, -1)
770
770
  ] : [
771
771
  o(t, n, 1),
772
772
  o(t, n, -1)
@@ -786,11 +786,11 @@ const ue = (e) => {
786
786
  e.partDimension,
787
787
  t
788
788
  ), Ue = (e, t, n = !1) => {
789
- const { positive: s, negative: r } = le(
789
+ const { positive: r, negative: s } = le(
790
790
  t,
791
791
  n
792
792
  );
793
- return e >= 0 ? s : r;
793
+ return e >= 0 ? r : s;
794
794
  };
795
795
  export {
796
796
  Le as getActivityKindFromActivityType,
@@ -804,7 +804,7 @@ export {
804
804
  Ae as getAvailablePoseJointsForLimbIds,
805
805
  _e as getAvailableSensorJointsForLimbIds,
806
806
  be as getAxis,
807
- re as getDefaultAngleSource,
807
+ se as getDefaultAngleSource,
808
808
  ke as getDefaultJointRange,
809
809
  Se as getDefaultLimbRange,
810
810
  I as getEnabledJointPlanes,
@@ -815,7 +815,7 @@ export {
815
815
  W as getJointAngleDirectionName,
816
816
  ce as getJointNameWithPlane,
817
817
  He as getJointOrSegmentNameWithPlane,
818
- se as getJointPlaneName,
818
+ re as getJointPlaneName,
819
819
  Ee as getNormativeJointRange,
820
820
  Ue as getParameterAngleDirectionName,
821
821
  le as getParameterDirectionNames,
package/dist/types.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./services.cjs"),r=require("./generated-graphql.cjs"),p=require("./lodash-vendor-CR237hSU.cjs"),m=require("./utils.cjs"),l=(e,t)=>t==="left"||t==="right"?{sagittal:e.sagittal}:t==="forward"||t==="backward"?{frontal:e.frontal}:null,S=(e,t,n)=>t==="sensor"?e?.sensor_angle??null:t==="pose"?(e?.pose_angle&&l(e.pose_angle,n))??null:e?.sensor_angle?l(e.sensor_angle)??null:(e?.pose_angle&&l(e.pose_angle,n))??null,k=(e,t)=>(t==="sensor"?e?.sensor_angle:t==="pose"?e?.pose_angle:e?.sensor_angle||e?.pose_angle)||null,R=["frontal","sagittal","transverse"],T=e=>"limbs"in e,v=(e,t)=>t==="y"&&(e==="LeftFoot"||e==="RightFoot"||e==="LeftShank"||e==="RightShank"),F=(e,t)=>{switch(e){case"Head":return"Head";case"UpperBack":return"UpperBack";case"CenterBack":return"CenterBack";case"LowerBack":return"LowerBack";case"Thigh":return t==="left"?"LeftThigh":"RightThigh";case"Shank":return t==="left"?"LeftShank":"RightShank";case"Foot":return t==="left"?"LeftFoot":"RightFoot";case"UpperArm":return t==="left"?"LeftUpperArm":"RightUpperArm";case"Forearm":return t==="left"?"LeftForearm":"RightForearm";case"Pelvis":return t==="left"?"LeftPelvis":"RightPelvis";case"Clavicle":return t==="left"?"LeftClavicle":"RightClavicle"}},A=e=>e.startsWith("Left")?"left":e.startsWith("Right")?"right":null,b=(e,t)=>{switch(e){case"Ankle":return t==="left"?"LeftAnkle":"RightAnkle";case"Knee":return t==="left"?"LeftKnee":"RightKnee";case"Hip":return t==="left"?"LeftHip":"RightHip";case"Shoulder":return t==="left"?"LeftShoulder":"RightShoulder";case"Elbow":return t==="left"?"LeftElbow":"RightElbow";case"Spine":return"TotalSpine";case"Neck":return"Neck"}},h=e=>{switch(e){case"LeftAnkle":case"RightAnkle":return"Ankle";case"LeftKnee":case"RightKnee":return"Knee";case"LeftHip":case"RightHip":return"Hip";case"LeftShoulder":case"RightShoulder":return"Shoulder";case"LeftElbow":case"RightElbow":return"Elbow";case"ChestSpine":case"NavalSpine":case"TotalSpine":return"Spine";case"Neck":return"Neck"}},u=e=>{switch(e){case"Head":return"Head";case"UpperBack":return"UpperBack";case"CenterBack":return"CenterBack";case"LowerBack":return"LowerBack";case"LeftThigh":case"RightThigh":return"Thigh";case"LeftShank":case"RightShank":return"Shank";case"LeftFoot":case"RightFoot":return"Foot";case"LeftUpperArm":case"RightUpperArm":return"UpperArm";case"LeftForearm":case"RightForearm":return"Forearm";case"LeftPelvis":case"RightPelvis":return"Pelvis";case"LeftClavicle":case"RightClavicle":return"Clavicle"}};var g=(e=>(e.Sensor="sensor",e.Pose="pose",e))(g||{});const U=e=>"joint"in e?h(e.joint):u(e.segment),w=["joint","limb","acceleration","angular_velocity"],B=["frontal","sagittal","transverse"],P=["x","y","z"],j=e=>{switch(`${e}`){case r.SensorLocation.Thorax:return"UpperBack";case r.SensorLocation.CenterBack:return"CenterBack";case r.SensorLocation.Pelvis:return"LowerBack";case r.SensorLocation.LeftThigh:return"LeftThigh";case r.SensorLocation.RightThigh:return"RightThigh";case r.SensorLocation.LeftShank:return"LeftShank";case r.SensorLocation.RightShank:return"RightShank";case r.SensorLocation.LeftFoot:return"LeftFoot";case r.SensorLocation.RightFoot:return"RightFoot";case r.SensorLocation.LeftUpperArm:return"LeftUpperArm";case r.SensorLocation.RightUpperArm:return"RightUpperArm";case r.SensorLocation.LeftForearm:return"LeftForearm";case r.SensorLocation.RightForearm:return"RightForearm";case r.SensorLocation.Head:return"Head"}return console.warn(`Unknown sensor location: ${e}`),null},N=e=>{switch(e){case r.SensorLocation.Thorax:return"Thorax";case r.SensorLocation.CenterBack:return"Center Back";case r.SensorLocation.Pelvis:return"Pelvis";case r.SensorLocation.LeftThigh:return"Left Thigh";case r.SensorLocation.RightThigh:return"Right Thigh";case r.SensorLocation.LeftShank:return"Left Shank";case r.SensorLocation.RightShank:return"Right Shank";case r.SensorLocation.LeftFoot:return"Left Foot";case r.SensorLocation.RightFoot:return"Right Foot";case r.SensorLocation.LeftUpperArm:return"Left Upper Arm";case r.SensorLocation.RightUpperArm:return"Right Upper Arm";case r.SensorLocation.LeftForearm:return"Left Forearm";case r.SensorLocation.RightForearm:return"Right Forearm";case r.SensorLocation.Head:return"Head"}return console.warn(`Unknown sensor location: ${e}`),"Unknown"},C=()=>{const e=[],t={add:(n,o,a,c,s=!1)=>{const f={unit:"Count",value:0};return o?e.push({desc:{name:n,hint:a||null},value:o,isLoading:s,suffix:c||void 0}):s&&e.push({desc:{name:n,hint:a||null},value:f,isLoading:s,suffix:c||void 0}),t},build:()=>e};return t},d=(e,t)=>({unit:e,value:t}),H=(e,t)=>{if(t!=null)return d(e,t)},L=e=>"joint"in e?e.joint:e.segment,O=e=>L(e).toString(),y=e=>"plane"in e?e.plane:e.axis,x=e=>"plane"in e?e.plane:e.axis,I=e=>"joint"in e?i.jointNames[e.joint]:i.limbNames[e.segment],E=e=>{if(!e)return"Loading...";if(!e.action)return e.name??"Unknown Action";const t=e.action.name??"Unknown Action",n=e.actionSide?`${e.actionSide}`:"";return`${t} ${n} (Trial ${e.name??"1"})`},K=e=>typeof e=="object"&&"SyncError"in e,_=(e,t)=>Object.values(e).some(n=>t.id in n&&Object.keys(n[t.id]).length>0),q=(e,t)=>Math.max(...Object.values(e).map(n=>t.id in n?Object.keys(n[t.id]).length:0)),$=(e,t,n)=>Object.values(e).some(o=>t.id in o&&n in o[t.id]),J=(e,t)=>e[t.kind]?.[t.value.id]?.[i.planeOrAxis(t)],M=(e,t,n)=>{const o=structuredClone(e);if(n===void 0){const a=i.planeOrAxis(t);t.kind in o&&t.value.id in o[t.kind]&&a in o[t.kind][t.value.id]&&delete o[t.kind][t.value.id][a]}else p.merge(o,{[t.kind]:{[t.value.id]:{[i.planeOrAxis(t)]:n}}});return o},W=e=>Object.entries(e).flatMap(([t,n])=>Object.entries(n).flatMap(([o,a])=>Object.entries(a).map(([c,s])=>({min:s.min,max:s.max,kind:m.safelyConvertEnum(s.kind),partDimension:c,partId:o,partKind:t})))),D=e=>e.reduce((t,n)=>({...t,[n.partKind]:{...t[n.partKind]||{},[n.partId]:{...t[n.partKind]?.[n.partId]||{},[n.partDimension]:{kind:n.kind,min:n.min,max:n.max}}}}),{joint:{},limb:{},acceleration:{}}),V=e=>Object.values(e).every(t=>Object.keys(t).length===0),G=(e,t)=>{if(e.kind!==t.kind)return!1;switch(e.kind){case"Zed":return e.id===t.id;case"Usb":return e.name===t.name;case"GoPro":return e.id===t.id}};exports.AngleDataSource=g;exports.analysisStatBuilder=C;exports.areThresholdsEmpty=V;exports.availablePlanes=R;exports.axes=P;exports.canBeVerticalForce=v;exports.dimensionName=x;exports.dimensionToLegacy=y;exports.getAnalysisName=E;exports.getAnalysisPartIdNoSide=U;exports.getJointIdNoSide=h;exports.getJointIdWithSide=b;exports.getLimbIdNoSide=u;exports.getLimbIdWithSide=F;exports.getPointSide=A;exports.isDeviceEqual=G;exports.isLimbTrackingFrame=T;exports.isSyncError=K;exports.jointAngle=S;exports.jointOrLimbHasThreshold=_;exports.jointOrLimbThresholdCount=q;exports.limbAngle=k;exports.mkUnit=d;exports.partAndPlaneHasThreshold=$;exports.partIdName=I;exports.partIdToJointLimbId=L;exports.partIdToString=O;exports.partKinds=w;exports.planes=B;exports.sensorLocationName=N;exports.sensorLocationToLimbId=j;exports.thresholdForPart=J;exports.thresholdFragmentsToThresholds=D;exports.thresholdsToInput=W;exports.tryMkUnit=H;exports.updateThreshold=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./services.cjs"),r=require("./generated-Cis5yU-9.cjs"),m=require("./lodash-vendor-CR237hSU.cjs"),p=require("./utils.cjs"),l=(e,t)=>t==="left"||t==="right"?{sagittal:e.sagittal}:t==="forward"||t==="backward"?{frontal:e.frontal}:null,S=(e,t,n)=>t==="sensor"?e?.sensor_angle??null:t==="pose"?(e?.pose_angle&&l(e.pose_angle,n))??null:e?.sensor_angle?l(e.sensor_angle)??null:(e?.pose_angle&&l(e.pose_angle,n))??null,k=(e,t)=>(t==="sensor"?e?.sensor_angle:t==="pose"?e?.pose_angle:e?.sensor_angle||e?.pose_angle)||null,R=["frontal","sagittal","transverse"],T=e=>"limbs"in e,v=(e,t)=>t==="y"&&(e==="LeftFoot"||e==="RightFoot"||e==="LeftShank"||e==="RightShank"),F=(e,t)=>{switch(e){case"Head":return"Head";case"UpperBack":return"UpperBack";case"CenterBack":return"CenterBack";case"LowerBack":return"LowerBack";case"Thigh":return t==="left"?"LeftThigh":"RightThigh";case"Shank":return t==="left"?"LeftShank":"RightShank";case"Foot":return t==="left"?"LeftFoot":"RightFoot";case"UpperArm":return t==="left"?"LeftUpperArm":"RightUpperArm";case"Forearm":return t==="left"?"LeftForearm":"RightForearm";case"Pelvis":return t==="left"?"LeftPelvis":"RightPelvis";case"Clavicle":return t==="left"?"LeftClavicle":"RightClavicle"}},A=e=>e.startsWith("Left")?"left":e.startsWith("Right")?"right":null,b=(e,t)=>{switch(e){case"Ankle":return t==="left"?"LeftAnkle":"RightAnkle";case"Knee":return t==="left"?"LeftKnee":"RightKnee";case"Hip":return t==="left"?"LeftHip":"RightHip";case"Shoulder":return t==="left"?"LeftShoulder":"RightShoulder";case"Elbow":return t==="left"?"LeftElbow":"RightElbow";case"Spine":return"TotalSpine";case"Neck":return"Neck"}},u=e=>{switch(e){case"LeftAnkle":case"RightAnkle":return"Ankle";case"LeftKnee":case"RightKnee":return"Knee";case"LeftHip":case"RightHip":return"Hip";case"LeftShoulder":case"RightShoulder":return"Shoulder";case"LeftElbow":case"RightElbow":return"Elbow";case"ChestSpine":case"NavalSpine":case"TotalSpine":return"Spine";case"Neck":return"Neck"}},h=e=>{switch(e){case"Head":return"Head";case"UpperBack":return"UpperBack";case"CenterBack":return"CenterBack";case"LowerBack":return"LowerBack";case"LeftThigh":case"RightThigh":return"Thigh";case"LeftShank":case"RightShank":return"Shank";case"LeftFoot":case"RightFoot":return"Foot";case"LeftUpperArm":case"RightUpperArm":return"UpperArm";case"LeftForearm":case"RightForearm":return"Forearm";case"LeftPelvis":case"RightPelvis":return"Pelvis";case"LeftClavicle":case"RightClavicle":return"Clavicle"}};var g=(e=>(e.Sensor="sensor",e.Pose="pose",e))(g||{});const U=e=>"joint"in e?u(e.joint):h(e.segment),w=["joint","limb","acceleration","angular_velocity"],B=["frontal","sagittal","transverse"],P=["x","y","z"],j=e=>{switch(`${e}`){case r.SensorLocation.Thorax:return"UpperBack";case r.SensorLocation.CenterBack:return"CenterBack";case r.SensorLocation.Pelvis:return"LowerBack";case r.SensorLocation.LeftThigh:return"LeftThigh";case r.SensorLocation.RightThigh:return"RightThigh";case r.SensorLocation.LeftShank:return"LeftShank";case r.SensorLocation.RightShank:return"RightShank";case r.SensorLocation.LeftFoot:return"LeftFoot";case r.SensorLocation.RightFoot:return"RightFoot";case r.SensorLocation.LeftUpperArm:return"LeftUpperArm";case r.SensorLocation.RightUpperArm:return"RightUpperArm";case r.SensorLocation.LeftForearm:return"LeftForearm";case r.SensorLocation.RightForearm:return"RightForearm";case r.SensorLocation.Head:return"Head"}return console.warn(`Unknown sensor location: ${e}`),null},N=e=>{switch(e){case r.SensorLocation.Thorax:return"Thorax";case r.SensorLocation.CenterBack:return"Center Back";case r.SensorLocation.Pelvis:return"Pelvis";case r.SensorLocation.LeftThigh:return"Left Thigh";case r.SensorLocation.RightThigh:return"Right Thigh";case r.SensorLocation.LeftShank:return"Left Shank";case r.SensorLocation.RightShank:return"Right Shank";case r.SensorLocation.LeftFoot:return"Left Foot";case r.SensorLocation.RightFoot:return"Right Foot";case r.SensorLocation.LeftUpperArm:return"Left Upper Arm";case r.SensorLocation.RightUpperArm:return"Right Upper Arm";case r.SensorLocation.LeftForearm:return"Left Forearm";case r.SensorLocation.RightForearm:return"Right Forearm";case r.SensorLocation.Head:return"Head"}return console.warn(`Unknown sensor location: ${e}`),"Unknown"},C=()=>{const e=[],t={add:(n,o,a,c,s=!1)=>{const f={unit:"Count",value:0};return o?e.push({desc:{name:n,hint:a||null},value:o,isLoading:s,suffix:c||void 0}):s&&e.push({desc:{name:n,hint:a||null},value:f,isLoading:s,suffix:c||void 0}),t},build:()=>e};return t},d=(e,t)=>({unit:e,value:t}),H=(e,t)=>{if(t!=null)return d(e,t)},L=e=>"joint"in e?e.joint:e.segment,O=e=>L(e).toString(),y=e=>"plane"in e?e.plane:e.axis,x=e=>"plane"in e?e.plane:e.axis,I=e=>"joint"in e?i.jointNames[e.joint]:i.limbNames[e.segment],E=e=>{if(!e)return"Loading...";if(!e.action)return e.name??"Unknown Action";const t=e.action.name??"Unknown Action",n=e.actionSide?`${e.actionSide}`:"";return`${t} ${n} (Trial ${e.name??"1"})`},K=e=>typeof e=="object"&&"SyncError"in e,_=(e,t)=>Object.values(e).some(n=>t.id in n&&Object.keys(n[t.id]).length>0),$=(e,t)=>Math.max(...Object.values(e).map(n=>t.id in n?Object.keys(n[t.id]).length:0)),q=(e,t,n)=>Object.values(e).some(o=>t.id in o&&n in o[t.id]),J=(e,t)=>e[t.kind]?.[t.value.id]?.[i.planeOrAxis(t)],M=(e,t,n)=>{const o=structuredClone(e);if(n===void 0){const a=i.planeOrAxis(t);t.kind in o&&t.value.id in o[t.kind]&&a in o[t.kind][t.value.id]&&delete o[t.kind][t.value.id][a]}else m.merge(o,{[t.kind]:{[t.value.id]:{[i.planeOrAxis(t)]:n}}});return o},W=e=>Object.entries(e).flatMap(([t,n])=>Object.entries(n).flatMap(([o,a])=>Object.entries(a).map(([c,s])=>({min:s.min,max:s.max,kind:p.safelyConvertEnum(s.kind),partDimension:c,partId:o,partKind:t})))),D=e=>e.reduce((t,n)=>({...t,[n.partKind]:{...t[n.partKind]||{},[n.partId]:{...t[n.partKind]?.[n.partId]||{},[n.partDimension]:{kind:n.kind,min:n.min,max:n.max}}}}),{joint:{},limb:{},acceleration:{}}),V=e=>Object.values(e).every(t=>Object.keys(t).length===0),z=(e,t)=>{if(e.kind!==t.kind)return!1;switch(e.kind){case"Zed":return e.id===t.id;case"Usb":return e.name===t.name;case"GoPro":return e.id===t.id}};exports.AngleDataSource=g;exports.analysisStatBuilder=C;exports.areThresholdsEmpty=V;exports.availablePlanes=R;exports.axes=P;exports.canBeVerticalForce=v;exports.dimensionName=x;exports.dimensionToLegacy=y;exports.getAnalysisName=E;exports.getAnalysisPartIdNoSide=U;exports.getJointIdNoSide=u;exports.getJointIdWithSide=b;exports.getLimbIdNoSide=h;exports.getLimbIdWithSide=F;exports.getPointSide=A;exports.isDeviceEqual=z;exports.isLimbTrackingFrame=T;exports.isSyncError=K;exports.jointAngle=S;exports.jointOrLimbHasThreshold=_;exports.jointOrLimbThresholdCount=$;exports.limbAngle=k;exports.mkUnit=d;exports.partAndPlaneHasThreshold=q;exports.partIdName=I;exports.partIdToJointLimbId=L;exports.partIdToString=O;exports.partKinds=w;exports.planes=B;exports.sensorLocationName=N;exports.sensorLocationToLimbId=j;exports.thresholdForPart=J;exports.thresholdFragmentsToThresholds=D;exports.thresholdsToInput=W;exports.tryMkUnit=H;exports.updateThreshold=M;
package/dist/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jointNames as h, limbNames as f, planeOrAxis as l } from "./services.js";
2
- import { SensorLocation as n } from "./generated-graphql.js";
2
+ import { S as n } from "./generated-BTI7tPmv.js";
3
3
  import { m as g } from "./lodash-vendor-D4ZPCr77.js";
4
4
  import { safelyConvertEnum as p } from "./utils.js";
5
5
  const c = (e, t) => t === "left" || t === "right" ? {
package/dist/utils.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./tailwind-vendor-C0M23-WD.cjs"),p=require("./services.cjs"),i=require("./moment-vendor-1cRqq0AH.cjs"),d=require("./generated-graphql.cjs"),$=t=>t*39.3700787402,M=t=>t/39.3700787402,l=t=>t*2.20462262185,f=t=>t/2.20462262185,c=(t,n=!1)=>t==null?null:n?t*180/Math.PI:Math.round(t*(180/Math.PI)),P=t=>t==null?null:t*(Math.PI/180),S=t=>i.hooks.duration(t,"ms").humanize({ss:1}),F=(t,n=!1,s=!0)=>{const r=i.hooks.duration(t,"ms"),e=s?r.minutes().toString().padStart(2,"0"):r.minutes().toString(),o=r.seconds().toString().padStart(2,"0"),m=Math.round(r.milliseconds()).toString().padStart(3,"0");return n?`${e}:${o}.${m}`:`${e}:${o}`},k=(t,n=!1)=>{const s=i.hooks.duration(t,"seconds"),e=(s.minutes()+s.hours()*60).toString().padStart(2,"0"),o=s.seconds().toString().padStart(2,"0");if(n){const m=Math.round(s.milliseconds()).toString().padStart(3,"0");return`${e}:${o}.${m}`}return`${e}:${o}`},h=t=>{const n=i.hooks.duration(t,"ms"),s=n.hours(),r=n.minutes(),e=n.seconds(),o=n.milliseconds();return r<1?`${e}.${Math.floor(o/100)} seconds`:s<1?`${r} minutes`:`${s} hours`},b=t=>{const n=i.hooks.duration(t,"ms"),s=n.hours().toString().padStart(2,"0"),r=n.minutes().toString().padStart(2,"0"),e=n.seconds().toString().padStart(2,"0");return`${s}:${r}:${e}`},y=t=>{const n=i.hooks.duration(t,"seconds"),s=n.hours().toString().padStart(2,"0"),r=n.minutes().toString().padStart(2,"0"),e=n.seconds().toString().padStart(2,"0");return`${s}:${r}:${e}`},I=(t,n=!1)=>{const[s,r,e]=t.split(":").map(Number),o=n?999:0;return i.hooks.duration({hours:s,minutes:r,seconds:e,milliseconds:o}).asMilliseconds()},a=(t,n)=>{const s=new Intl.NumberFormat("en-US",{maximumFractionDigits:2});switch(t){case"Milliseconds":return h(n);case"DeltaMilliseconds":return S(n);case"Meters":return`${s.format(n)}m`;case"MetersPerSecond":return`${s.format(n)}m/s`;case"MetersPerSecondSq":return`${s.format(n)}m/s²`;case"Kg":return`${Math.round(l(n))}lbs`;case"Rad":return`${s.format(c(n)??0)}°`;case"RadPerSecond":return`${s.format(c(n)??0)}°/s`;case"RadPerSecondSq":return`${s.format(c(n)??0)}°/s²`;case"Frame":return`${s.format(n)}`;case"Percent":return new Intl.NumberFormat("en-US",{style:"percent"}).format(n);case"Count":return Math.round(n).toString();case"Centimeters":return`${s.format(n)}cm`;case"PassFail":return n>0?"Pass":"Fail";default:return n.toFixed(2)}},D=t=>a(t.unit,t.value),K=t=>t,q=t=>{const n=s=>p.getParameterAngleDirectionName(s,t);switch(t.partKind){case"joint":return s=>`${a("Rad",Math.abs(s))} ${n(s)}`;case"segment":return s=>`${a("Rad",Math.abs(s))} ${n(s)}`;case"acceleration":return s=>`${a("MetersPerSecondSq",s)} ${n(s)}`;case"angular_velocity":return s=>`${a("RadPerSecond",s)} ${n(s)}`;default:return s=>s.toString()}},R=t=>{const n=new Map;return((...s)=>{const r=JSON.stringify(s);if(n.has(r))return n.get(r);const e=t(...s);return n.set(r,e),e})},T=t=>({partId:"segment"in t.id?t.id.segment:t.id.joint,partKind:"segment"in t.id?"limb":"joint",partDimension:t.plane,min:t.min,max:t.max,kind:t.kind}),x=t=>t.map(T),g=t=>({id:t.partKind==="limb"?{segment:t.partId}:{joint:t.partId},plane:t.partDimension,min:t.min,max:t.max,kind:t.kind===d.ThresholdKind.Limit?d.ThresholdKind.Limit:d.ThresholdKind.Target}),U=t=>t.map(g),j=t=>t.split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "),A=(t,n)=>n===1?t:`${t}s`;function w(...t){return u.twMerge(u.clsx(t))}exports.capitalizeAll=j;exports.cn=w;exports.degToRad=P;exports.getFormatterForParameter=q;exports.getUnitFormatted=D;exports.getUnitValueFormatted=a;exports.hourMinSecStrToMs=I;exports.inchesToMeters=M;exports.kgToPounds=l;exports.memo=R;exports.metersToInches=$;exports.msToDurationStr=S;exports.msToHourMinSecStr=b;exports.msToPrettyStr=h;exports.msToTimestampStr=F;exports.parameterToThreshold=T;exports.parametersToThresholds=x;exports.pluralize=A;exports.poundsToKg=f;exports.radToDeg=c;exports.sToTimestampStr=k;exports.safelyConvertEnum=K;exports.secondsToTimestampStr=y;exports.thresholdToParameter=g;exports.thresholdsToParameters=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./tailwind-vendor-C0M23-WD.cjs"),p=require("./services.cjs"),i=require("./moment-vendor-1cRqq0AH.cjs"),d=require("./generated-Cis5yU-9.cjs"),$=t=>t*39.3700787402,M=t=>t/39.3700787402,l=t=>t*2.20462262185,f=t=>t/2.20462262185,c=(t,n=!1)=>t==null?null:n?t*180/Math.PI:Math.round(t*(180/Math.PI)),P=t=>t==null?null:t*(Math.PI/180),S=t=>i.hooks.duration(t,"ms").humanize({ss:1}),F=(t,n=!1,s=!0)=>{const r=i.hooks.duration(t,"ms"),e=s?r.minutes().toString().padStart(2,"0"):r.minutes().toString(),o=r.seconds().toString().padStart(2,"0"),m=Math.round(r.milliseconds()).toString().padStart(3,"0");return n?`${e}:${o}.${m}`:`${e}:${o}`},k=(t,n=!1)=>{const s=i.hooks.duration(t,"seconds"),e=(s.minutes()+s.hours()*60).toString().padStart(2,"0"),o=s.seconds().toString().padStart(2,"0");if(n){const m=Math.round(s.milliseconds()).toString().padStart(3,"0");return`${e}:${o}.${m}`}return`${e}:${o}`},h=t=>{const n=i.hooks.duration(t,"ms"),s=n.hours(),r=n.minutes(),e=n.seconds(),o=n.milliseconds();return r<1?`${e}.${Math.floor(o/100)} seconds`:s<1?`${r} minutes`:`${s} hours`},b=t=>{const n=i.hooks.duration(t,"ms"),s=n.hours().toString().padStart(2,"0"),r=n.minutes().toString().padStart(2,"0"),e=n.seconds().toString().padStart(2,"0");return`${s}:${r}:${e}`},y=t=>{const n=i.hooks.duration(t,"seconds"),s=n.hours().toString().padStart(2,"0"),r=n.minutes().toString().padStart(2,"0"),e=n.seconds().toString().padStart(2,"0");return`${s}:${r}:${e}`},I=(t,n=!1)=>{const[s,r,e]=t.split(":").map(Number),o=n?999:0;return i.hooks.duration({hours:s,minutes:r,seconds:e,milliseconds:o}).asMilliseconds()},a=(t,n)=>{const s=new Intl.NumberFormat("en-US",{maximumFractionDigits:2});switch(t){case"Milliseconds":return h(n);case"DeltaMilliseconds":return S(n);case"Meters":return`${s.format(n)}m`;case"MetersPerSecond":return`${s.format(n)}m/s`;case"MetersPerSecondSq":return`${s.format(n)}m/s²`;case"Kg":return`${Math.round(l(n))}lbs`;case"Rad":return`${s.format(c(n)??0)}°`;case"RadPerSecond":return`${s.format(c(n)??0)}°/s`;case"RadPerSecondSq":return`${s.format(c(n)??0)}°/s²`;case"Frame":return`${s.format(n)}`;case"Percent":return new Intl.NumberFormat("en-US",{style:"percent"}).format(n);case"Count":return Math.round(n).toString();case"Centimeters":return`${s.format(n)}cm`;case"PassFail":return n>0?"Pass":"Fail";default:return n.toFixed(2)}},D=t=>a(t.unit,t.value),K=t=>t,R=t=>{const n=s=>p.getParameterAngleDirectionName(s,t);switch(t.partKind){case"joint":return s=>`${a("Rad",Math.abs(s))} ${n(s)}`;case"segment":return s=>`${a("Rad",Math.abs(s))} ${n(s)}`;case"acceleration":return s=>`${a("MetersPerSecondSq",s)} ${n(s)}`;case"angular_velocity":return s=>`${a("RadPerSecond",s)} ${n(s)}`;default:return s=>s.toString()}},q=t=>{const n=new Map;return((...s)=>{const r=JSON.stringify(s);if(n.has(r))return n.get(r);const e=t(...s);return n.set(r,e),e})},T=t=>({partId:"segment"in t.id?t.id.segment:t.id.joint,partKind:"segment"in t.id?"limb":"joint",partDimension:t.plane,min:t.min,max:t.max,kind:t.kind}),x=t=>t.map(T),g=t=>({id:t.partKind==="limb"?{segment:t.partId}:{joint:t.partId},plane:t.partDimension,min:t.min,max:t.max,kind:t.kind===d.ThresholdKind.Limit?d.ThresholdKind.Limit:d.ThresholdKind.Target}),U=t=>t.map(g),j=t=>t.split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "),A=(t,n)=>n===1?t:`${t}s`;function w(...t){return u.twMerge(u.clsx(t))}exports.capitalizeAll=j;exports.cn=w;exports.degToRad=P;exports.getFormatterForParameter=R;exports.getUnitFormatted=D;exports.getUnitValueFormatted=a;exports.hourMinSecStrToMs=I;exports.inchesToMeters=M;exports.kgToPounds=l;exports.memo=q;exports.metersToInches=$;exports.msToDurationStr=S;exports.msToHourMinSecStr=b;exports.msToPrettyStr=h;exports.msToTimestampStr=F;exports.parameterToThreshold=T;exports.parametersToThresholds=x;exports.pluralize=A;exports.poundsToKg=f;exports.radToDeg=c;exports.sToTimestampStr=k;exports.safelyConvertEnum=K;exports.secondsToTimestampStr=y;exports.thresholdToParameter=g;exports.thresholdsToParameters=U;
package/dist/utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { t as d, c as S } from "./tailwind-vendor-B4y94WzT.js";
2
2
  import { getParameterAngleDirectionName as l } from "./services.js";
3
3
  import { h as i } from "./moment-vendor-DMLRxgRE.js";
4
- import { ThresholdKind as m } from "./generated-graphql.js";
4
+ import { T as m } from "./generated-BTI7tPmv.js";
5
5
  const I = (t) => t * 39.3700787402, b = (t) => t / 39.3700787402, $ = (t) => t * 2.20462262185, x = (t) => t / 2.20462262185, u = (t, n = !1) => t == null ? null : n ? t * 180 / Math.PI : Math.round(t * (180 / Math.PI)), k = (t) => t == null ? null : t * (Math.PI / 180), p = (t) => i.duration(t, "ms").humanize({ ss: 1 }), D = (t, n = !1, s = !0) => {
6
6
  const r = i.duration(t, "ms"), o = s ? r.minutes().toString().padStart(2, "0") : r.minutes().toString(), e = r.seconds().toString().padStart(2, "0"), a = Math.round(r.milliseconds()).toString().padStart(3, "0");
7
7
  return n ? `${o}:${e}.${a}` : `${o}:${e}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quantum-component-library",
3
- "version": "1.4.47-dev.11",
3
+ "version": "1.4.47-dev.3",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.cjs",
@@ -44,16 +44,6 @@
44
44
  "import": "./dist/providers.js",
45
45
  "require": "./dist/providers.cjs"
46
46
  },
47
- "./generated": {
48
- "types": "./dist/generated/index.d.ts",
49
- "import": "./dist/generated.js",
50
- "require": "./dist/generated.cjs"
51
- },
52
- "./generated-graphql": {
53
- "types": "./dist/generated/graphql.d.ts",
54
- "import": "./dist/generated-graphql.js",
55
- "require": "./dist/generated-graphql.cjs"
56
- },
57
47
  "./dist/index.css": {
58
48
  "import": "./dist/quantum-component-library.css",
59
49
  "require": "./dist/quantum-component-library.css"
@@ -1,6 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react-vite';
2
- import { ActivityList } from './index';
3
- declare const meta: Meta<typeof ActivityList>;
4
- export default meta;
5
- type Story = StoryObj<typeof meta>;
6
- export declare const Default: Story;