andoncloud-workplaces-state-timelines-widget 1.2.5 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +32 -5
- package/dist/index.js +373 -2
- package/dist/index.js.map +1 -1
- package/package.json +33 -27
- package/dist/components/Loading/index.d.ts +0 -3
- package/dist/components/SettingsForm/index.d.ts +0 -4
- package/dist/components/SettingsFormContent/index.d.ts +0 -5
- package/dist/components/Timeline/index.d.ts +0 -10
- package/dist/components/Timeline/styled.d.ts +0 -10
- package/dist/components/TimelineLoader/index.d.ts +0 -3
- package/dist/components/Widget/index.d.ts +0 -5
- package/dist/components/Widget/utils.d.ts +0 -12
- package/dist/components/WidgetSettings/index.d.ts +0 -4
- package/dist/components/WidgetView/index.d.ts +0 -4
- package/dist/helpers.d.ts +0 -3
- package/dist/i18n.d.ts +0 -2
- package/dist/locales/index.d.ts +0 -25
- package/dist/stories/Widget.stories.d.ts +0 -5
- package/dist/types.d.ts +0 -18
- package/dist/utils/graphql-sdk.d.ts +0 -142
- package/dist/version.d.ts +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { BaseWidgetData, BaseWidgetSettings, FilterValues, ListShifts_Shift, ListStatusChanges_StatusChange, ListWorkplaces_Workplace, WidgetProps } from "andoncloud-dashboard-toolkit";
|
|
2
|
+
//#region src/types.d.ts
|
|
3
|
+
interface WidgetViewData {
|
|
4
|
+
shifts: ListShifts_Shift[];
|
|
5
|
+
workplaces: ListWorkplaces_Workplace[];
|
|
6
|
+
statusChanges: ListStatusChanges_StatusChange[];
|
|
7
|
+
}
|
|
8
|
+
interface WidgetSettingsData {
|
|
9
|
+
workplaces: ListWorkplaces_Workplace[];
|
|
10
|
+
}
|
|
11
|
+
interface WidgetData extends BaseWidgetData, WidgetViewData, WidgetSettingsData {}
|
|
12
|
+
interface WidgetSettings extends BaseWidgetSettings {
|
|
13
|
+
workplacesIds: string[];
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/components/Widget/index.d.ts
|
|
17
|
+
declare const Widget: React.FC<WidgetProps<WidgetData, WidgetSettings>>;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/core/title.d.ts
|
|
20
|
+
declare const getDisplayName: (lang: string) => string;
|
|
21
|
+
declare const getTitle: (data: WidgetData | undefined, _settings: WidgetSettings | undefined, _filters: FilterValues | undefined, lang: string) => string;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/version.d.ts
|
|
24
|
+
declare const LIBRARY_VERSION = "1.2.7";
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/index.d.ts
|
|
27
|
+
declare const thumbnail: string | undefined;
|
|
28
|
+
declare const requiredFeatures: string[];
|
|
29
|
+
declare const extraPermissions: string[];
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Widget, extraPermissions, getDisplayName, getTitle, requiredFeatures, thumbnail, LIBRARY_VERSION as version };
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,373 @@
|
|
|
1
|
-
var e=require("react"),t=require("andoncloud-dashboard-toolkit"),n=require("andoncloud-widget-base"),r=require("dayjs"),i=require("react-i18next"),s=require("@mui/lab"),a=require("@mui/material"),o=require("dayjs/plugin/isBetween"),u=require("@mui/material/styles");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=/*#__PURE__*/l(e),f=/*#__PURE__*/l(r),d=/*#__PURE__*/l(o);function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},h.apply(null,arguments)}var p="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function m(e){var t=e.prototype.toJSON;"function"==typeof t||function(){if(!Boolean(0))throw new Error("Unexpected invariant triggered.")}(),e.prototype.inspect=t,p&&(e.prototype[p]=t)}function v(e){return null!=e&&"string"==typeof e.kind}function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function g(e){return b(e,[])}function b(e,t){switch(y(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,t){if(-1!==t.indexOf(e))return"[Circular]";var n=[].concat(t,[e]),r=function(e){var t=e[String(p)];return"function"==typeof t?t:"function"==typeof e.inspect?e.inspect:void 0}(e);if(void 0!==r){var i=r.call(e);if(i!==e)return"string"==typeof i?i:b(i,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";for(var n=Math.min(10,e.length),r=e.length-n,i=[],s=0;s<n;++s)i.push(b(e[s],t));return 1===r?i.push("... 1 more item"):r>1&&i.push("... ".concat(r," more items")),"["+i.join(", ")+"]"}(e,n);return function(e,t){var n=Object.keys(e);return 0===n.length?"{}":t.length>2?"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var n=e.constructor.name;if("string"==typeof n&&""!==n)return n}return t}(e)+"]":"{ "+n.map(function(n){return n+": "+b(e[n],t)}).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}m(/*#__PURE__*/function(){function e(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}return e.prototype.toJSON=function(){return{start:this.start,end:this.end}},e}()),m(/*#__PURE__*/function(){function e(e,t,n,r,i,s,a){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=a,this.prev=s,this.next=null}return e.prototype.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},e}());var x={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},w=Object.freeze({});function E(e,t,n){var r=e[t];if(r){if(!n&&"function"==typeof r)return r;var i=n?r.leave:r.enter;if("function"==typeof i)return i}else{var s=n?e.leave:e.enter;if(s){if("function"==typeof s)return s;var a=s[t];if("function"==typeof a)return a}}}var O={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return T(e.definitions,"\n\n")+"\n"},OperationDefinition:function(e){var t=e.operation,n=e.name,r=S("(",T(e.variableDefinitions,", "),")"),i=T(e.directives," "),s=e.selectionSet;return n||i||r||"query"!==t?T([t,T([n,r]),i,s]," "):s},VariableDefinition:function(e){var t=e.directives;return e.variable+": "+e.type+S(" = ",e.defaultValue)+S(" ",T(t," "))},SelectionSet:function(e){return F(e.selections)},Field:function(e){var t=e.name,n=e.arguments,r=e.directives,i=e.selectionSet,s=S("",e.alias,": ")+t,a=s+S("(",T(n,", "),")");return a.length>80&&(a=s+S("(\n",_(T(n,"\n")),"\n)")),T([a,T(r," "),i]," ")},Argument:function(e){return e.name+": "+e.value},FragmentSpread:function(e){return"..."+e.name+S(" ",T(e.directives," "))},InlineFragment:function(e){var t=e.directives,n=e.selectionSet;return T(["...",S("on ",e.typeCondition),T(t," "),n]," ")},FragmentDefinition:function(e){var t=e.typeCondition,n=e.variableDefinitions,r=e.directives,i=e.selectionSet;return"fragment ".concat(e.name).concat(S("(",T(n,", "),")")," ")+"on ".concat(t," ").concat(S("",T(r," ")," "))+i},IntValue:function(e){return e.value},FloatValue:function(e){return e.value},StringValue:function(e,t){var n=e.value;return e.block?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=-1===e.indexOf("\n"),i=!r||'"'===e[e.length-1]||"\\"===e[e.length-1]||n,s="";return!i||r&&(" "===e[0]||"\t"===e[0])||(s+="\n"+t),s+=t?e.replace(/\n/g,"\n"+t):e,i&&(s+="\n"),'"""'+s.replace(/"""/g,'\\"""')+'"""'}(n,"description"===t?"":" "):JSON.stringify(n)},BooleanValue:function(e){return e.value?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){return e.value},ListValue:function(e){return"["+T(e.values,", ")+"]"},ObjectValue:function(e){return"{"+T(e.fields,", ")+"}"},ObjectField:function(e){return e.name+": "+e.value},Directive:function(e){return"@"+e.name+S("(",T(e.arguments,", "),")")},NamedType:function(e){return e.name},ListType:function(e){return"["+e.type+"]"},NonNullType:function(e){return e.type+"!"},SchemaDefinition:k(function(e){var t=e.operationTypes;return T(["schema",T(e.directives," "),F(t)]," ")}),OperationTypeDefinition:function(e){return e.operation+": "+e.type},ScalarTypeDefinition:k(function(e){return T(["scalar",e.name,T(e.directives," ")]," ")}),ObjectTypeDefinition:k(function(e){var t=e.directives,n=e.fields;return T(["type",e.name,S("implements ",T(e.interfaces," & ")),T(t," "),F(n)]," ")}),FieldDefinition:k(function(e){var t=e.arguments,n=e.type,r=e.directives;return e.name+(A(t)?S("(\n",_(T(t,"\n")),"\n)"):S("(",T(t,", "),")"))+": "+n+S(" ",T(r," "))}),InputValueDefinition:k(function(e){var t=e.directives;return T([e.name+": "+e.type,S("= ",e.defaultValue),T(t," ")]," ")}),InterfaceTypeDefinition:k(function(e){var t=e.directives,n=e.fields;return T(["interface",e.name,S("implements ",T(e.interfaces," & ")),T(t," "),F(n)]," ")}),UnionTypeDefinition:k(function(e){var t=e.types;return T(["union",e.name,T(e.directives," "),t&&0!==t.length?"= "+T(t," | "):""]," ")}),EnumTypeDefinition:k(function(e){var t=e.values;return T(["enum",e.name,T(e.directives," "),F(t)]," ")}),EnumValueDefinition:k(function(e){return T([e.name,T(e.directives," ")]," ")}),InputObjectTypeDefinition:k(function(e){var t=e.fields;return T(["input",e.name,T(e.directives," "),F(t)]," ")}),DirectiveDefinition:k(function(e){var t=e.arguments,n=e.repeatable,r=e.locations;return"directive @"+e.name+(A(t)?S("(\n",_(T(t,"\n")),"\n)"):S("(",T(t,", "),")"))+(n?" repeatable":"")+" on "+T(r," | ")}),SchemaExtension:function(e){var t=e.operationTypes;return T(["extend schema",T(e.directives," "),F(t)]," ")},ScalarTypeExtension:function(e){return T(["extend scalar",e.name,T(e.directives," ")]," ")},ObjectTypeExtension:function(e){var t=e.directives,n=e.fields;return T(["extend type",e.name,S("implements ",T(e.interfaces," & ")),T(t," "),F(n)]," ")},InterfaceTypeExtension:function(e){var t=e.directives,n=e.fields;return T(["extend interface",e.name,S("implements ",T(e.interfaces," & ")),T(t," "),F(n)]," ")},UnionTypeExtension:function(e){var t=e.types;return T(["extend union",e.name,T(e.directives," "),t&&0!==t.length?"= "+T(t," | "):""]," ")},EnumTypeExtension:function(e){var t=e.values;return T(["extend enum",e.name,T(e.directives," "),F(t)]," ")},InputObjectTypeExtension:function(e){var t=e.fields;return T(["extend input",e.name,T(e.directives," "),F(t)]," ")}};function k(e){return function(t){return T([t.description,e(t)],"\n")}}function T(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return null!==(t=null==e?void 0:e.filter(function(e){return e}).join(n))&&void 0!==t?t:""}function F(e){return S("{\n",_(T(e,"\n")),"\n}")}function S(e,t){return null!=t&&""!==t?e+t+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:""):""}function _(e){return S(" ",e.replace(/\n/g,"\n "))}function $(e){return-1!==e.indexOf("\n")}function A(e){return null!=e&&e.some($)}var D={en:{translation:{Loading:"Loading",Workplaces:"Workplaces","Select and arrange the order":"Select and arrange the order",Cancel:"Cancel",Save:"Save","History timeline time info now":"now",Settings:"Settings"}},pl:{translation:{Loading:"Wczytywanie",Workplaces:"Stanowiska","Select and arrange the order":"Wybierz i ustal kolejność",Cancel:"Anuluj",Save:"Zapisz","History timeline time info now":"teraz",Settings:"Ustawienia"}}},j="1.2.5",C=function(n){var r,o=n.data,u=n.formProps,l=e.useState("1"),f=l[0],d=l[1],h=i.useTranslation().t;return c.default.createElement(c.default.Fragment,null,c.default.createElement(s.TabContext,{value:f},c.default.createElement(a.Box,{sx:{borderBottom:1,borderColor:"divider"}},c.default.createElement(s.TabList,{onChange:function(e,t){d(t)}},c.default.createElement(a.Tab,{label:h("Workplaces"),value:"1"}))),c.default.createElement(s.TabPanel,{value:"1"},c.default.createElement(t.SortableSelect,{placeholder:h("Select and arrange the order")+"...",options:null==(r=o.workplaces)?void 0:r.map(function(e){return{label:e.name,value:e.id}}),selected:u.values.workplacesIds,onChange:function(e){return u.setFieldValue("workplacesIds",[].concat(e))}}))))},V=function(e,t,n){var r=e.startedAt.isAfter(t.startedAt)?e.startedAt:f.default(t.startedAt);return r&&t.finishedAt?Math.abs(r.diff(f.default(t.finishedAt),"seconds")):Math.abs(f.default(n).diff(r,"seconds"))},I=function(e){switch(e){case"green":return"#2ACB42";case"red":return"#FF453A";case"yellow":return"#FFC12F";default:return"#525860"}},N=function(){return N=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},N.apply(this,arguments)},z=function(t){var n=t.animate,r=void 0===n||n,i=t.backgroundColor,s=void 0===i?"#f5f6f7":i,a=t.backgroundOpacity,o=void 0===a?1:a,u=t.baseUrl,l=void 0===u?"":u,c=t.children,f=t.foregroundColor,d=void 0===f?"#eee":f,h=t.foregroundOpacity,p=void 0===h?1:h,m=t.gradientRatio,v=void 0===m?2:m,y=t.uniqueKey,g=t.rtl,b=void 0!==g&&g,x=t.speed,w=void 0===x?1.2:x,E=t.style,O=void 0===E?{}:E,k=t.title,T=void 0===k?"Loading...":k,F=t.beforeMask,S=void 0===F?null:F,_=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["animate","backgroundColor","backgroundOpacity","baseUrl","children","foregroundColor","foregroundOpacity","gradientRatio","uniqueKey","rtl","speed","style","title","beforeMask"]),$=e.useId();y&&($=y);var A="".concat($,"-diff"),D="".concat($,"-animated-diff"),j="".concat($,"-aria"),C=b?{transform:"scaleX(-1)"}:null,V="".concat(w,"s"),I="".concat(-1*v," 0"),z="".concat(v," 0");return e.createElement("svg",N({"aria-labelledby":j,role:"img",style:N(N({},O),C)},_),T?e.createElement("title",{id:j},T):null,S&&e.isValidElement(S)?S:null,e.createElement("rect",{role:"presentation",x:"0",y:"0",width:"100%",height:"100%",clipPath:"url(".concat(l,"#").concat(A,")"),style:{fill:"url(".concat(l,"#").concat(D,")")}}),e.createElement("defs",null,e.createElement("clipPath",{id:A},c),e.createElement("linearGradient",{id:D,gradientTransform:"translate(".concat(I,")")},e.createElement("stop",{offset:"0%",stopColor:s,stopOpacity:o}),e.createElement("stop",{offset:"50%",stopColor:d,stopOpacity:p}),e.createElement("stop",{offset:"100%",stopColor:s,stopOpacity:o}),r&&e.createElement("animateTransform",{attributeName:"gradientTransform",type:"translate",values:"".concat(I,"; 0 0; ").concat(z),dur:V,repeatCount:"indefinite"}))))},P=function(t){return e.createElement(t.children?z:q,N({},t))},q=function(t){return e.createElement(P,N({viewBox:"0 0 476 124"},t),e.createElement("rect",{x:"48",y:"8",width:"88",height:"6",rx:"3"}),e.createElement("rect",{x:"48",y:"26",width:"52",height:"6",rx:"3"}),e.createElement("rect",{x:"0",y:"56",width:"410",height:"6",rx:"3"}),e.createElement("rect",{x:"0",y:"72",width:"380",height:"6",rx:"3"}),e.createElement("rect",{x:"0",y:"88",width:"178",height:"6",rx:"3"}),e.createElement("circle",{cx:"20",cy:"20",r:"20"}))},U=P,M=function(){return c.default.createElement(U,{"data-testid":"timeline-loading",height:"28",width:"100%",speed:1.5,backgroundColor:"#3d3d3d",foregroundColor:"#ffffff"},c.default.createElement("rect",{x:"4%",y:"10",ry:"6",width:"92%",height:"14"}))},R=u.styled("div")({display:"flex",flexGrow:1,alignItems:"center",padding:"10px 0",background:"#252A32","&:nth-of-type(2n)":{background:"#30353d"}}),L=u.styled("div")({display:"flex",margin:"6px 0",zIndex:3,flexDirection:"row",height:"20px",width:"100%",overflow:"hidden",borderRadius:"4px",backgroundColor:"rgba(0, 0, 0, 0.2)"});u.styled("div")({display:"flex",alignItems:"center",justifyContent:"space-between"});var Z=u.styled("span")({margin:"0 1.5em",fontSize:"12px",fontWeight:500,lineHeight:"12px",color:"rgba(255, 255, 255, 0.5)"}),B=u.styled("div")(function(e){return{flexBasis:e.percentWidth+"%",flexShrink:0,backgroundColor:I(e.color),"&:first-of-type":{borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px"}}});f.default.extend(d.default);var W=function(t){var n=t.title,r=t.shift,i=t.statusChanges,s=t.loading,o=e.useState([]),u=o[0],l=o[1],d=e.useCallback(function(){return r?Math.abs(r.startedAt.diff(r.finishedAt,"seconds")):0},[r]),h=e.useCallback(function(e){var t=f.default(e.startedAt),n=e.finishedAt?f.default(e.finishedAt):null;return!!r&&(t.isBetween(r.startedAt,r.finishedAt)||(null==n?void 0:n.isBetween(r.startedAt,r.finishedAt))||t.isBefore(r.startedAt)&&!n)},[r]),p=e.useState(function(){return d()}),m=p[0],v=p[1];return e.useEffect(function(){v(d())},[r,d]),e.useEffect(function(){l(i.filter(function(e){return h(e)}))},[i,h]),s?c.default.createElement(M,null):c.default.createElement(R,null,c.default.createElement(a.Typography,{sx:{display:n?"block":"none",flexBasis:"25%",marginLeft:"20px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"white"}},n),r&&c.default.createElement(c.default.Fragment,null,c.default.createElement(Z,null,r.startedAt.format("HH:mm")),c.default.createElement(L,{"data-testid":"timeline"},null==u?void 0:u.map(function(e){return e.reason.statusColor&&c.default.createElement(B,{"data-testid":"timeline-element-"+e.id+"-color-"+e.reason.statusColor,key:""+e.id+e.author.id,color:e.reason.statusColor,percentWidth:Math.min(V(r,e,new Date)/m*100,100)})})),c.default.createElement(Z,null,r.finishedAt.format("HH:mm"))))},H=function(n){var r=n.data,i=n.settings,s=e.useState(null),o=s[0],u=s[1],l=function(e){var t,n,s=r.workplaces;return 1===(null==i||null==(t=i.workplacesIds)?void 0:t.length)?"":(null==s||null==(n=s.find(function(t){return t.id===e}))?void 0:n.name)||""};return e.useEffect(function(){var e=function(){var e=f.default();u(t.getCurrentShift(e,t.normalizeShifts((null==r?void 0:r.shifts)||[],e)))},n=setInterval(function(){return e()},1e4);return e(),function(){clearInterval(n)}},[null==r?void 0:r.shifts]),c.default.createElement(a.Box,{display:"flex",flexDirection:"column",height:"100%"},null==i?void 0:i.workplacesIds.map(function(e){var t;return c.default.createElement(W,{key:e,title:l(e),shift:o,statusChanges:(null==(t=r.statusChanges)?void 0:t.filter(function(t){return t.workplaceId===e}))||[],loading:void 0===r})}))};function J(e){this._maxSize=e,this.clear()}J.prototype.clear=function(){this._size=0,this._values=Object.create(null)},J.prototype.get=function(e){return this._values[e]},J.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var Y=/[^.^\]^[]+|(?=\[\]|\.\.)/g,K=/^\d+$/,G=/^\d/,X=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,Q=/^\s*(['"]?)(.*?)(\1)\s*$/,ee=new J(512),te=new J(512),ne=new J(512),re={Cache:J,split:se,normalizePath:ie,setter:function(e){var t=ie(e);return te.get(e)||te.set(e,function(e,n){for(var r=0,i=t.length,s=e;r<i-1;){var a=t[r];if("__proto__"===a||"constructor"===a||"prototype"===a)return e;s=s[t[r++]]}s[t[r]]=n})},getter:function(e,t){var n=ie(e);return ne.get(e)||ne.set(e,function(e){for(var r=0,i=n.length;r<i;){if(null==e&&t)return;e=e[n[r++]]}return e})},join:function(e){return e.reduce(function(e,t){return e+(ae(t)||K.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(e,t,n){!function(e,t,n){var r,i,s,a,o=e.length;for(i=0;i<o;i++)(r=e[i])&&(oe(r)&&(r='"'+r+'"'),s=!(a=ae(r))&&/^\d+$/.test(r),t.call(n,r,a,s,i,e))}(Array.isArray(e)?e:se(e),t,n)}};function ie(e){return ee.get(e)||ee.set(e,se(e).map(function(e){return e.replace(Q,"$2")}))}function se(e){return e.match(Y)||[""]}function ae(e){return"string"==typeof e&&e&&-1!==["'",'"'].indexOf(e.charAt(0))}function oe(e){return!ae(e)&&(function(e){return e.match(G)&&!e.match(K)}(e)||function(e){return X.test(e)}(e))}const ue=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,le=e=>e.match(ue)||[];var ce=e=>le(e).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,""),fe=e=>(e=>le(e).join("_").toLowerCase())(e),de=function(e){return he(function(e){for(var t=new Set,n=0,r=e.length;n<r;n++){var i=e[n];t.add(i[0]),t.add(i[1])}return Array.from(t)}(e),e)};function he(e,t){var n=e.length,r=new Array(n),i={},s=n,a=function(e){for(var t=new Map,n=0,r=e.length;n<r;n++){var i=e[n];t.has(i[0])||t.set(i[0],new Set),t.has(i[1])||t.set(i[1],new Set),t.get(i[0]).add(i[1])}return t}(t),o=function(e){for(var t=new Map,n=0,r=e.length;n<r;n++)t.set(e[n],n);return t}(e);for(t.forEach(function(e){if(!o.has(e[0])||!o.has(e[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});s--;)i[s]||u(e[s],s,new Set);return r;function u(e,t,s){if(s.has(e)){var l;try{l=", node was:"+JSON.stringify(e)}catch(e){l=""}throw new Error("Cyclic dependency"+l)}if(!o.has(e))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(e));if(!i[t]){i[t]=!0;var c=a.get(e)||new Set;if(t=(c=Array.from(c)).length){s.add(e);do{var f=c[--t];u(f,o.get(f),s)}while(t);s.delete(e)}r[--n]=e}}}de.array=he;const pe=Object.prototype.toString,me=Error.prototype.toString,ve=RegExp.prototype.toString,ye="undefined"!=typeof Symbol?Symbol.prototype.toString:()=>"",ge=/^Symbol\((.*)\)(.*)$/;function be(e,t=!1){if(null==e||!0===e||!1===e)return""+e;const n=typeof e;if("number"===n)return function(e){return e!=+e?"NaN":0===e&&1/e<0?"-0":""+e}(e);if("string"===n)return t?`"${e}"`:e;if("function"===n)return"[Function "+(e.name||"anonymous")+"]";if("symbol"===n)return ye.call(e).replace(ge,"Symbol($1)");const r=pe.call(e).slice(8,-1);return"Date"===r?isNaN(e.getTime())?""+e:e.toISOString(e):"Error"===r||e instanceof Error?"["+me.call(e)+"]":"RegExp"===r?ve.call(e):null}function xe(e,t){let n=be(e,t);return null!==n?n:JSON.stringify(e,function(e,n){let r=be(this[e],t);return null!==r?r:n},2)}function we(e){return null==e?[]:[].concat(e)}let Ee,Oe,ke,Te=/\$\{\s*(\w+)\s*\}/g;Ee=Symbol.toStringTag;class Fe{constructor(e,t,n,r){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[Ee]="Error",this.name="ValidationError",this.value=t,this.path=n,this.type=r,this.errors=[],this.inner=[],we(e).forEach(e=>{Se.isError(e)?(this.errors.push(...e.errors),this.inner.push(...e.inner.length?e.inner:[e])):this.errors.push(e)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}Oe=Symbol.hasInstance,ke=Symbol.toStringTag;class Se extends Error{static formatError(e,t){return t=Object.assign({},t,{path:t.label||t.path||"this",originalPath:t.path}),"string"==typeof e?e.replace(Te,(e,n)=>xe(t[n])):"function"==typeof e?e(t):e}static isError(e){return e&&"ValidationError"===e.name}constructor(e,t,n,r,i){const s=new Fe(e,t,n,r);if(i)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[ke]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,Se)}static[Oe](e){return Fe[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let _e={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:n,originalValue:r})=>{const i=null!=r&&r!==n?` (cast from the value \`${xe(r,!0)}\`).`:".";return"mixed"!==t?`${e} must be a \`${t}\` type, but the final value was: \`${xe(n,!0)}\``+i:`${e} must match the configured type. The validated value was: \`${xe(n,!0)}\``+i}},$e={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Ae={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},De={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},je={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},Ce={notType:e=>{const{path:t,value:n,spec:r}=e,i=r.types.length;if(Array.isArray(n)){if(n.length<i)return`${t} tuple value has too few items, expected a length of ${i} but got ${n.length} for value: \`${xe(n,!0)}\``;if(n.length>i)return`${t} tuple value has too many items, expected a length of ${i} but got ${n.length} for value: \`${xe(n,!0)}\``}return Se.formatError(_e.notType,e)}};var Ve=Object.assign(Object.create(null),{mixed:_e,string:$e,number:{min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date:Ae,object:De,array:je,boolean:{isValue:"${path} field must be ${value}"},tuple:Ce});const Ie=e=>e&&e.__isYupSchema__;class Ne{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:r,otherwise:i}=t,s="function"==typeof n?n:(...e)=>e.every(e=>e===n);return new Ne(e,(e,t)=>{var n;let a=s(...e)?r:i;return null!=(n=null==a?void 0:a(t))?n:t})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let n=this.refs.map(e=>e.getValue(null==t?void 0:t.value,null==t?void 0:t.parent,null==t?void 0:t.context)),r=this.fn(n,e,t);if(void 0===r||r===e)return e;if(!Ie(r))throw new TypeError("conditions must return a schema object");return r.resolve(t)}}class ze{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,"string"!=typeof e)throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),""===e)throw new TypeError("ref must be a non-empty string");this.isContext="$"===this.key[0],this.isValue="."===this.key[0],this.isSibling=!this.isContext&&!this.isValue,this.path=this.key.slice((this.isContext?"$":this.isValue?".":"").length),this.getter=this.path&&re.getter(this.path,!0),this.map=t.map}getValue(e,t,n){let r=this.isContext?n:this.isValue?e:t;return this.getter&&(r=this.getter(r||{})),this.map&&(r=this.map(r)),r}cast(e,t){return this.getValue(e,null==t?void 0:t.parent,null==t?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}ze.prototype.__isYupRef=!0;const Pe=e=>null==e;function qe(e){function t({value:t,path:n="",options:r,originalValue:i,schema:s},a,o){const{name:u,test:l,params:c,message:f,skipAbsent:d}=e;let{parent:h,context:p,abortEarly:m=s.spec.abortEarly,disableStackTrace:v=s.spec.disableStackTrace}=r;const y={value:t,parent:h,context:p};function g(e={}){const r=Ue(Object.assign({value:t,originalValue:i,label:s.spec.label,path:e.path||n,spec:s.spec,disableStackTrace:e.disableStackTrace||v},c,e.params),y),a=new Se(Se.formatError(e.message||f,r),t,r.path,e.type||u,r.disableStackTrace);return a.params=r,a}const b=m?a:o;let x={path:n,parent:h,type:u,from:r.from,createError:g,resolve:e=>Me(e,y),options:r,originalValue:i,schema:s};const w=e=>{Se.isError(e)?b(e):e?o(null):b(g())},E=e=>{Se.isError(e)?b(e):a(e)};if(d&&Pe(t))return w(!0);let O;try{var k;if(O=l.call(x,t,x),"function"==typeof(null==(k=O)?void 0:k.then)){if(r.sync)throw new Error(`Validation test of type: "${x.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(O).then(w,E)}}catch(e){return void E(e)}w(O)}return t.OPTIONS=e,t}function Ue(e,t){if(!e)return e;for(const n of Object.keys(e))e[n]=Me(e[n],t);return e}function Me(e,t){return ze.isRef(e)?e.getValue(t.value,t.parent,t.context):e}function Re(e,t,n,r=n){let i,s,a;return t?(re.forEach(t,(o,u,l)=>{let c=u?o.slice(1,o.length-1):o,f="tuple"===(e=e.resolve({context:r,parent:i,value:n})).type,d=l?parseInt(c,10):0;if(e.innerType||f){if(f&&!l)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${a}" must contain an index to the tuple element, e.g. "${a}[0]"`);if(n&&d>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${o}, in the path: ${t}. because there is no value at that index. `);i=n,n=n&&n[d],e=f?e.spec.types[d]:e.innerType}if(!l){if(!e.fields||!e.fields[c])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${a} which is a type: "${e.type}")`);i=n,n=n&&n[c],e=e.fields[c]}s=c,a=u?"["+o+"]":"."+o}),{schema:e,parent:i,parentPath:s}):{parent:i,parentPath:t,schema:e}}class Le extends Set{describe(){const e=[];for(const t of this.values())e.push(ze.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const n of this.values())t.push(e(n));return t}clone(){return new Le(this.values())}merge(e,t){const n=this.clone();return e.forEach(e=>n.add(e)),t.forEach(e=>n.delete(e)),n}}function Ze(e,t=new Map){if(Ie(e)||!e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let n;if(e instanceof Date)n=new Date(e.getTime()),t.set(e,n);else if(e instanceof RegExp)n=new RegExp(e),t.set(e,n);else if(Array.isArray(e)){n=new Array(e.length),t.set(e,n);for(let r=0;r<e.length;r++)n[r]=Ze(e[r],t)}else if(e instanceof Map){n=new Map,t.set(e,n);for(const[r,i]of e.entries())n.set(r,Ze(i,t))}else if(e instanceof Set){n=new Set,t.set(e,n);for(const r of e)n.add(Ze(r,t))}else{if(!(e instanceof Object))throw Error(`Unable to clone ${e}`);n={},t.set(e,n);for(const[r,i]of Object.entries(e))n[r]=Ze(i,t)}return n}function Be(e){if(null==e||!e.length)return;const t=[];let n="",r=!1,i=!1;for(let s=0;s<e.length;s++){const a=e[s];"["!==a||i?"]"!==a||i?'"'!==a?"."!==a||r||i?n+=a:n&&(t.push(n),n=""):i=!i:(n&&(/^\d+$/.test(n)?t.push(n):t.push(n.replace(/^"|"$/g,"")),n=""),r=!1):(n&&(t.push(...n.split(".").filter(Boolean)),n=""),r=!0)}return n&&t.push(...n.split(".").filter(Boolean)),t}function We(e,t){var n;if((null==(n=e.inner)||!n.length)&&e.errors.length)return function(e,t){const n=t?`${t}.${e.path}`:e.path;return e.errors.map(e=>({message:e,path:Be(n)}))}(e,t);const r=t?`${t}.${e.path}`:e.path;return e.inner.flatMap(e=>We(e,r))}class He{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new Le,this._blacklist=new Le,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(_e.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},null==e?void 0:e.spec),this.withMutation(e=>{e.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=Ze(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let n=e(this);return this._mutate=t,n}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&"mixed"!==this.type)throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,n=e.clone();const r=Object.assign({},t.spec,n.spec);return n.spec=r,n.internalTests=Object.assign({},t.internalTests,n.internalTests),n._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),n._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),n.tests=t.tests,n.exclusiveTests=t.exclusiveTests,n.withMutation(t=>{e.tests.forEach(e=>{t.test(e.OPTIONS)})}),n.transforms=[...t.transforms,...n.transforms],n}isType(e){return null==e?!(!this.spec.nullable||null!==e)||!(!this.spec.optional||void 0!==e):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let n=t.conditions;t=t.clone(),t.conditions=[],t=n.reduce((t,n)=>n.resolve(t,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,n,r,i;return Object.assign({},e,{from:e.from||[],strict:null!=(t=e.strict)?t:this.spec.strict,abortEarly:null!=(n=e.abortEarly)?n:this.spec.abortEarly,recursive:null!=(r=e.recursive)?r:this.spec.recursive,disableStackTrace:null!=(i=e.disableStackTrace)?i:this.spec.disableStackTrace})}cast(e,t={}){let n=this.resolve(Object.assign({},t,{value:e})),r="ignore-optionality"===t.assert,i=n._cast(e,t);if(!1!==t.assert&&!n.isType(i)){if(r&&Pe(i))return i;let s=xe(e),a=xe(i);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}". \n\nattempted value: ${s} \n`+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,t){let n=void 0===e?e:this.transforms.reduce((n,r)=>r.call(this,n,e,this,t),e);return void 0===n&&(n=this.getDefault(t)),n}_validate(e,t={},n,r){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=t,o=e;a||(o=this._cast(o,Object.assign({assert:!1},t)));let u=[];for(let e of Object.values(this.internalTests))e&&u.push(e);this.runTests({path:i,value:o,originalValue:s,options:t,tests:u},n,e=>{if(e.length)return r(e,o);this.runTests({path:i,value:o,originalValue:s,options:t,tests:this.tests},n,r)})}runTests(e,t,n){let r=!1,{tests:i,value:s,originalValue:a,path:o,options:u}=e,l=e=>{r||(r=!0,t(e,s))},c=e=>{r||(r=!0,n(e,s))},f=i.length,d=[];if(!f)return c([]);let h={value:s,originalValue:a,path:o,options:u,schema:this};for(let e=0;e<i.length;e++)(0,i[e])(h,l,function(e){e&&(Array.isArray(e)?d.push(...e):d.push(e)),--f<=0&&c(d)})}asNestedTest({key:e,index:t,parent:n,parentPath:r,originalParent:i,options:s}){const a=null!=e?e:t;if(null==a)throw TypeError("Must include `key` or `index` for nested validations");const o="number"==typeof a;let u=n[a];const l=Object.assign({},s,{strict:!0,parent:n,value:u,originalValue:i[a],key:void 0,[o?"index":"key"]:a,path:o||a.includes(".")?`${r||""}[${o?a:`"${a}"`}]`:(r?`${r}.`:"")+e});return(e,t,n)=>this.resolve(l)._validate(u,l,t,n)}validate(e,t){var n;let r=this.resolve(Object.assign({},t,{value:e})),i=null!=(n=null==t?void 0:t.disableStackTrace)?n:r.spec.disableStackTrace;return new Promise((n,s)=>r._validate(e,t,(e,t)=>{Se.isError(e)&&(e.value=t),s(e)},(e,t)=>{e.length?s(new Se(e,t,void 0,void 0,i)):n(t)}))}validateSync(e,t){var n;let r,i=this.resolve(Object.assign({},t,{value:e})),s=null!=(n=null==t?void 0:t.disableStackTrace)?n:i.spec.disableStackTrace;return i._validate(e,Object.assign({},t,{sync:!0}),(e,t)=>{throw Se.isError(e)&&(e.value=t),e},(t,n)=>{if(t.length)throw new Se(t,e,void 0,void 0,s);r=n}),r}isValid(e,t){return this.validate(e,t).then(()=>!0,e=>{if(Se.isError(e))return!1;throw e})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(e){if(Se.isError(e))return!1;throw e}}_getDefault(e){let t=this.spec.default;return null==t?t:"function"==typeof t?t.call(this,e):Ze(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return 0===arguments.length?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const n=this.clone({nullable:e});return n.internalTests.nullable=qe({message:t,name:"nullable",test(e){return null!==e||this.schema.spec.nullable}}),n}optionality(e,t){const n=this.clone({optional:e});return n.internalTests.optionality=qe({message:t,name:"optionality",test(e){return void 0!==e||this.schema.spec.optional}}),n}optional(){return this.optionality(!0)}defined(e=_e.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=_e.notNull){return this.nullability(!1,e)}required(e=_e.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(t=1===e.length?"function"==typeof e[0]?{test:e[0]}:e[0]:2===e.length?{name:e[0],test:e[1]}:{name:e[0],message:e[1],test:e[2]},void 0===t.message&&(t.message=_e.default),"function"!=typeof t.test)throw new TypeError("`test` is a required parameters");let n=this.clone(),r=qe(t),i=t.exclusive||t.name&&!0===n.exclusiveTests[t.name];if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(n.exclusiveTests[t.name]=!!t.exclusive),n.tests=n.tests.filter(e=>{if(e.OPTIONS.name===t.name){if(i)return!1;if(e.OPTIONS.test===r.OPTIONS.test)return!1}return!0}),n.tests.push(r),n}when(e,t){Array.isArray(e)||"string"==typeof e||(t=e,e=".");let n=this.clone(),r=we(e).map(e=>new ze(e));return r.forEach(e=>{e.isSibling&&n.deps.push(e.key)}),n.conditions.push("function"==typeof t?new Ne(r,t):Ne.fromOptions(r,t)),n}typeError(e){let t=this.clone();return t.internalTests.typeError=qe({message:e,name:"typeError",skipAbsent:!0,test(e){return!!this.schema._typeCheck(e)||this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=_e.oneOf){let n=this.clone();return e.forEach(e=>{n._whitelist.add(e),n._blacklist.delete(e)}),n.internalTests.whiteList=qe({message:t,name:"oneOf",skipAbsent:!0,test(e){let t=this.schema._whitelist,n=t.resolveAll(this.resolve);return!!n.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:n}})}}),n}notOneOf(e,t=_e.notOneOf){let n=this.clone();return e.forEach(e=>{n._blacklist.add(e),n._whitelist.delete(e)}),n.internalTests.blacklist=qe({message:t,name:"notOneOf",test(e){let t=this.schema._blacklist,n=t.resolveAll(this.resolve);return!n.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:n}})}}),n}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:n,meta:r,optional:i,nullable:s}=t.spec;return{meta:r,label:n,optional:i,nullable:s,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.filter((e,t,n)=>n.findIndex(t=>t.OPTIONS.name===e.OPTIONS.name)===t).map(t=>{const n=t.OPTIONS.params&&e?Ue(Object.assign({},t.OPTIONS.params),e):t.OPTIONS.params;return{name:t.OPTIONS.name,params:n}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(t){try{return{value:await e.validate(t,{abortEarly:!1})}}catch(e){if(e instanceof Se)return{issues:We(e)};throw e}}}}}He.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])He.prototype[`${e}At`]=function(t,n,r={}){const{parent:i,parentPath:s,schema:a}=Re(this,t,n,r.context);return a[e](i&&i[s],Object.assign({},r,{parent:i,path:t}))};for(const e of["equals","is"])He.prototype[e]=He.prototype.oneOf;for(const e of["not","nope"])He.prototype[e]=He.prototype.notOneOf;const Je=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Ye(e){var t,n;const r=Je.exec(e);return r?{year:Ke(r[1]),month:Ke(r[2],1)-1,day:Ke(r[3],1),hour:Ke(r[4]),minute:Ke(r[5]),second:Ke(r[6]),millisecond:r[7]?Ke(r[7].substring(0,3)):0,precision:null!=(t=null==(n=r[7])?void 0:n.length)?t:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:Ke(r[10]),minuteOffset:Ke(r[11])}:null}function Ke(e,t=0){return Number(e)||t}let Ge=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Xe=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Qe=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,et=new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"),tt=e=>Pe(e)||e===e.trim(),nt={}.toString();function rt(){return new it}class it extends He{constructor(){super({type:"string",check:e=>(e instanceof String&&(e=e.valueOf()),"string"==typeof e)}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce||this.isType(e))return e;if(Array.isArray(e))return e;const n=null!=e&&e.toString?e.toString():e;return n===nt?e:n})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||_e.required,name:"required",skipAbsent:!0,test:e=>!!e.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(e=>"required"!==e.OPTIONS.name),e))}length(e,t=$e.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t=$e.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t=$e.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}matches(e,t){let n,r,i=!1;return t&&("object"==typeof t?({excludeEmptyString:i=!1,message:n,name:r}=t):n=t),this.test({name:r||"matches",message:n||$e.matches,params:{regex:e},skipAbsent:!0,test:t=>""===t&&i||-1!==t.search(e)})}email(e=$e.email){return this.matches(Ge,{name:"email",message:e,excludeEmptyString:!0})}url(e=$e.url){return this.matches(Xe,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=$e.uuid){return this.matches(Qe,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t,n,r="";return e&&("object"==typeof e?({message:r="",allowOffset:t=!1,precision:n}=e):r=e),this.matches(et,{name:"datetime",message:r||$e.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||$e.datetime_offset,params:{allowOffset:t},skipAbsent:!0,test:e=>{if(!e||t)return!0;const n=Ye(e);return!!n&&!!n.z}}).test({name:"datetime_precision",message:r||$e.datetime_precision,params:{precision:n},skipAbsent:!0,test:e=>{if(!e||null==n)return!0;const t=Ye(e);return!!t&&t.precision===n}})}ensure(){return this.default("").transform(e=>null===e?"":e)}trim(e=$e.trim){return this.transform(e=>null!=e?e.trim():e).test({message:e,name:"trim",test:tt})}lowercase(e=$e.lowercase){return this.transform(e=>Pe(e)?e:e.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>Pe(e)||e===e.toLowerCase()})}uppercase(e=$e.uppercase){return this.transform(e=>Pe(e)?e:e.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>Pe(e)||e===e.toUpperCase()})}}rt.prototype=it.prototype;let st=new Date("");class at extends He{constructor(){super({type:"date",check:e=>"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.getTime())}),this.withMutation(()=>{this.transform((e,t)=>!this.spec.coerce||this.isType(e)||null===e?e:(e=function(e){const t=Ye(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(void 0===t.z&&void 0===t.plusMinus)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let n=0;return"Z"!==t.z&&void 0!==t.plusMinus&&(n=60*t.hourOffset+t.minuteOffset,"+"===t.plusMinus&&(n=0-n)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+n,t.second,t.millisecond)}(e),isNaN(e)?at.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let n;if(ze.isRef(e))n=e;else{let r=this.cast(e);if(!this._typeCheck(r))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);n=r}return n}min(e,t=Ae.min){let n=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(e){return e>=this.resolve(n)}})}max(e,t=Ae.max){let n=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(e){return e<=this.resolve(n)}})}}function ot(e,t){let n=Infinity;return e.some((e,r)=>{var i;if(null!=(i=t.path)&&i.includes(e))return n=r,!0}),n}function ut(e){return(t,n)=>ot(e,t)-ot(e,n)}at.INVALID_DATE=st;const lt=(e,t,n)=>{if("string"!=typeof e)return e;let r=e;try{r=JSON.parse(e)}catch(e){}return n.isType(r)?r:e};function ct(e){if("fields"in e){const t={};for(const[n,r]of Object.entries(e.fields))t[n]=ct(r);return e.setFields(t)}if("array"===e.type){const t=e.optional();return t.innerType&&(t.innerType=ct(t.innerType)),t}return"tuple"===e.type?e.optional().clone({types:e.spec.types.map(ct)}):"optional"in e?e.optional():e}let ft=e=>"[object Object]"===Object.prototype.toString.call(e);function dt(e,t){let n=Object.keys(e.fields);return Object.keys(t).filter(e=>-1===n.indexOf(e))}const ht=ut([]);function pt(e){return new mt(e)}class mt extends He{constructor(e){super({type:"object",check:e=>ft(e)||"function"==typeof e}),this.fields=Object.create(null),this._sortErrors=ht,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var n;let r=super._cast(e,t);if(void 0===r)return this.getDefault(t);if(!this._typeCheck(r))return r;let i=this.fields,s=null!=(n=t.stripUnknown)?n:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(r).filter(e=>!this._nodes.includes(e))),o={},u=Object.assign({},t,{parent:o,__validating:t.__validating||!1}),l=!1;for(const e of a){let n=i[e],a=e in r,c=r[e];if(n){let i;u.path=(t.path?`${t.path}.`:"")+e,n=n.resolve({value:c,context:t.context,parent:o});let s=n instanceof He?n.spec:void 0,a=null==s?void 0:s.strict;if(null!=s&&s.strip){l=l||e in r;continue}i=t.__validating&&a?c:n.cast(c,u),void 0!==i&&(o[e]=i)}else a&&!s&&(o[e]=c);a===e in o&&o[e]===c||(l=!0)}return l?o:r}_validate(e,t={},n,r){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=t;t.from=[{schema:this,value:s},...i],t.__validating=!0,t.originalValue=s,super._validate(e,t,n,(e,i)=>{if(!a||!ft(i))return void r(e,i);s=s||i;let o=[];for(let e of this._nodes){let n=this.fields[e];n&&!ze.isRef(n)&&o.push(n.asNestedTest({options:t,key:e,parent:i,parentPath:t.path,originalParent:s}))}this.runTests({tests:o,value:i,originalValue:s,options:t},n,t=>{r(t.sort(this._sortErrors).concat(e),i)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),n=t.fields;for(let[e,t]of Object.entries(this.fields)){const r=n[e];n[e]=void 0===r?t:r}return t.withMutation(t=>t.setFields(n,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(n=>{var r;const i=this.fields[n];let s=e;null!=(r=s)&&r.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[n]})),t[n]=i&&"getDefault"in i?i.getDefault(s):void 0}),t}setFields(e,t){let n=this.clone();return n.fields=e,n._nodes=function(e,t=[]){let n=[],r=new Set,i=new Set(t.map(([e,t])=>`${e}-${t}`));function s(e,t){let s=re.split(e)[0];r.add(s),i.has(`${t}-${s}`)||n.push([t,s])}for(const t of Object.keys(e)){let n=e[t];r.add(t),ze.isRef(n)&&n.isSibling?s(n.path,t):Ie(n)&&"deps"in n&&n.deps.forEach(e=>s(e,t))}return de.array(Array.from(r),n).reverse()}(e,t),n._sortErrors=ut(Object.keys(e)),t&&(n._excludedEdges=t),n}shape(e,t=[]){return this.clone().withMutation(n=>{let r=n._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),r=[...n._excludedEdges,...t]),n.setFields(Object.assign(n.fields,e),r)})}partial(){const e={};for(const[t,n]of Object.entries(this.fields))e[t]="optional"in n&&n.optional instanceof Function?n.optional():n;return this.setFields(e)}deepPartial(){return ct(this)}pick(e){const t={};for(const n of e)this.fields[n]&&(t[n]=this.fields[n]);return this.setFields(t,this._excludedEdges.filter(([t,n])=>e.includes(t)&&e.includes(n)))}omit(e){const t=[];for(const n of Object.keys(this.fields))e.includes(n)||t.push(n);return this.pick(t)}from(e,t,n){let r=re.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return((e,t)=>{const n=[...re.normalizePath(t)];if(1===n.length)return n[0]in e;let r=n.pop(),i=re.getter(re.join(n),!0)(e);return!(!i||!(r in i))})(i,e)&&(s=Object.assign({},i),n||delete s[e],s[t]=r(i)),s})}json(){return this.transform(lt)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||De.exact,test(e){if(null==e)return!0;const t=dt(this.schema,e);return 0===t.length||this.createError({params:{properties:t.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=De.noUnknown){"boolean"!=typeof e&&(t=e,e=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:t,test(t){if(null==t)return!0;const n=dt(this.schema,t);return!e||0===n.length||this.createError({params:{unknown:n.join(", ")}})}});return n.spec.noUnknown=e,n}unknown(e=!0,t=De.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const n={};for(const r of Object.keys(t))n[e(r)]=t[r];return n})}camelCase(){return this.transformKeys(ce)}snakeCase(){return this.transformKeys(fe)}constantCase(){return this.transformKeys(e=>fe(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),n=super.describe(e);n.fields={};for(const[i,s]of Object.entries(t.fields)){var r;let t=e;null!=(r=t)&&r.value&&(t=Object.assign({},t,{parent:t.value,value:t.value[i]})),n.fields[i]=s.describe(t)}return n}}function vt(e){return new yt(e)}pt.prototype=mt.prototype;class yt extends He{constructor(e){super({type:"array",spec:{types:e},check:e=>Array.isArray(e)}),this.innerType=void 0,this.innerType=e}_cast(e,t){const n=super._cast(e,t);if(!this._typeCheck(n)||!this.innerType)return n;let r=!1;const i=n.map((e,i)=>{const s=this.innerType.cast(e,Object.assign({},t,{path:`${t.path||""}[${i}]`,parent:n,originalValue:e,value:e,index:i}));return s!==e&&(r=!0),s});return r?i:n}_validate(e,t={},n,r){var i;let s=this.innerType,a=null!=(i=t.recursive)?i:this.spec.recursive;super._validate(e,t,n,(i,o)=>{var u;if(!a||!s||!this._typeCheck(o))return void r(i,o);let l=new Array(o.length);for(let n=0;n<o.length;n++){var c;l[n]=s.asNestedTest({options:t,index:n,parent:o,parentPath:t.path,originalParent:null!=(c=t.originalValue)?c:e})}this.runTests({value:o,tests:l,originalValue:null!=(u=t.originalValue)?u:e,options:t},n,e=>r(e.concat(i),o))})}clone(e){const t=super.clone(e);return t.innerType=this.innerType,t}json(){return this.transform(lt)}concat(e){let t=super.concat(e);return t.innerType=this.innerType,e.innerType&&(t.innerType=t.innerType?t.innerType.concat(e.innerType):e.innerType),t}of(e){let t=this.clone();if(!Ie(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+xe(e));return t.innerType=e,t.spec=Object.assign({},t.spec,{types:e}),t}length(e,t=je.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t){return this.test({message:t=t||je.min,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t){return this.test({message:t=t||je.max,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}ensure(){return this.default(()=>[]).transform((e,t)=>this._typeCheck(e)?e:null==t?[]:[].concat(t))}compact(e){let t=e?(t,n,r)=>!e(t,n,r):e=>!!e;return this.transform(e=>null!=e?e.filter(t):e)}describe(e){const t=(e?this.resolve(e):this).clone(),n=super.describe(e);if(t.innerType){var r;let i=e;null!=(r=i)&&r.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[0]})),n.innerType=t.innerType.describe(i)}return n}}vt.prototype=yt.prototype;var gt=function(e){var t;return t={mixed:{required:e("This field is required")}},Object.keys(t).forEach(e=>{Object.keys(t[e]).forEach(n=>{Ve[e][n]=t[e][n]})}),{initialValues:{workplacesIds:[]},validationSchema:pt({workplacesIds:vt().of(rt()).required()})}},bt=["url","wsUrl","lang","data","settings"];exports.Widget=function(r){var i=r.url,s=r.wsUrl,a=r.lang,o=r.data,u=r.settings,l=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(r,bt),d=t.useGqlClients({url:i,wsUrl:s,lang:a}),p=d.graphqlSdk,m=d.gqlWsClient,y=e.useState(o),b=y[0],k=y[1],T=e.useState(u),F=T[0],S=T[1];e.useEffect(function(){!o&&p&&(p.shifts().then(function(e){var t=e.shifts;return k(function(e){return h({},e||{},{shifts:t})})}).catch(function(){}),p.listWorkplaces().then(function(e){var t=e.workplaces;return k(function(e){return h({},e||{},{workplaces:t})})}).catch(function(){}),p.listStatusChanges().then(function(e){var t=e.statusChanges;return k(function(e){return h({},e||{},{statusChanges:(n=t,n.sort(function(e,t){return e.finishedAt&&t.finishedAt?f.default(e.finishedAt).diff(f.default(t.finishedAt)):e.finishedAt?-1:1}))});var n})}).catch(function(){})),null!=F&&F.workplacesIds&&m&&F.workplacesIds.forEach(function(e){m.subscribe(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:x,r=void 0,i=Array.isArray(e),s=[e],a=-1,o=[],u=void 0,l=void 0,c=void 0,f=[],d=[],h=e;do{var p=++a===s.length,m=p&&0!==o.length;if(p){if(l=0===d.length?void 0:f[f.length-1],u=c,c=d.pop(),m){if(i)u=u.slice();else{for(var y={},b=0,O=Object.keys(u);b<O.length;b++){var k=O[b];y[k]=u[k]}u=y}for(var T=0,F=0;F<o.length;F++){var S=o[F][0],_=o[F][1];i&&(S-=T),i&&null===_?(u.splice(S,1),T++):u[S]=_}}a=r.index,s=r.keys,o=r.edits,i=r.inArray,r=r.prev}else{if(l=c?i?a:s[a]:void 0,null==(u=c?c[l]:h))continue;c&&f.push(l)}var $,A=void 0;if(!Array.isArray(u)){if(!v(u))throw new Error("Invalid AST Node: ".concat(g(u),"."));var D=E(t,u.kind,p);if(D){if((A=D.call(t,u,l,c,f,d))===w)break;if(!1===A){if(!p){f.pop();continue}}else if(void 0!==A&&(o.push([l,A]),!p)){if(!v(A)){f.pop();continue}u=A}}}void 0===A&&m&&o.push([l,u]),p?f.pop():(r={inArray:i,index:a,keys:s,edits:o,prev:r},s=(i=Array.isArray(u))?u:null!==($=n[u.kind])&&void 0!==$?$:[],a=-1,o=[],c&&d.push(c),c=u)}while(void 0!==r);return 0!==o.length&&(h=o[o.length-1][1]),h}(t.WorkplaceEventDocument,{leave:O}),{id:e},function(n){var r=n.event,i=n.subject;if(r===t.WorkplaceEvent.StatusChangeCreated){var s=i;k(function(t){var n,r=null==t||null==(n=t.statusChanges)?void 0:n.filter(function(t){return t.workplaceId===e}),i=r[r.length-1];return i&&(i.finishedAt=s.startedAt),h({},t||{},{statusChanges:[].concat(t.statusChanges,[s])})})}else if(r===t.WorkplaceEvent.StatusChangeUpdated){var a=i;k(function(e){var t=e.statusChanges.map(function(e){return e.id===a.id?a:e});return h({},e||{},{statusChanges:t})})}})})},[o,p,m,F]);var _=e.useCallback(function(e){S(h({},e))},[S]);return c.default.createElement(n.BaseWidget,h({lang:a,locales:D,data:b,settings:u,gqlClients:{graphqlSdk:p,gqlWsClient:m},onSettingsChange:_,WidgetView:H,getSettingsFormProps:gt,SettingsFormContent:C,version:j,"data-testid":"workplaces-state-timelines-widget"},l))},exports.extraPermissions=[],exports.getDisplayName=function(e){switch(e){case"en":return"Status changes history for current shift";case"pl":return"Historia zmian statusów dla obecnej zmiany";default:return"workplaces-state-timelines-widget"}},exports.requiredFeatures=["feature.workplaces-state-timelines-widget"],exports.version=j;
|
|
2
|
-
|
|
1
|
+
import { registerTranslations } from "andoncloud-sdk";
|
|
2
|
+
import { Fragment, useCallback, useEffect, useState } from "react";
|
|
3
|
+
import { SortableSelect, WorkplaceEvent, WorkplaceEventDocument, getCurrentShift, normalizeShifts, useGqlClients } from "andoncloud-dashboard-toolkit";
|
|
4
|
+
import { BaseWidget } from "andoncloud-widget-base";
|
|
5
|
+
import dayjs from "dayjs";
|
|
6
|
+
import { print } from "graphql";
|
|
7
|
+
import { useTranslation } from "react-i18next";
|
|
8
|
+
import { TabContext, TabList, TabPanel } from "@mui/lab";
|
|
9
|
+
import { Box, Tab, TextField, Typography } from "@mui/material";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import isBetween from "dayjs/plugin/isBetween.js";
|
|
12
|
+
import ContentLoader from "react-content-loader";
|
|
13
|
+
import { styled } from "@mui/material/styles";
|
|
14
|
+
import * as yup from "yup";
|
|
15
|
+
import i18n from "i18next";
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/locales/index.ts
|
|
18
|
+
const resources = {
|
|
19
|
+
en: { translation: { workplacesStateTimelinesWidget: {
|
|
20
|
+
"advanced": "Advanced",
|
|
21
|
+
"cancel": "Cancel",
|
|
22
|
+
"customTitle": "Custom title",
|
|
23
|
+
"historyTimelineTimeInfoNow": "now",
|
|
24
|
+
"loading": "Loading",
|
|
25
|
+
"save": "Save",
|
|
26
|
+
"selectAndArrangeTheOrder": "Select and arrange the order",
|
|
27
|
+
"settings": "Settings",
|
|
28
|
+
"thisFieldIsRequired": "This field is required",
|
|
29
|
+
"displayName": "Status changes history for current shift",
|
|
30
|
+
"titleWorkplaces_one": "{{count}} workplace",
|
|
31
|
+
"titleWorkplaces_other": "{{count}} workplaces",
|
|
32
|
+
"workplaces": "Workplaces"
|
|
33
|
+
} } },
|
|
34
|
+
pl: { translation: { workplacesStateTimelinesWidget: {
|
|
35
|
+
"advanced": "Zaawansowane",
|
|
36
|
+
"cancel": "Anuluj",
|
|
37
|
+
"customTitle": "Własny tytuł",
|
|
38
|
+
"historyTimelineTimeInfoNow": "teraz",
|
|
39
|
+
"loading": "Wczytywanie",
|
|
40
|
+
"save": "Zapisz",
|
|
41
|
+
"selectAndArrangeTheOrder": "Wybierz i ustal kolejność",
|
|
42
|
+
"settings": "Ustawienia",
|
|
43
|
+
"thisFieldIsRequired": "To pole jest wymagane",
|
|
44
|
+
"displayName": "Historia zmian statusów dla obecnej zmiany",
|
|
45
|
+
"titleWorkplaces_one": "{{count}} stanowisko",
|
|
46
|
+
"titleWorkplaces_few": "{{count}} stanowiska",
|
|
47
|
+
"titleWorkplaces_many": "{{count}} stanowisk",
|
|
48
|
+
"workplaces": "Stanowiska"
|
|
49
|
+
} } }
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/version.ts
|
|
53
|
+
const LIBRARY_VERSION = "1.2.7";
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/components/SettingsFormContent/index.tsx
|
|
56
|
+
const SettingsFormContent = ({ data, formProps }) => {
|
|
57
|
+
const [selectedTab, setSelectedTab] = useState("workplaces");
|
|
58
|
+
const { t } = useTranslation();
|
|
59
|
+
return /* @__PURE__ */ jsxs(TabContext, {
|
|
60
|
+
value: selectedTab,
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ jsxs(TabList, {
|
|
63
|
+
onChange: (_, value) => setSelectedTab(value),
|
|
64
|
+
centered: true,
|
|
65
|
+
children: [/* @__PURE__ */ jsx(Tab, {
|
|
66
|
+
label: t("workplacesStateTimelinesWidget.workplaces"),
|
|
67
|
+
value: "workplaces"
|
|
68
|
+
}), /* @__PURE__ */ jsx(Tab, {
|
|
69
|
+
label: t("workplacesStateTimelinesWidget.advanced"),
|
|
70
|
+
value: "advanced"
|
|
71
|
+
})]
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ jsx(TabPanel, {
|
|
74
|
+
value: "workplaces",
|
|
75
|
+
children: /* @__PURE__ */ jsx(SortableSelect, {
|
|
76
|
+
placeholder: `${t("workplacesStateTimelinesWidget.selectAndArrangeTheOrder")}...`,
|
|
77
|
+
options: data.workplaces?.map(({ id, name }) => ({
|
|
78
|
+
label: name,
|
|
79
|
+
value: id
|
|
80
|
+
})),
|
|
81
|
+
selected: formProps.values.workplacesIds,
|
|
82
|
+
onChange: (selected) => formProps.setFieldValue("workplacesIds", [...selected])
|
|
83
|
+
})
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ jsx(TabPanel, {
|
|
86
|
+
value: "advanced",
|
|
87
|
+
children: /* @__PURE__ */ jsx(TextField, {
|
|
88
|
+
name: "customTitle",
|
|
89
|
+
label: t("workplacesStateTimelinesWidget.customTitle"),
|
|
90
|
+
value: formProps.values.customTitle,
|
|
91
|
+
onChange: formProps.handleChange,
|
|
92
|
+
fullWidth: true
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/helpers.ts
|
|
100
|
+
const durationSeconds = (shift, statusChange, currentDate) => {
|
|
101
|
+
const startedAt = shift.startedAt.isAfter(statusChange.startedAt) ? shift.startedAt : dayjs(statusChange.startedAt);
|
|
102
|
+
if (startedAt && statusChange.finishedAt) return Math.abs(startedAt.diff(dayjs(statusChange.finishedAt), "seconds"));
|
|
103
|
+
return Math.abs(dayjs(currentDate).diff(startedAt, "seconds"));
|
|
104
|
+
};
|
|
105
|
+
const mapTimelineColor = (color) => {
|
|
106
|
+
switch (color) {
|
|
107
|
+
case "green": return "#2ACB42";
|
|
108
|
+
case "red": return "#FF453A";
|
|
109
|
+
case "yellow": return "#FFC12F";
|
|
110
|
+
default: return "#525860";
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/components/TimelineLoader/index.tsx
|
|
115
|
+
const TimelineLoader = () => /* @__PURE__ */ jsx(ContentLoader, {
|
|
116
|
+
"data-testid": "timeline-loading",
|
|
117
|
+
height: "28",
|
|
118
|
+
width: "100%",
|
|
119
|
+
speed: 1.5,
|
|
120
|
+
backgroundColor: "#3d3d3d",
|
|
121
|
+
foregroundColor: "#ffffff",
|
|
122
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
123
|
+
x: "4%",
|
|
124
|
+
y: "10",
|
|
125
|
+
ry: "6",
|
|
126
|
+
width: "92%",
|
|
127
|
+
height: "14"
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/components/Timeline/styled.ts
|
|
132
|
+
const TimelineRow = styled("div")({
|
|
133
|
+
display: "flex",
|
|
134
|
+
flexGrow: 1,
|
|
135
|
+
alignItems: "center",
|
|
136
|
+
padding: "10px 0",
|
|
137
|
+
background: "#252A32",
|
|
138
|
+
"&:nth-of-type(2n)": { background: "#30353d" }
|
|
139
|
+
});
|
|
140
|
+
const TimelineWrapper = styled("div")({
|
|
141
|
+
display: "flex",
|
|
142
|
+
margin: "6px 0",
|
|
143
|
+
zIndex: 3,
|
|
144
|
+
flexDirection: "row",
|
|
145
|
+
height: "20px",
|
|
146
|
+
width: "100%",
|
|
147
|
+
overflow: "hidden",
|
|
148
|
+
borderRadius: "4px",
|
|
149
|
+
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
150
|
+
});
|
|
151
|
+
styled("div")({
|
|
152
|
+
display: "flex",
|
|
153
|
+
alignItems: "center",
|
|
154
|
+
justifyContent: "space-between"
|
|
155
|
+
});
|
|
156
|
+
const TimelineTimeInfo = styled("span")({
|
|
157
|
+
margin: "0 1.5em",
|
|
158
|
+
fontSize: "12px",
|
|
159
|
+
fontWeight: 500,
|
|
160
|
+
lineHeight: "12px",
|
|
161
|
+
color: "rgba(255, 255, 255, 0.5)"
|
|
162
|
+
});
|
|
163
|
+
const TimelineElement = styled("div")(({ percentWidth, color }) => ({
|
|
164
|
+
flexBasis: `${percentWidth}%`,
|
|
165
|
+
flexShrink: 0,
|
|
166
|
+
backgroundColor: mapTimelineColor(color),
|
|
167
|
+
"&:first-of-type": {
|
|
168
|
+
borderTopLeftRadius: "4px",
|
|
169
|
+
borderBottomLeftRadius: "4px"
|
|
170
|
+
}
|
|
171
|
+
}));
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/components/Timeline/index.tsx
|
|
174
|
+
dayjs.extend(isBetween);
|
|
175
|
+
const Timeline = ({ title, shift, statusChanges, loading }) => {
|
|
176
|
+
const [shiftStatusChanges, setShiftStatusChanges] = useState([]);
|
|
177
|
+
const calculateShiftDuration = useCallback(() => {
|
|
178
|
+
return shift ? Math.abs(shift.startedAt.diff(shift.finishedAt, "seconds")) : 0;
|
|
179
|
+
}, [shift]);
|
|
180
|
+
const isShiftStatusChange = useCallback((statusChange) => {
|
|
181
|
+
const startedAt = dayjs(statusChange.startedAt);
|
|
182
|
+
const finishedAt = statusChange.finishedAt ? dayjs(statusChange.finishedAt) : null;
|
|
183
|
+
if (shift) return startedAt.isBetween(shift.startedAt, shift.finishedAt) || finishedAt?.isBetween(shift.startedAt, shift.finishedAt) || startedAt.isBefore(shift.startedAt) && !finishedAt;
|
|
184
|
+
return false;
|
|
185
|
+
}, [shift]);
|
|
186
|
+
const [shiftDuration, setShiftDuration] = useState(() => calculateShiftDuration());
|
|
187
|
+
useEffect(() => {
|
|
188
|
+
setShiftDuration(calculateShiftDuration());
|
|
189
|
+
}, [shift, calculateShiftDuration]);
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
setShiftStatusChanges(statusChanges.filter((statusChange) => isShiftStatusChange(statusChange)));
|
|
192
|
+
}, [statusChanges, isShiftStatusChange]);
|
|
193
|
+
if (loading) return /* @__PURE__ */ jsx(TimelineLoader, {});
|
|
194
|
+
return /* @__PURE__ */ jsxs(TimelineRow, { children: [/* @__PURE__ */ jsx(Typography, {
|
|
195
|
+
sx: {
|
|
196
|
+
display: title ? "block" : "none",
|
|
197
|
+
flexBasis: "25%",
|
|
198
|
+
marginLeft: "20px",
|
|
199
|
+
whiteSpace: "nowrap",
|
|
200
|
+
overflow: "hidden",
|
|
201
|
+
textOverflow: "ellipsis",
|
|
202
|
+
color: "white"
|
|
203
|
+
},
|
|
204
|
+
children: title
|
|
205
|
+
}), shift && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
206
|
+
/* @__PURE__ */ jsx(TimelineTimeInfo, { children: shift.startedAt.format("HH:mm") }),
|
|
207
|
+
/* @__PURE__ */ jsx(TimelineWrapper, {
|
|
208
|
+
"data-testid": "timeline",
|
|
209
|
+
children: shiftStatusChanges?.map((status) => status.reason.statusColor && /* @__PURE__ */ jsx(TimelineElement, {
|
|
210
|
+
"data-testid": `timeline-element-${status.id}-color-${status.reason.statusColor}`,
|
|
211
|
+
color: status.reason.statusColor,
|
|
212
|
+
percentWidth: Math.min(durationSeconds(shift, status, /* @__PURE__ */ new Date()) / shiftDuration * 100, 100)
|
|
213
|
+
}, `${status.id}${status.author.id}`))
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ jsx(TimelineTimeInfo, { children: shift.finishedAt.format("HH:mm") })
|
|
216
|
+
] })] });
|
|
217
|
+
};
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/components/WidgetView/index.tsx
|
|
220
|
+
const WidgetView = ({ data, settings }) => {
|
|
221
|
+
const [currentShift, setCurrentShift] = useState(null);
|
|
222
|
+
const getTitle = (workplaceId) => {
|
|
223
|
+
const workplaces = data.workplaces;
|
|
224
|
+
return settings?.workplacesIds?.length === 1 ? "" : workplaces?.find((workplace) => workplace.id === workplaceId)?.name || "";
|
|
225
|
+
};
|
|
226
|
+
useEffect(() => {
|
|
227
|
+
const updateCurrentShift = () => {
|
|
228
|
+
const currentDate = dayjs();
|
|
229
|
+
setCurrentShift(getCurrentShift(currentDate, normalizeShifts(data?.shifts || [], currentDate)));
|
|
230
|
+
};
|
|
231
|
+
const intervalId = setInterval(() => updateCurrentShift(), 10 * 1e3);
|
|
232
|
+
updateCurrentShift();
|
|
233
|
+
return () => {
|
|
234
|
+
clearInterval(intervalId);
|
|
235
|
+
};
|
|
236
|
+
}, [data?.shifts]);
|
|
237
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
238
|
+
display: "flex",
|
|
239
|
+
flexDirection: "column",
|
|
240
|
+
height: "100%",
|
|
241
|
+
children: settings?.workplacesIds.map((workplaceId) => /* @__PURE__ */ jsx(Timeline, {
|
|
242
|
+
title: getTitle(workplaceId),
|
|
243
|
+
shift: currentShift,
|
|
244
|
+
statusChanges: data.statusChanges?.filter((statusChange) => statusChange.workplaceId === workplaceId) || [],
|
|
245
|
+
loading: data === void 0
|
|
246
|
+
}, workplaceId))
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/components/Widget/utils.ts
|
|
251
|
+
const getSettingsFormProps = (t) => {
|
|
252
|
+
yup.setLocale({ mixed: { required: t("workplacesStateTimelinesWidget.thisFieldIsRequired") } });
|
|
253
|
+
return {
|
|
254
|
+
initialValues: {
|
|
255
|
+
customTitle: "",
|
|
256
|
+
workplacesIds: []
|
|
257
|
+
},
|
|
258
|
+
validationSchema: yup.object({ workplacesIds: yup.array().of(yup.string()).required() })
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/components/Widget/index.tsx
|
|
263
|
+
const Widget = ({ url, wsUrl, lang, data, settings, ...widgetProps }) => {
|
|
264
|
+
const { graphqlSdk, gqlWsClient } = useGqlClients({
|
|
265
|
+
url,
|
|
266
|
+
wsUrl,
|
|
267
|
+
lang
|
|
268
|
+
});
|
|
269
|
+
const [widgetData, setWidgetData] = useState(data);
|
|
270
|
+
const [widgetSettings, setWidgetSettings] = useState(settings);
|
|
271
|
+
const sortStatusChagnges = (items) => {
|
|
272
|
+
return items.sort((item1, item2) => {
|
|
273
|
+
if (item1.finishedAt && item2.finishedAt) return dayjs(item1.finishedAt).diff(dayjs(item2.finishedAt));
|
|
274
|
+
return item1.finishedAt ? -1 : 1;
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
useEffect(() => {
|
|
278
|
+
if (!data && graphqlSdk) {
|
|
279
|
+
graphqlSdk.listShifts().then(({ shifts }) => {
|
|
280
|
+
return setWidgetData((current) => ({
|
|
281
|
+
...current || {},
|
|
282
|
+
shifts
|
|
283
|
+
}));
|
|
284
|
+
}).catch(() => {});
|
|
285
|
+
graphqlSdk.listWorkplaces().then(({ workplaces }) => {
|
|
286
|
+
return setWidgetData((current) => ({
|
|
287
|
+
...current || {},
|
|
288
|
+
workplaces
|
|
289
|
+
}));
|
|
290
|
+
}).catch(() => {});
|
|
291
|
+
graphqlSdk.listStatusChanges().then(({ statusChanges }) => {
|
|
292
|
+
return setWidgetData((current) => ({
|
|
293
|
+
...current || {},
|
|
294
|
+
statusChanges: sortStatusChagnges(statusChanges)
|
|
295
|
+
}));
|
|
296
|
+
}).catch(() => {});
|
|
297
|
+
}
|
|
298
|
+
if (widgetSettings?.workplacesIds && gqlWsClient) widgetSettings.workplacesIds.forEach((workplaceId) => {
|
|
299
|
+
gqlWsClient.subscribe(print(WorkplaceEventDocument), { id: workplaceId }, ({ event, subject }) => {
|
|
300
|
+
if (event === WorkplaceEvent.StatusChangeCreated) {
|
|
301
|
+
const statusChange = subject;
|
|
302
|
+
setWidgetData((current) => {
|
|
303
|
+
const workplaceStatusChanges = current?.statusChanges?.filter((statusChange) => statusChange.workplaceId === workplaceId);
|
|
304
|
+
const lastStatusChange = workplaceStatusChanges[workplaceStatusChanges.length - 1];
|
|
305
|
+
if (lastStatusChange) lastStatusChange.finishedAt = statusChange.startedAt;
|
|
306
|
+
return {
|
|
307
|
+
...current || {},
|
|
308
|
+
statusChanges: [...current.statusChanges, statusChange]
|
|
309
|
+
};
|
|
310
|
+
});
|
|
311
|
+
} else if (event === WorkplaceEvent.StatusChangeUpdated) {
|
|
312
|
+
const updatedStatusChange = subject;
|
|
313
|
+
setWidgetData((current) => {
|
|
314
|
+
const statusChanges = current.statusChanges.map((statusChange) => statusChange.id === updatedStatusChange.id ? updatedStatusChange : statusChange);
|
|
315
|
+
return {
|
|
316
|
+
...current || {},
|
|
317
|
+
statusChanges
|
|
318
|
+
};
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
}, [
|
|
324
|
+
data,
|
|
325
|
+
graphqlSdk,
|
|
326
|
+
gqlWsClient,
|
|
327
|
+
widgetSettings
|
|
328
|
+
]);
|
|
329
|
+
const handleSettingsChange = useCallback((settings) => {
|
|
330
|
+
setWidgetSettings({ ...settings });
|
|
331
|
+
}, [setWidgetSettings]);
|
|
332
|
+
return /* @__PURE__ */ jsx(BaseWidget, {
|
|
333
|
+
...widgetProps,
|
|
334
|
+
lang,
|
|
335
|
+
locales: resources,
|
|
336
|
+
data: widgetData,
|
|
337
|
+
settings,
|
|
338
|
+
gqlClients: {
|
|
339
|
+
graphqlSdk,
|
|
340
|
+
gqlWsClient
|
|
341
|
+
},
|
|
342
|
+
onSettingsChange: handleSettingsChange,
|
|
343
|
+
WidgetView,
|
|
344
|
+
getSettingsFormProps,
|
|
345
|
+
SettingsFormContent,
|
|
346
|
+
version: LIBRARY_VERSION,
|
|
347
|
+
"data-testid": "workplaces-state-timelines-widget"
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region src/core/title.ts
|
|
352
|
+
const ns = "workplacesStateTimelinesWidget";
|
|
353
|
+
const t = (key, lng, options) => i18n.t(`${ns}.${key}`, {
|
|
354
|
+
lng,
|
|
355
|
+
...options
|
|
356
|
+
});
|
|
357
|
+
const getDisplayName = (lang) => t("displayName", lang);
|
|
358
|
+
const getTitle = (data, _settings, _filters, lang) => {
|
|
359
|
+
const name = getDisplayName(lang);
|
|
360
|
+
const workplaces = data?.workplaces;
|
|
361
|
+
if (!workplaces?.length) return name;
|
|
362
|
+
return `${name} — ${t("titleWorkplaces", lang, { count: workplaces.length })}`;
|
|
363
|
+
};
|
|
364
|
+
//#endregion
|
|
365
|
+
//#region src/index.tsx
|
|
366
|
+
registerTranslations(resources);
|
|
367
|
+
const thumbnail = void 0;
|
|
368
|
+
const requiredFeatures = ["feature.workplaces-state-timelines-widget"];
|
|
369
|
+
const extraPermissions = [];
|
|
370
|
+
//#endregion
|
|
371
|
+
export { Widget, extraPermissions, getDisplayName, getTitle, requiredFeatures, thumbnail, LIBRARY_VERSION as version };
|
|
372
|
+
|
|
373
|
+
//# sourceMappingURL=index.js.map
|