wcz-layout 8.0.3 → 8.0.4

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.
Files changed (37) hide show
  1. package/dist/Approval-BSQHVGsm.js.map +1 -1
  2. package/dist/components.js +18 -18
  3. package/dist/components.js.map +1 -1
  4. package/dist/data/client.d.ts +1 -1
  5. package/dist/data/client.js +2 -2
  6. package/dist/data/client.js.map +1 -1
  7. package/dist/data/server.d.ts +1 -1
  8. package/dist/data/server.js +6 -4
  9. package/dist/data/server.js.map +1 -1
  10. package/dist/{env-szOeLEuD.js → env-Dgbk8SQN.js} +5 -5
  11. package/dist/env-Dgbk8SQN.js.map +1 -0
  12. package/dist/{file-DSohGVd1.js → file-BHdm6ob1.js} +6 -4
  13. package/dist/file-BHdm6ob1.js.map +1 -0
  14. package/dist/{file-B2VFf-iX.js → file-DNF9kxdN.js} +2 -2
  15. package/dist/{file-B2VFf-iX.js.map → file-DNF9kxdN.js.map} +1 -1
  16. package/dist/hooks.js +2 -2
  17. package/dist/index.js +12 -12
  18. package/dist/index.js.map +1 -1
  19. package/dist/middleware.js +2 -2
  20. package/dist/middleware.js.map +1 -1
  21. package/dist/models.d.ts +4 -4
  22. package/dist/{msalServer-DwpEEthz.js → msalServer-coQaBOlr.js} +2 -2
  23. package/dist/{msalServer-DwpEEthz.js.map → msalServer-coQaBOlr.js.map} +1 -1
  24. package/dist/{peoplesoft-CzeJCaYK.d.ts → peoplesoft-B9kmi9rI.d.ts} +5 -5
  25. package/dist/{peoplesoft-COFvPG-L.js → peoplesoft-CYSlmcwI.js} +9 -5
  26. package/dist/peoplesoft-CYSlmcwI.js.map +1 -0
  27. package/dist/{useDialogs-DBcNu-LV.js → useDialogs-BQEh6of8.js} +7 -7
  28. package/dist/useDialogs-BQEh6of8.js.map +1 -0
  29. package/dist/{utils-CBa4vtgn.js → utils-B7LPctqx.js} +2 -2
  30. package/dist/utils-B7LPctqx.js.map +1 -0
  31. package/dist/utils.js +2 -2
  32. package/package.json +1 -1
  33. package/dist/env-szOeLEuD.js.map +0 -1
  34. package/dist/file-DSohGVd1.js.map +0 -1
  35. package/dist/peoplesoft-COFvPG-L.js.map +0 -1
  36. package/dist/useDialogs-DBcNu-LV.js.map +0 -1
  37. package/dist/utils-CBa4vtgn.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["mutationOptions","queryOptions","z","queryClient","ApproveApprovalSchema","CancelApprovalSchema","CreateApprovalSchema","ResubmitApprovalSchema","WithdrawApprovalSchema","GetApprovalSchema","GetApprovalsSchema","approveApproval","cancelApproval","createApproval","getApproval","getApprovals","resubmitApproval","withdrawApproval","QUERY_KEY","approvalsQueryOptions","params","input","queryKey","queryFn","data","approvalQueryOptions","createApprovalMutationOptions","mutationFn","onSettled","invalidateQueries","exact","approveApprovalMutationOptions","resubmitApprovalMutationOptions","withdrawApprovalMutationOptions","cancelApprovalMutationOptions","queryOptions","z","CompanyCodeSchema","DepartmentIdSchema","EmployeeIdSchema","getActiveEmployees","getCompanyGeneralManager","getDepartmentById","getDepartmentEmployees","getDepartmentManager","getDepartments","getEmployeeByEmployeeId","getEmployeeGeneralManager","getEmployeeManager","getEmployees","getEmployeeSubordinates","getEmployeeSupervisor","getPreviousEmployeeIds","searchEmployees","SearchEmployeesSchema","QUERY_KEY","DAY","baseOptions","staleTime","gcTime","refetchOnWindowFocus","employeesSearchQueryOptions","params","infer","queryKey","queryFn","data","employeesQueryOptions","activeEmployeesQueryOptions","employeeByIdQueryOptions","previousEmployeeIdsQueryOptions","employeeSupervisorQueryOptions","employeeSubordinatesQueryOptions","employeeManagerQueryOptions","employeeGeneralManagerQueryOptions","departmentsQueryOptions","departmentByIdQueryOptions","departmentManagerQueryOptions","departmentEmployeesQueryOptions","companyGeneralManagerQueryOptions"],"sources":["../../src/queries/client/approval.ts","../../src/queries/client/peoplesoft.ts"],"sourcesContent":["import { mutationOptions, queryOptions } from \"@tanstack/react-query\";\r\nimport type { z } from \"zod\";\r\nimport { queryClient } from \"~/lib/queryClient\";\r\nimport {\r\n ApproveApprovalSchema,\r\n CancelApprovalSchema,\r\n CreateApprovalSchema,\r\n ResubmitApprovalSchema,\r\n WithdrawApprovalSchema,\r\n} from \"~/models/approval/Approval\";\r\nimport type { GetApprovalSchema, GetApprovalsSchema } from \"~/queries/server/approval\";\r\nimport {\r\n approveApproval,\r\n cancelApproval,\r\n createApproval,\r\n getApproval,\r\n getApprovals,\r\n resubmitApproval,\r\n withdrawApproval,\r\n} from \"~/queries/server/approval\";\r\n\r\nconst QUERY_KEY = \"approval\";\r\n\r\nexport const approvalsQueryOptions = (params: z.input<typeof GetApprovalsSchema>) =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, params],\r\n queryFn: () => getApprovals({ data: params }),\r\n });\r\n\r\nexport const approvalQueryOptions = (params: z.input<typeof GetApprovalSchema>) =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, params],\r\n queryFn: () => getApproval({ data: params }),\r\n });\r\n\r\nexport const createApprovalMutationOptions = () =>\r\n mutationOptions({\r\n mutationFn: (data: z.input<typeof CreateApprovalSchema>) => createApproval({ data }),\r\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\r\n });\r\n\r\nexport const approveApprovalMutationOptions = () =>\r\n mutationOptions({\r\n mutationFn: (data: z.input<typeof ApproveApprovalSchema>) => approveApproval({ data }),\r\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\r\n });\r\n\r\nexport const resubmitApprovalMutationOptions = () =>\r\n mutationOptions({\r\n mutationFn: (data: z.input<typeof ResubmitApprovalSchema>) => resubmitApproval({ data }),\r\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\r\n });\r\n\r\nexport const withdrawApprovalMutationOptions = () =>\r\n mutationOptions({\r\n mutationFn: (data: z.input<typeof WithdrawApprovalSchema>) => withdrawApproval({ data }),\r\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\r\n });\r\n\r\nexport const cancelApprovalMutationOptions = () =>\r\n mutationOptions({\r\n mutationFn: (data: z.input<typeof CancelApprovalSchema>) => cancelApproval({ data }),\r\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\r\n });\r\n","import { queryOptions } from \"@tanstack/react-query\";\r\nimport z from \"zod\";\r\nimport {\r\n CompanyCodeSchema,\r\n DepartmentIdSchema,\r\n EmployeeIdSchema,\r\n getActiveEmployees,\r\n getCompanyGeneralManager,\r\n getDepartmentById,\r\n getDepartmentEmployees,\r\n getDepartmentManager,\r\n getDepartments,\r\n getEmployeeByEmployeeId,\r\n getEmployeeGeneralManager,\r\n getEmployeeManager,\r\n getEmployees,\r\n getEmployeeSubordinates,\r\n getEmployeeSupervisor,\r\n getPreviousEmployeeIds,\r\n searchEmployees,\r\n SearchEmployeesSchema,\r\n} from \"~/queries/server/peoplesoft\";\r\n\r\nconst QUERY_KEY = \"ps\";\r\nconst DAY = 1000 * 60 * 60 * 24;\r\n\r\nconst baseOptions = {\r\n staleTime: DAY,\r\n gcTime: DAY,\r\n refetchOnWindowFocus: false,\r\n};\r\n\r\nexport const employeesSearchQueryOptions = (params: z.infer<typeof SearchEmployeesSchema>) =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"employee\", \"search\", params],\r\n queryFn: () => searchEmployees({ data: params }),\r\n ...baseOptions,\r\n });\r\n\r\nexport const employeesQueryOptions = () =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"employee\"],\r\n queryFn: () => getEmployees(),\r\n ...baseOptions,\r\n });\r\n\r\nexport const activeEmployeesQueryOptions = () =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"employee\", \"active\"],\r\n queryFn: () => getActiveEmployees(),\r\n ...baseOptions,\r\n });\r\n\r\nexport const employeeByIdQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"employee\", params],\r\n queryFn: () => getEmployeeByEmployeeId({ data: params }),\r\n ...baseOptions,\r\n });\r\n\r\nexport const previousEmployeeIdsQueryOptions = () =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"employee\", \"previousIds\"],\r\n queryFn: () => getPreviousEmployeeIds(),\r\n ...baseOptions,\r\n });\r\n\r\nexport const employeeSupervisorQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"employee\", \"supervisor\", params],\r\n queryFn: () => getEmployeeSupervisor({ data: params }),\r\n ...baseOptions,\r\n });\r\n\r\nexport const employeeSubordinatesQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"employee\", \"subordinates\", params],\r\n queryFn: () => getEmployeeSubordinates({ data: params }),\r\n ...baseOptions,\r\n });\r\n\r\nexport const employeeManagerQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"employee\", \"manager\", params],\r\n queryFn: () => getEmployeeManager({ data: params }),\r\n ...baseOptions,\r\n });\r\n\r\nexport const employeeGeneralManagerQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"employee\", \"generalManager\", params],\r\n queryFn: () => getEmployeeGeneralManager({ data: params }),\r\n ...baseOptions,\r\n });\r\n\r\nexport const departmentsQueryOptions = () =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"department\"],\r\n queryFn: () => getDepartments(),\r\n ...baseOptions,\r\n });\r\n\r\nexport const departmentByIdQueryOptions = (params: z.infer<typeof DepartmentIdSchema>) =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"department\", params],\r\n queryFn: () => getDepartmentById({ data: params }),\r\n ...baseOptions,\r\n });\r\n\r\nexport const departmentManagerQueryOptions = (params: z.infer<typeof DepartmentIdSchema>) =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"department\", \"manager\", params],\r\n queryFn: () => getDepartmentManager({ data: params }),\r\n ...baseOptions,\r\n });\r\n\r\nexport const departmentEmployeesQueryOptions = (params: z.infer<typeof DepartmentIdSchema>) =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"department\", \"employees\", params],\r\n queryFn: () => getDepartmentEmployees({ data: params }),\r\n ...baseOptions,\r\n });\r\n\r\nexport const companyGeneralManagerQueryOptions = (params: z.infer<typeof CompanyCodeSchema>) =>\r\n queryOptions({\r\n queryKey: [QUERY_KEY, \"company\", \"generalManager\", params],\r\n queryFn: () => getCompanyGeneralManager({ data: params }),\r\n ...baseOptions,\r\n });\r\n"],"mappings":";;;;;AAqBA,MAAMkB,cAAY;AAElB,MAAaC,yBAAyBC,WACpCnB,aAAa;CACXqB,UAAU,CAACJ,aAAWE,OAAO;CAC7BG,eAAeR,aAAa,EAAES,MAAMJ,QAAQ,CAAA;CAC7C,CAAC;AAEJ,MAAaK,wBAAwBL,WACnCnB,aAAa;CACXqB,UAAU,CAACJ,aAAWE,OAAO;CAC7BG,eAAeT,YAAY,EAAEU,MAAMJ,QAAQ,CAAA;CAC5C,CAAC;AAEJ,MAAaM,sCACX1B,gBAAgB;CACd2B,aAAaH,SAA+CX,eAAe,EAAEW,MAAM,CAAC;CACpFI,iBAAiBzB,YAAY0B,kBAAkB;EAAEP,UAAU,CAACJ,YAAU;EAAEY,OAAO;EAAO,CAAA;CACvF,CAAC;AAEJ,MAAaC,uCACX/B,gBAAgB;CACd2B,aAAaH,SAAgDb,gBAAgB,EAAEa,MAAM,CAAC;CACtFI,iBAAiBzB,YAAY0B,kBAAkB;EAAEP,UAAU,CAACJ,YAAU;EAAEY,OAAO;EAAO,CAAA;CACvF,CAAC;AAEJ,MAAaE,wCACXhC,gBAAgB;CACd2B,aAAaH,SAAiDR,iBAAiB,EAAEQ,MAAM,CAAC;CACxFI,iBAAiBzB,YAAY0B,kBAAkB;EAAEP,UAAU,CAACJ,YAAU;EAAE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X6B,UAAU;EAACT;EAAW;EAAW;EAAkBO;EAAO;CAC1DG,eAAexB,yBAAyB,EAAEyB,MAAMJ,QAAQ,CAAC;CACzD,GAAGL;CACJ,CAAC"}
1
+ {"version":3,"file":"client.js","names":["mutationOptions","queryOptions","z","queryClient","ApproveApprovalSchema","CancelApprovalSchema","CreateApprovalSchema","ResubmitApprovalSchema","WithdrawApprovalSchema","GetApprovalSchema","GetApprovalsSchema","approveApproval","cancelApproval","createApproval","getApproval","getApprovals","resubmitApproval","withdrawApproval","QUERY_KEY","approvalsQueryOptions","params","input","queryKey","queryFn","data","approvalQueryOptions","createApprovalMutationOptions","mutationFn","onSettled","invalidateQueries","exact","approveApprovalMutationOptions","resubmitApprovalMutationOptions","withdrawApprovalMutationOptions","cancelApprovalMutationOptions","queryOptions","z","CompanyCodeSchema","DepartmentIdSchema","EmployeeIdSchema","getActiveEmployees","getCompanyGeneralManager","getDepartmentById","getDepartmentEmployees","getDepartmentManager","getDepartments","getEmployeeByEmployeeId","getEmployeeGeneralManager","getEmployeeManager","getEmployees","getEmployeeSubordinates","getEmployeeSupervisor","getPreviousEmployeeIds","searchEmployees","SearchEmployeesSchema","QUERY_KEY","DAY","baseOptions","staleTime","gcTime","refetchOnWindowFocus","employeesSearchQueryOptions","params","infer","queryKey","queryFn","data","employeesQueryOptions","activeEmployeesQueryOptions","employeeByIdQueryOptions","previousEmployeeIdsQueryOptions","employeeSupervisorQueryOptions","employeeSubordinatesQueryOptions","employeeManagerQueryOptions","employeeGeneralManagerQueryOptions","departmentsQueryOptions","departmentByIdQueryOptions","departmentManagerQueryOptions","departmentEmployeesQueryOptions","companyGeneralManagerQueryOptions"],"sources":["../../src/queries/client/approval.ts","../../src/queries/client/peoplesoft.ts"],"sourcesContent":["import { mutationOptions, queryOptions } from \"@tanstack/react-query\";\nimport type { z } from \"zod\";\nimport { queryClient } from \"~/lib/queryClient\";\nimport {\n ApproveApprovalSchema,\n CancelApprovalSchema,\n CreateApprovalSchema,\n ResubmitApprovalSchema,\n WithdrawApprovalSchema,\n} from \"~/models/approval/Approval\";\nimport type { GetApprovalSchema, GetApprovalsSchema } from \"~/queries/server/approval\";\nimport {\n approveApproval,\n cancelApproval,\n createApproval,\n getApproval,\n getApprovals,\n resubmitApproval,\n withdrawApproval,\n} from \"~/queries/server/approval\";\n\nconst QUERY_KEY = \"approval\";\n\nexport const approvalsQueryOptions = (params: z.input<typeof GetApprovalsSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, params],\n queryFn: () => getApprovals({ data: params }),\n });\n\nexport const approvalQueryOptions = (params: z.input<typeof GetApprovalSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, params],\n queryFn: () => getApproval({ data: params }),\n });\n\nexport const createApprovalMutationOptions = () =>\n mutationOptions({\n mutationFn: (data: z.input<typeof CreateApprovalSchema>) => createApproval({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\n });\n\nexport const approveApprovalMutationOptions = () =>\n mutationOptions({\n mutationFn: (data: z.input<typeof ApproveApprovalSchema>) => approveApproval({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\n });\n\nexport const resubmitApprovalMutationOptions = () =>\n mutationOptions({\n mutationFn: (data: z.input<typeof ResubmitApprovalSchema>) => resubmitApproval({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\n });\n\nexport const withdrawApprovalMutationOptions = () =>\n mutationOptions({\n mutationFn: (data: z.input<typeof WithdrawApprovalSchema>) => withdrawApproval({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\n });\n\nexport const cancelApprovalMutationOptions = () =>\n mutationOptions({\n mutationFn: (data: z.input<typeof CancelApprovalSchema>) => cancelApproval({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY], exact: false }),\n });\n","import { queryOptions } from \"@tanstack/react-query\";\nimport z from \"zod\";\nimport {\n CompanyCodeSchema,\n DepartmentIdSchema,\n EmployeeIdSchema,\n getActiveEmployees,\n getCompanyGeneralManager,\n getDepartmentById,\n getDepartmentEmployees,\n getDepartmentManager,\n getDepartments,\n getEmployeeByEmployeeId,\n getEmployeeGeneralManager,\n getEmployeeManager,\n getEmployees,\n getEmployeeSubordinates,\n getEmployeeSupervisor,\n getPreviousEmployeeIds,\n searchEmployees,\n SearchEmployeesSchema,\n} from \"~/queries/server/peoplesoft\";\n\nconst QUERY_KEY = \"ps\";\nconst DAY = 1000 * 60 * 60 * 24;\n\nconst baseOptions = {\n staleTime: DAY,\n gcTime: DAY,\n refetchOnWindowFocus: false,\n};\n\nexport const employeesSearchQueryOptions = (params: z.infer<typeof SearchEmployeesSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"employee\", \"search\", params],\n queryFn: () => searchEmployees({ data: params }),\n ...baseOptions,\n });\n\nexport const employeesQueryOptions = () =>\n queryOptions({\n queryKey: [QUERY_KEY, \"employee\"],\n queryFn: () => getEmployees(),\n ...baseOptions,\n });\n\nexport const activeEmployeesQueryOptions = () =>\n queryOptions({\n queryKey: [QUERY_KEY, \"employee\", \"active\"],\n queryFn: () => getActiveEmployees(),\n ...baseOptions,\n });\n\nexport const employeeByIdQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"employee\", params],\n queryFn: () => getEmployeeByEmployeeId({ data: params }),\n ...baseOptions,\n });\n\nexport const previousEmployeeIdsQueryOptions = () =>\n queryOptions({\n queryKey: [QUERY_KEY, \"employee\", \"previousIds\"],\n queryFn: () => getPreviousEmployeeIds(),\n ...baseOptions,\n });\n\nexport const employeeSupervisorQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"employee\", \"supervisor\", params],\n queryFn: () => getEmployeeSupervisor({ data: params }),\n ...baseOptions,\n });\n\nexport const employeeSubordinatesQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"employee\", \"subordinates\", params],\n queryFn: () => getEmployeeSubordinates({ data: params }),\n ...baseOptions,\n });\n\nexport const employeeManagerQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"employee\", \"manager\", params],\n queryFn: () => getEmployeeManager({ data: params }),\n ...baseOptions,\n });\n\nexport const employeeGeneralManagerQueryOptions = (params: z.infer<typeof EmployeeIdSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"employee\", \"generalManager\", params],\n queryFn: () => getEmployeeGeneralManager({ data: params }),\n ...baseOptions,\n });\n\nexport const departmentsQueryOptions = () =>\n queryOptions({\n queryKey: [QUERY_KEY, \"department\"],\n queryFn: () => getDepartments(),\n ...baseOptions,\n });\n\nexport const departmentByIdQueryOptions = (params: z.infer<typeof DepartmentIdSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"department\", params],\n queryFn: () => getDepartmentById({ data: params }),\n ...baseOptions,\n });\n\nexport const departmentManagerQueryOptions = (params: z.infer<typeof DepartmentIdSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"department\", \"manager\", params],\n queryFn: () => getDepartmentManager({ data: params }),\n ...baseOptions,\n });\n\nexport const departmentEmployeesQueryOptions = (params: z.infer<typeof DepartmentIdSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"department\", \"employees\", params],\n queryFn: () => getDepartmentEmployees({ data: params }),\n ...baseOptions,\n });\n\nexport const companyGeneralManagerQueryOptions = (params: z.infer<typeof CompanyCodeSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"company\", \"generalManager\", params],\n queryFn: () => getCompanyGeneralManager({ data: params }),\n ...baseOptions,\n });\n"],"mappings":";;;;;AAqBA,MAAMkB,cAAY;AAElB,MAAaC,yBAAyBC,WACpCnB,aAAa;CACXqB,UAAU,CAACJ,aAAWE,OAAO;CAC7BG,eAAeR,aAAa,EAAES,M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,QAAQ,CAAC;CAC1D,GAAGL;CACJ,CAAC;AAEJ,MAAakB,gCACXxC,aAAa;CACX6B,UAAU,CAACT,WAAW,aAAa;CACnCU,eAAepB,gBAAgB;CAC/B,GAAGY;CACJ,CAAC;AAEJ,MAAamB,8BAA8Bd,WACzC3B,aAAa;CACX6B,UAAU;EAACT;EAAW;EAAcO;EAAO;CAC3CG,eAAevB,kBAAkB,EAAEwB,MAAMJ,QAAQ,CAAC;CAClD,GAAGL;CACJ,CAAC;AAEJ,MAAaoB,iCAAiCf,WAC5C3B,aAAa;CACX6B,UAAU;EAACT;EAAW;EAAc;EAAWO;EAAO;CACtDG,eAAerB,qBAAqB,EAAEsB,MAAMJ,QAAQ,CAAC;CACrD,GAAGL;CACJ,CAAC;AAEJ,MAAaqB,mCAAmChB,WAC9C3B,aAAa;CACX6B,UAAU;EAACT;EAAW;EAAc;EAAaO;EAAO;CACxDG,eAAetB,uBAAuB,EAAEuB,MAAMJ,QAAQ,CAAC;CACvD,GAAGL;CACJ,CAAC;AAEJ,MAAasB,qCAAqCjB,WAChD3B,aAAa;CACX6B,UAAU;EAACT;EAAW;EAAW;EAAkBO;EAAO;CAC1DG,eAAexB,yBAAyB,EAAEyB,MAAMJ,QAAQ,CAAC;CACzD,GAAGL;CACJ,CAAC"}
@@ -1,4 +1,4 @@
1
- import { A as UpdateFileMetaSchema, B as uploadFile, C as createApproval, D as withdrawApproval, E as resubmitApproval, F as downloadFile, I as getFile, L as getFileMetas, M as UploadFileResult, N as batchDeleteFiles, O as FileSchema, P as deleteFile, R as getFileThumbnail, S as cancelApproval, T as getApprovals, _ as getPreviousEmployeeIds, a as getActiveEmployees, b as GetApprovalsSchema, c as getDepartmentEmployees, d as getEmployeeByEmployeeId, f as getEmployeeGeneralManager, g as getEmployees, h as getEmployeeSupervisor, i as SearchEmployeesSchema, j as UploadFileMetaSchema, k as GetFileMetasSchema, l as getDepartmentManager, m as getEmployeeSubordinates, n as DepartmentIdSchema, o as getCompanyGeneralManager, p as getEmployeeManager, r as EmployeeIdSchema, s as getDepartmentById, t as CompanyCodeSchema, u as getDepartments, v as searchEmployees, w as getApproval, x as approveApproval, y as GetApprovalSchema, z as updateFileMeta } from "../peoplesoft-CzeJCaYK.js";
1
+ import { A as UpdateFileMetaSchema, B as uploadFile, C as createApproval, D as withdrawApproval, E as resubmitApproval, F as downloadFile, I as getFile, L as getFileMetas, M as UploadFileResult, N as batchDeleteFiles, O as FileSchema, P as deleteFile, R as getFileThumbnail, S as cancelApproval, T as getApprovals, _ as getPreviousEmployeeIds, a as getActiveEmployees, b as GetApprovalsSchema, c as getDepartmentEmployees, d as getEmployeeByEmployeeId, f as getEmployeeGeneralManager, g as getEmployees, h as getEmployeeSupervisor, i as SearchEmployeesSchema, j as UploadFileMetaSchema, k as GetFileMetasSchema, l as getDepartmentManager, m as getEmployeeSubordinates, n as DepartmentIdSchema, o as getCompanyGeneralManager, p as getEmployeeManager, r as EmployeeIdSchema, s as getDepartmentById, t as CompanyCodeSchema, u as getDepartments, v as searchEmployees, w as getApproval, x as approveApproval, y as GetApprovalSchema, z as updateFileMeta } from "../peoplesoft-B9kmi9rI.js";
2
2
  import * as _$zod from "zod";
3
3
  import * as _$_tanstack_start_client_core0 from "@tanstack/start-client-core";
4
4
  import * as _$zod_v4_core0 from "zod/v4/core";
@@ -1,12 +1,14 @@
1
- import { n as serverEnv } from "../env-szOeLEuD.js";
2
- import { a as batchDeleteFiles, c as getFile, d as updateFileMeta, f as uploadFile, i as UploadFileMetaSchema, l as getFileMetas, n as GetFileMetasSchema, o as deleteFile, p as createExternalApi, r as UpdateFileMetaSchema, s as downloadFile, t as FileSchema, u as getFileThumbnail } from "../file-DSohGVd1.js";
1
+ import { n as serverEnv } from "../env-Dgbk8SQN.js";
2
+ import { a as batchDeleteFiles, c as getFile, d as updateFileMeta, f as uploadFile, i as UploadFileMetaSchema, l as getFileMetas, n as GetFileMetasSchema, o as deleteFile, p as createExternalApi, r as UpdateFileMetaSchema, s as downloadFile, t as FileSchema, u as getFileThumbnail } from "../file-BHdm6ob1.js";
3
3
  import { t as EmailSchema } from "../Email-D2SPExbn.js";
4
- import { C as createApproval, D as withdrawApproval, E as resubmitApproval, S as cancelApproval, T as getApprovals, _ as getPreviousEmployeeIds, a as getActiveEmployees, b as GetApprovalsSchema, c as getDepartmentEmployees, d as getEmployeeByEmployeeId, f as getEmployeeGeneralManager, g as getEmployees, h as getEmployeeSupervisor, i as SearchEmployeesSchema, l as getDepartmentManager, m as getEmployeeSubordinates, n as DepartmentIdSchema, o as getCompanyGeneralManager, p as getEmployeeManager, r as EmployeeIdSchema, s as getDepartmentById, t as CompanyCodeSchema, u as getDepartments, v as searchEmployees, w as getApproval, x as approveApproval, y as GetApprovalSchema } from "../peoplesoft-COFvPG-L.js";
4
+ import { C as createApproval, D as withdrawApproval, E as resubmitApproval, S as cancelApproval, T as getApprovals, _ as getPreviousEmployeeIds, a as getActiveEmployees, b as GetApprovalsSchema, c as getDepartmentEmployees, d as getEmployeeByEmployeeId, f as getEmployeeGeneralManager, g as getEmployees, h as getEmployeeSupervisor, i as SearchEmployeesSchema, l as getDepartmentManager, m as getEmployeeSubordinates, n as DepartmentIdSchema, o as getCompanyGeneralManager, p as getEmployeeManager, r as EmployeeIdSchema, s as getDepartmentById, t as CompanyCodeSchema, u as getDepartments, v as searchEmployees, w as getApproval, x as approveApproval, y as GetApprovalSchema } from "../peoplesoft-CYSlmcwI.js";
5
5
  import { createServerFn, createServerOnlyFn } from "@tanstack/react-start";
6
6
  //#region src/queries/server/email.ts
7
7
  let emailApi = null;
8
8
  const getEmailApi = createServerOnlyFn(() => {
9
- emailApi ??= createExternalApi(serverEnv.EMAIL_BASE_URL, "email");
9
+ const baseUrl = serverEnv.EMAIL_BASE_URL;
10
+ if (!baseUrl) throw new Error("EMAIL_BASE_URL is not defined in server environment variables.");
11
+ emailApi ??= createExternalApi(baseUrl, "email");
10
12
  return emailApi;
11
13
  });
12
14
  const sendEmail = createServerFn({ method: "POST" }).inputValidator(EmailSchema).handler(async ({ data }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","names":["createServerFn","createServerOnlyFn","AxiosInstance","serverEnv","EmailSchema","createExternalApi","emailApi","getEmailApi","EMAIL_BASE_URL","sendEmail","method","inputValidator","handler","data","api","request","url"],"sources":["../../src/queries/server/email.ts"],"sourcesContent":["import { createServerFn, createServerOnlyFn } from \"@tanstack/react-start\";\r\nimport type { AxiosInstance } from \"axios\";\r\nimport { serverEnv } from \"~/env\";\r\nimport { EmailSchema } from \"~/models/email/Email\";\r\nimport { createExternalApi } from \"~/queries/server/externalApi\";\r\n\r\nlet emailApi: AxiosInstance | null = null;\r\nconst getEmailApi = createServerOnlyFn((): AxiosInstance => {\r\n emailApi ??= createExternalApi(serverEnv.EMAIL_BASE_URL, \"email\");\r\n return emailApi;\r\n});\r\n\r\nexport const sendEmail = createServerFn({ method: \"POST\" })\r\n .inputValidator(EmailSchema)\r\n .handler(async ({ data }) => {\r\n const api = getEmailApi();\r\n await api.request<void>({\r\n url: \"/\",\r\n method: \"POST\",\r\n data,\r\n });\r\n });\r\n"],"mappings":";;;;;;AAMA,IAAIM,WAAiC;AACrC,MAAMC,cAAcN,yBAAwC;AAC1DK,cAAaD,kBAAkBF,UAAUK,gBAAgB,QAAQ;AACjE,QAAOF;EACP;AAEF,MAAaG,YAAYT,eAAe,EAAEU,QAAQ,QAAQ,CAAC,CACxDC,eAAeP,YAAY,CAC3BQ,QAAQ,OAAO,EAAEC,WAAW;AAE3B,OADYN,aACH,CAACQ,QAAc;EACtBC,KAAK;EACLN,QAAQ;EACRG;EACD,CAAC;EACF"}
1
+ {"version":3,"file":"server.js","names":["createServerFn","createServerOnlyFn","AxiosInstance","serverEnv","EmailSchema","createExternalApi","emailApi","getEmailApi","baseUrl","EMAIL_BASE_URL","Error","sendEmail","method","inputValidator","handler","data","api","request","url"],"sources":["../../src/queries/server/email.ts"],"sourcesContent":["import { createServerFn, createServerOnlyFn } from \"@tanstack/react-start\";\nimport type { AxiosInstance } from \"axios\";\nimport { serverEnv } from \"~/env\";\nimport { EmailSchema } from \"~/models/email/Email\";\nimport { createExternalApi } from \"~/queries/server/externalApi\";\n\nlet emailApi: AxiosInstance | null = null;\nconst getEmailApi = createServerOnlyFn((): AxiosInstance => {\n const baseUrl = serverEnv.EMAIL_BASE_URL;\n if (!baseUrl) throw new Error(\"EMAIL_BASE_URL is not defined in server environment variables.\");\n emailApi ??= createExternalApi(baseUrl, \"email\");\n return emailApi;\n});\n\nexport const sendEmail = createServerFn({ method: \"POST\" })\n .inputValidator(EmailSchema)\n .handler(async ({ data }) => {\n const api = getEmailApi();\n await api.request<void>({\n url: \"/\",\n method: \"POST\",\n data,\n });\n });\n"],"mappings":";;;;;;AAMA,IAAIM,WAAiC;AACrC,MAAMC,cAAcN,yBAAwC;CAC1D,MAAMO,UAAUL,UAAUM;AAC1B,KAAI,CAACD,QAAS,OAAM,IAAIE,MAAM,iEAAiE;AAC/FJ,cAAaD,kBAAkBG,SAAS,QAAQ;AAChD,QAAOF;EACP;AAEF,MAAaK,YAAYX,eAAe,EAAEY,QAAQ,QAAQ,CAAC,CACxDC,eAAeT,YAAY,CAC3BU,QAAQ,OAAO,EAAEC,WAAW;AAE3B,OADYR,aACH,CAACU,QAAc;EACtBC,KAAK;EACLN,QAAQ;EACRG;EACD,CAAC;EACF"}
@@ -17,10 +17,10 @@ const serverEnv = createEnv({
17
17
  ENTRA_CLIENT_ID: z.string(),
18
18
  ENTRA_TENANT_ID: z.string(),
19
19
  ENTRA_CLIENT_SECRET: z.string(),
20
- FILE_BASE_URL: z.string().min(1),
21
- APPROVAL_BASE_URL: z.string().min(1),
22
- PS_BASE_URL: z.string().min(1),
23
- EMAIL_BASE_URL: z.string().min(1)
20
+ FILE_BASE_URL: z.string().min(1).optional(),
21
+ APPROVAL_BASE_URL: z.string().min(1).optional(),
22
+ PS_BASE_URL: z.string().min(1).optional(),
23
+ EMAIL_BASE_URL: z.string().min(1).optional()
24
24
  },
25
25
  runtimeEnv: process.env,
26
26
  emptyStringAsUndefined: true
@@ -28,4 +28,4 @@ const serverEnv = createEnv({
28
28
  //#endregion
29
29
  export { serverEnv as n, clientEnv as t };
30
30
 
31
- //# sourceMappingURL=env-szOeLEuD.js.map
31
+ //# sourceMappingURL=env-Dgbk8SQN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-Dgbk8SQN.js","names":["createEnv","z","clientEnv","clientPrefix","client","VITE_ENTRA_CLIENT_ID","string","VITE_ENTRA_TENANT_ID","VITE_APP_TITLE","VITE_MUI_LICENSE_KEY","runtimeEnv","import","meta","env","emptyStringAsUndefined","serverEnv","server","ENTRA_CLIENT_ID","ENTRA_TENANT_ID","ENTRA_CLIENT_SECRET","FILE_BASE_URL","min","optional","APPROVAL_BASE_URL","PS_BASE_URL","EMAIL_BASE_URL","process"],"sources":["../src/env.ts"],"sourcesContent":["import { createEnv } from \"@t3-oss/env-core\";\nimport { z } from \"zod\";\n\nexport const clientEnv = createEnv({\n clientPrefix: \"VITE_\",\n client: {\n VITE_ENTRA_CLIENT_ID: z.string(),\n VITE_ENTRA_TENANT_ID: z.string(),\n VITE_APP_TITLE: z.string(),\n VITE_MUI_LICENSE_KEY: z.string(),\n },\n runtimeEnv: import.meta.env,\n emptyStringAsUndefined: true,\n});\n\nexport const serverEnv = createEnv({\n server: {\n ENTRA_CLIENT_ID: z.string(),\n ENTRA_TENANT_ID: z.string(),\n ENTRA_CLIENT_SECRET: z.string(),\n FILE_BASE_URL: z.string().min(1).optional(),\n APPROVAL_BASE_URL: z.string().min(1).optional(),\n PS_BASE_URL: z.string().min(1).optional(),\n EMAIL_BASE_URL: z.string().min(1).optional(),\n },\n runtimeEnv: process.env,\n emptyStringAsUndefined: true,\n});\n"],"mappings":";;;AAGA,MAAaE,YAAYF,UAAU;CACjCG,cAAc;CACdC,QAAQ;EACNC,sBAAsBJ,EAAEK,QAAQ;EAChCC,sBAAsBN,EAAEK,QAAQ;EAChCE,gBAAgBP,EAAEK,QAAQ;EAC1BG,sBAAsBR,EAAEK,QAAO;EAChC;CACDI,YAAYC,OAAOC,KAAKC;CACxBC,wBAAwB;CACzB,CAAC;AAEF,MAAaC,YAAYf,UAAU;CACjCgB,QAAQ;EACNC,iBAAiBhB,EAAEK,QAAQ;EAC3BY,iBAAiBjB,EAAEK,QAAQ;EAC3Ba,qBAAqBlB,EAAEK,QAAQ;EAC/Bc,eAAenB,EAAEK,QAAQ,CAACe,IAAI,EAAE,CAACC,UAAU;EAC3CC,mBAAmBtB,EAAEK,QAAQ,CAACe,IAAI,EAAE,CAACC,UAAU;EAC/CE,aAAavB,EAAEK,QAAQ,CAACe,IAAI,EAAE,CAACC,UAAU;EACzCG,gBAAgBxB,EAAEK,QAAQ,CAACe,IAAI,EAAE,CAACC,UAAS;EAC5C;CACDZ,YAAYgB,QAAQb;CACpBC,wBAAwB;CACzB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { n as serverEnv } from "./env-szOeLEuD.js";
2
- import { t as getAppToken } from "./msalServer-DwpEEthz.js";
1
+ import { n as serverEnv } from "./env-Dgbk8SQN.js";
2
+ import { t as getAppToken } from "./msalServer-coQaBOlr.js";
3
3
  import { t as FileMetaSchema } from "./FileMeta--27aYkPB.js";
4
4
  import { z } from "zod";
5
5
  import { createServerFn, createServerOnlyFn } from "@tanstack/react-start";
@@ -20,7 +20,9 @@ function createExternalApi(baseURL, scopeKey) {
20
20
  //#region src/queries/server/file.ts
21
21
  let fileApi = null;
22
22
  const getFileApi = createServerOnlyFn(() => {
23
- fileApi ??= createExternalApi(serverEnv.FILE_BASE_URL, "file");
23
+ const baseUrl = serverEnv.FILE_BASE_URL;
24
+ if (!baseUrl) throw new Error("FILE_BASE_URL is not defined in server environment variables.");
25
+ fileApi ??= createExternalApi(baseUrl, "file");
24
26
  return fileApi;
25
27
  });
26
28
  const GetFileMetasSchema = z.object({
@@ -146,4 +148,4 @@ const uploadFile = createServerFn({ method: "POST" }).inputValidator(UploadFileM
146
148
  //#endregion
147
149
  export { batchDeleteFiles as a, getFile as c, updateFileMeta as d, uploadFile as f, UploadFileMetaSchema as i, getFileMetas as l, GetFileMetasSchema as n, deleteFile as o, createExternalApi as p, UpdateFileMetaSchema as r, downloadFile as s, FileSchema as t, getFileThumbnail as u };
148
150
 
149
- //# sourceMappingURL=file-DSohGVd1.js.map
151
+ //# sourceMappingURL=file-BHdm6ob1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-BHdm6ob1.js","names":["AxiosInstance","axios","scopes","definedScopes","getAppToken","ScopeKey","createExternalApi","baseURL","scopeKey","api","create","interceptors","request","use","config","accessToken","headers","set","createServerFn","createServerOnlyFn","AxiosInstance","Upload","uuidv7","z","serverEnv","getAppToken","FileMeta","FileMetaSchema","createExternalApi","fileApi","getFileApi","baseUrl","FILE_BASE_URL","Error","GetFileMetasSchema","object","appName","string","min","max","subId","uuid","FileSchema","id","UpdateFileMetaSchema","extend","fileName","DeleteFileSchema","BatchDeleteFilesSchema","UploadFileResult","UploadFileMetaSchema","file","instanceof","File","getFileMetas","method","inputValidator","handler","data","api","queryParams","URLSearchParams","append","request","Array","url","toString","then","r","getFileThumbnail","response","ArrayBuffer","responseType","Response","headers","getFile","downloadFile","updateFileMeta","deleteFile","batchDeleteFiles","uploadFile","Promise","accessToken","buffer","Buffer","from","arrayBuffer","resolve","reject","upload","endpoint","chunkSize","metadata","name","fileExtension","type","Authorization","onError","onSuccess","start"],"sources":["../src/queries/server/externalApi.ts","../src/queries/server/file.ts"],"sourcesContent":["import type { AxiosInstance } from \"axios\";\nimport axios from \"axios\";\nimport type { scopes as definedScopes } from \"virtual:wcz-layout\";\nimport { getAppToken } from \"~/lib/auth/msalServer\";\n\ntype ScopeKey = keyof typeof definedScopes;\n\nexport function createExternalApi(baseURL: string, scopeKey: ScopeKey): AxiosInstance {\n const api = axios.create({ baseURL });\n\n api.interceptors.request.use(async (config) => {\n const accessToken = await getAppToken(scopeKey);\n config.headers.set(\"Authorization\", `Bearer ${accessToken}`);\n return config;\n });\n\n return api;\n}\n","import { createServerFn, createServerOnlyFn } from \"@tanstack/react-start\";\nimport type { AxiosInstance } from \"axios\";\nimport { Upload } from \"tus-js-client\";\nimport { uuidv7 } from \"uuidv7\";\nimport { z } from \"zod\";\nimport { serverEnv } from \"~/env\";\nimport { getAppToken } from \"~/lib/auth/msalServer\";\nimport type { FileMeta } from \"~/models/file/FileMeta\";\nimport { FileMetaSchema } from \"~/models/file/FileMeta\";\nimport { createExternalApi } from \"~/queries/server/externalApi\";\n\nlet fileApi: AxiosInstance | null = null;\nconst getFileApi = createServerOnlyFn((): AxiosInstance => {\n const baseUrl = serverEnv.FILE_BASE_URL;\n if (!baseUrl) throw new Error(\"FILE_BASE_URL is not defined in server environment variables.\");\n fileApi ??= createExternalApi(baseUrl, \"file\");\n return fileApi;\n});\n\nexport const GetFileMetasSchema = z.object({\n appName: z.string().min(1).max(255),\n subId: z.uuid(),\n});\n\nexport const FileSchema = z.object({\n appName: z.string().min(1).max(255),\n id: z.uuid(),\n});\n\nexport const UpdateFileMetaSchema = FileMetaSchema.extend({\n fileName: z.string().min(1).max(255),\n});\n\nconst DeleteFileSchema = FileSchema;\n\nconst BatchDeleteFilesSchema = GetFileMetasSchema;\n\nexport interface UploadFileResult {\n id: string;\n appName: string;\n subId: string;\n fileName: string;\n}\n\nexport const UploadFileMetaSchema = z.object({\n appName: z.string().min(1).max(255),\n subId: z.uuid(),\n file: z.instanceof(File),\n});\n\nexport const getFileMetas = createServerFn({ method: \"GET\" })\n .inputValidator(GetFileMetasSchema)\n .handler(async ({ data }) => {\n const api = getFileApi();\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", data.appName);\n queryParams.append(\"subId\", data.subId);\n\n return api\n .request<Array<FileMeta>>({\n url: `/v1/meta?${queryParams.toString()}`,\n method: \"GET\",\n })\n .then((r) => r.data);\n });\n\nexport const getFileThumbnail = createServerFn({ method: \"GET\" })\n .inputValidator(FileSchema)\n .handler(async ({ data }) => {\n const api = getFileApi();\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", data.appName);\n queryParams.append(\"id\", data.id);\n\n const response = await api.request<ArrayBuffer>({\n url: `/v1/thumbnail?${queryParams.toString()}`,\n method: \"GET\",\n responseType: \"arraybuffer\",\n });\n\n return new Response(response.data, {\n headers: {\n \"Content-Type\": response.headers[\"content-type\"] as string,\n },\n });\n });\n\nexport const getFile = createServerFn({ method: \"GET\" })\n .inputValidator(FileSchema)\n .handler(async ({ data }) => {\n const api = getFileApi();\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", data.appName);\n queryParams.append(\"id\", data.id);\n\n const response = await api.request<ArrayBuffer>({\n url: `/v1?${queryParams.toString()}`,\n method: \"GET\",\n responseType: \"arraybuffer\",\n });\n\n return new Response(response.data, {\n headers: {\n \"Content-Type\": response.headers[\"content-type\"] as string,\n },\n });\n });\n\nexport const downloadFile = createServerFn({ method: \"GET\" })\n .inputValidator(FileSchema)\n .handler(async ({ data }) => {\n const api = getFileApi();\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", data.appName);\n queryParams.append(\"id\", data.id);\n\n const response = await api.request<ArrayBuffer>({\n url: `/v1/download?${queryParams.toString()}`,\n method: \"GET\",\n responseType: \"arraybuffer\",\n });\n\n return new Response(response.data, {\n headers: {\n \"Content-Type\": response.headers[\"content-type\"] as string,\n },\n });\n });\n\nexport const updateFileMeta = createServerFn({ method: \"POST\" })\n .inputValidator(UpdateFileMetaSchema)\n .handler(async ({ data }) => {\n const api = getFileApi();\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", data.appName);\n queryParams.append(\"id\", data.id);\n\n return api\n .request({ url: `/v1/meta?${queryParams.toString()}`, method: \"PUT\", data })\n .then((r) => r.data);\n });\n\nexport const deleteFile = createServerFn({ method: \"POST\" })\n .inputValidator(DeleteFileSchema)\n .handler(async ({ data }) => {\n const api = getFileApi();\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", data.appName);\n queryParams.append(\"id\", data.id);\n\n return api\n .request({ url: `/v1?${queryParams.toString()}`, method: \"DELETE\" })\n .then((r) => r.data);\n });\n\nexport const batchDeleteFiles = createServerFn({ method: \"POST\" })\n .inputValidator(BatchDeleteFilesSchema)\n .handler(async ({ data }) => {\n const api = getFileApi();\n const queryParams = new URLSearchParams();\n queryParams.append(\"appName\", data.appName);\n queryParams.append(\"subId\", data.subId);\n\n return api\n .request({ url: `/v1?${queryParams.toString()}`, method: \"DELETE\" })\n .then((r) => r.data);\n });\n\nexport const uploadFile = createServerFn({ method: \"POST\" })\n .inputValidator(UploadFileMetaSchema)\n .handler(async ({ data }): Promise<UploadFileResult> => {\n const accessToken = await getAppToken(\"file\");\n const buffer = Buffer.from(await data.file.arrayBuffer());\n const id = uuidv7();\n\n await new Promise<void>((resolve, reject) => {\n const upload = new Upload(buffer, {\n endpoint: `${serverEnv.FILE_BASE_URL}/v1/upload`,\n chunkSize: 1_048_576,\n metadata: {\n id,\n appName: data.appName,\n subId: data.subId,\n fileName: data.file.name,\n fileExtension: data.file.type,\n },\n headers: { Authorization: `Bearer ${accessToken}` },\n onError: reject,\n onSuccess: () => resolve(),\n });\n upload.start();\n });\n\n return { id, appName: data.appName, subId: data.subId, fileName: data.file.name };\n });\n"],"mappings":";;;;;;;;;AAOA,SAAgBM,kBAAkBC,SAAiBC,UAAmC;CACpF,MAAMC,MAAMR,MAAMS,OAAO,EAAEH,SAAS,CAAC;AAErCE,KAAIE,aAAaC,QAAQC,IAAI,OAAOC,WAAW;EAC7C,MAAMC,cAAc,MAAMX,YAAYI,SAAS;AAC/CM,SAAOE,QAAQC,IAAI,iBAAiB,UAAUF,cAAc;AAC5D,SAAOD;GACP;AAEF,QAAOL;;;;ACLT,IAAIoB,UAAgC;AACpC,MAAMC,aAAaX,yBAAwC;CACzD,MAAMY,UAAUP,UAAUQ;AAC1B,KAAI,CAACD,QAAS,OAAM,IAAIE,MAAM,gEAAgE;AAC9FJ,aAAYD,kBAAkBG,SAAS,OAAO;AAC9C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AAEV,KAAK;EACtB;AAEJ,MAAasB,aAAa9D,eAAe,EAAEqC,QAAQ,QAAQ,CAAC,CACzDC,eAAeN,qBAAqB,CACpCO,QAAQ,OAAO,EAAEC,WAAsC;CACtD,MAAMwB,cAAc,MAAMzD,YAAY,OAAO;CAC7C,MAAM0D,SAASC,OAAOC,KAAK,MAAM3B,KAAKP,KAAKmC,aAAa,CAAC;CACzD,MAAM3C,KAAKrB,QAAQ;AAEnB,OAAM,IAAI2D,SAAeM,SAASC,WAAW;AAe3CC,MAdmBpE,OAAO8D,QAAQ;GAChCO,UAAU,GAAGlE,UAAUQ,cAAa;GACpC2D,WAAW;GACXC,UAAU;IACRjD;IACAP,SAASsB,KAAKtB;IACdI,OAAOkB,KAAKlB;IACZM,UAAUY,KAAKP,KAAK0C;IACpBC,eAAepC,KAAKP,KAAK4C;IAC1B;GACDrB,SAAS,EAAEsB,eAAe,UAAUd,eAAe;GACnDe,SAAST;GACTU,iBAAiBX,SAAQ;GAC1B,CACK,CAACY,OAAO;GACd;AAEF,QAAO;EAAExD;EAAIP,SAASsB,KAAKtB;EAASI,OAAOkB,KAAKlB;EAAOM,UAAUY,KAAKP,KAAK0C;EAAM;EACjF"}
@@ -1,5 +1,5 @@
1
1
  import { t as queryClient } from "./queryClient-1OJ5Va3i.js";
2
- import { a as batchDeleteFiles, c as getFile, d as updateFileMeta, f as uploadFile, l as getFileMetas, o as deleteFile, s as downloadFile, u as getFileThumbnail } from "./file-DSohGVd1.js";
2
+ import { a as batchDeleteFiles, c as getFile, d as updateFileMeta, f as uploadFile, l as getFileMetas, o as deleteFile, s as downloadFile, u as getFileThumbnail } from "./file-BHdm6ob1.js";
3
3
  import { mutationOptions, queryOptions } from "@tanstack/react-query";
4
4
  import saveAs from "file-saver";
5
5
  //#region src/queries/client/file.ts
@@ -97,4 +97,4 @@ const useUploadFile = ({ onSuccess, onError } = {}) => {
97
97
  //#endregion
98
98
  export { fileQueryOptions as a, updateFileMetaMutationOptions as c, fileMetasQueryOptions as i, useUploadFile as l, deleteFileMutationOptions as n, fileThumbnailQueryOptions as o, downloadFileMutationOptions as r, openFileMutationOptions as s, batchDeleteFilesMutationOptions as t };
99
99
 
100
- //# sourceMappingURL=file-B2VFf-iX.js.map
100
+ //# sourceMappingURL=file-DNF9kxdN.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-B2VFf-iX.js","names":["mutationOptions","queryOptions","saveAs","z","queryClient","batchDeleteFiles","deleteFile","downloadFile","getFile","getFileMetas","getFileThumbnail","updateFileMeta","uploadFile","FileSchema","GetFileMetasSchema","UpdateFileMetaSchema","UploadFileMetaSchema","QUERY_KEY","HOUR","baseOptions","staleTime","gcTime","refetchOnWindowFocus","responseToObjectUrl","response","Response","Promise","blob","URL","createObjectURL","fileMetasQueryOptions","params","input","queryKey","appName","subId","queryFn","data","fileThumbnailQueryOptions","id","enabled","fileQueryOptions","downloadFileMutationOptions","mutationFn","fileName","fileExtension","openFileMutationOptions","Error","window","open","updateFileMetaMutationOptions","onSettled","invalidateQueries","exact","deleteFileMutationOptions","batchDeleteFilesMutationOptions","UseUploadFileProps","onSuccess","result","Awaited","ReturnType","onError","error","useUploadFile","mutate"],"sources":["../src/queries/client/file.ts"],"sourcesContent":["import { mutationOptions, queryOptions } from \"@tanstack/react-query\";\nimport saveAs from \"file-saver\";\nimport type { z } from \"zod\";\nimport { queryClient } from \"~/lib/queryClient\";\nimport {\n batchDeleteFiles,\n deleteFile,\n downloadFile,\n getFile,\n getFileMetas,\n getFileThumbnail,\n updateFileMeta,\n uploadFile,\n} from \"~/queries/server/file\";\nimport type {\n FileSchema,\n GetFileMetasSchema,\n UpdateFileMetaSchema,\n UploadFileMetaSchema,\n} from \"~/queries/server/file\";\n\nconst QUERY_KEY = \"file\";\nconst HOUR = 1000 * 60 * 60;\n\nconst baseOptions = {\n staleTime: HOUR,\n gcTime: HOUR,\n refetchOnWindowFocus: false,\n};\n\nasync function responseToObjectUrl(response: Response): Promise<string> {\n const blob = await response.blob();\n return URL.createObjectURL(blob);\n}\n\nexport const fileMetasQueryOptions = (params: z.input<typeof GetFileMetasSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"meta\", params.appName, params.subId],\n queryFn: () => getFileMetas({ data: params }),\n ...baseOptions,\n });\n\nexport const fileThumbnailQueryOptions = (params: z.input<typeof FileSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"thumbnail\", params.appName, params.id],\n queryFn: async () => responseToObjectUrl(await getFileThumbnail({ data: params })),\n enabled: !!params.id,\n ...baseOptions,\n });\n\nexport const fileQueryOptions = (params: z.input<typeof FileSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, params.appName, params.id],\n queryFn: async () => responseToObjectUrl(await getFile({ data: params })),\n enabled: !!params.id,\n ...baseOptions,\n });\n\nexport const downloadFileMutationOptions = () =>\n mutationOptions({\n mutationFn: async (\n data: z.input<typeof FileSchema> & { fileName: string; fileExtension: string },\n ) => {\n const response = await downloadFile({ data });\n saveAs(await response.blob(), `${data.fileName}.${data.fileExtension}`);\n },\n });\n\nexport const openFileMutationOptions = () =>\n mutationOptions<void, Error, z.input<typeof FileSchema>>({\n mutationFn: async (data) => {\n const response = await getFile({ data });\n window.open(await responseToObjectUrl(response));\n },\n });\n\nexport const updateFileMetaMutationOptions = () =>\n mutationOptions({\n mutationFn: (data: z.input<typeof UpdateFileMetaSchema>) => updateFileMeta({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, \"meta\"], exact: false }),\n });\n\nexport const deleteFileMutationOptions = () =>\n mutationOptions({\n mutationFn: (data: z.input<typeof FileSchema>) => deleteFile({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, \"meta\"], exact: false }),\n });\n\nexport const batchDeleteFilesMutationOptions = () =>\n mutationOptions({\n mutationFn: (data: z.input<typeof GetFileMetasSchema>) => batchDeleteFiles({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, \"meta\"], exact: false }),\n });\n\ninterface UseUploadFileProps {\n onSuccess?: (result: Awaited<ReturnType<typeof uploadFile>>) => void;\n onError?: (error: Error) => void;\n}\n\nexport const useUploadFile = ({ onSuccess, onError }: UseUploadFileProps = {}) => {\n const mutate = async (data: z.input<typeof UploadFileMetaSchema>) => {\n if (!data.subId) throw new Error(\"subId is required for file upload\");\n\n try {\n const result = await uploadFile({ data });\n queryClient.invalidateQueries({\n queryKey: [QUERY_KEY, \"meta\", data.appName, data.subId],\n exact: false,\n });\n onSuccess?.(result);\n } catch (error) {\n onError?.(error as Error);\n }\n };\n\n return { mutate };\n};\n"],"mappings":";;;;;AAqBA,MAAMiB,YAAY;AAClB,MAAMC,OAAO,MAAO,KAAK;AAEzB,MAAMC,cAAc;CAClBC,WAAWF;CACXG,QAAQH;CACRI,sBAAsB;CACvB;AAED,eAAeC,oBAAoBC,UAAqC;CACtE,MAAMG,OAAO,MAAMH,SAASG,MAAM;AAClC,QAAOC,IAAIC,gBAAgBF,KAAK;;AAGlC,MAAaG,yBAAyBC,WACpC9B,aAAa;CACXgC,UAAU;EAAChB;EAAW;EAAQc,OAAOG;EAASH,OAAOI;EAAM;CAC3DC,eAAe3B,aAAa,EAAE4B,MAAMN,QAAQ,CAAC;CAC7C,GAAGZ;CACJ,CAAC;AAEJ,MAAamB,6BAA6BP,WACxC9B,aAAa;CACXgC,UAAU;EAAChB;EAAW;EAAac,OAAOG;EAASH,OAAOQ;EAAG;CAC7DH,SAAS,YAAYb,oBAAoB,MAAMb,iBAAiB,EAAE2B,MAAMN,QAAQ,CAAC,CAAC;CAClFS,SAAS,CAAC,CAACT,OAAOQ;CAClB,GAAGpB;CACJ,CAAC;AAEJ,MAAasB,oBAAoBV,WAC/B9B,aAAa;CACXgC,UAAU;EAAChB;EAAWc,OAAOG;EAASH,OAAOQ;EAAG;CAChDH,SAAS,YAAYb,oBAAoB,MAAMf,QAAQ,EAAE6B,MAAMN,QAAQ,CAAC,CAAC;CACzES,SAAS,CAAC,CAACT,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;KAAChB;KAAW;KAAQoB,KAAKH;KAASG,KAAKF;KAAM;IACvDkB,OAAO;IACR,CAAC;AACFI,eAAYC,OAAO;WACZI,OAAO;AACdD,aAAUC,MAAe;;;AAI7B,QAAO,EAAEE,QAAQ"}
1
+ {"version":3,"file":"file-DNF9kxdN.js","names":["mutationOptions","queryOptions","saveAs","z","queryClient","batchDeleteFiles","deleteFile","downloadFile","getFile","getFileMetas","getFileThumbnail","updateFileMeta","uploadFile","FileSchema","GetFileMetasSchema","UpdateFileMetaSchema","UploadFileMetaSchema","QUERY_KEY","HOUR","baseOptions","staleTime","gcTime","refetchOnWindowFocus","responseToObjectUrl","response","Response","Promise","blob","URL","createObjectURL","fileMetasQueryOptions","params","input","queryKey","appName","subId","queryFn","data","fileThumbnailQueryOptions","id","enabled","fileQueryOptions","downloadFileMutationOptions","mutationFn","fileName","fileExtension","openFileMutationOptions","Error","window","open","updateFileMetaMutationOptions","onSettled","invalidateQueries","exact","deleteFileMutationOptions","batchDeleteFilesMutationOptions","UseUploadFileProps","onSuccess","result","Awaited","ReturnType","onError","error","useUploadFile","mutate"],"sources":["../src/queries/client/file.ts"],"sourcesContent":["import { mutationOptions, queryOptions } from \"@tanstack/react-query\";\nimport saveAs from \"file-saver\";\nimport type { z } from \"zod\";\nimport { queryClient } from \"~/lib/queryClient\";\nimport {\n batchDeleteFiles,\n deleteFile,\n downloadFile,\n getFile,\n getFileMetas,\n getFileThumbnail,\n updateFileMeta,\n uploadFile,\n} from \"~/queries/server/file\";\nimport type {\n FileSchema,\n GetFileMetasSchema,\n UpdateFileMetaSchema,\n UploadFileMetaSchema,\n} from \"~/queries/server/file\";\n\nconst QUERY_KEY = \"file\";\nconst HOUR = 1000 * 60 * 60;\n\nconst baseOptions = {\n staleTime: HOUR,\n gcTime: HOUR,\n refetchOnWindowFocus: false,\n};\n\nasync function responseToObjectUrl(response: Response): Promise<string> {\n const blob = await response.blob();\n return URL.createObjectURL(blob);\n}\n\nexport const fileMetasQueryOptions = (params: z.input<typeof GetFileMetasSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"meta\", params.appName, params.subId],\n queryFn: () => getFileMetas({ data: params }),\n ...baseOptions,\n });\n\nexport const fileThumbnailQueryOptions = (params: z.input<typeof FileSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, \"thumbnail\", params.appName, params.id],\n queryFn: async () => responseToObjectUrl(await getFileThumbnail({ data: params })),\n enabled: !!params.id,\n ...baseOptions,\n });\n\nexport const fileQueryOptions = (params: z.input<typeof FileSchema>) =>\n queryOptions({\n queryKey: [QUERY_KEY, params.appName, params.id],\n queryFn: async () => responseToObjectUrl(await getFile({ data: params })),\n enabled: !!params.id,\n ...baseOptions,\n });\n\nexport const downloadFileMutationOptions = () =>\n mutationOptions({\n mutationFn: async (\n data: z.input<typeof FileSchema> & { fileName: string; fileExtension: string },\n ) => {\n const response = await downloadFile({ data });\n saveAs(await response.blob(), `${data.fileName}.${data.fileExtension}`);\n },\n });\n\nexport const openFileMutationOptions = () =>\n mutationOptions<void, Error, z.input<typeof FileSchema>>({\n mutationFn: async (data) => {\n const response = await getFile({ data });\n window.open(await responseToObjectUrl(response));\n },\n });\n\nexport const updateFileMetaMutationOptions = () =>\n mutationOptions({\n mutationFn: (data: z.input<typeof UpdateFileMetaSchema>) => updateFileMeta({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, \"meta\"], exact: false }),\n });\n\nexport const deleteFileMutationOptions = () =>\n mutationOptions({\n mutationFn: (data: z.input<typeof FileSchema>) => deleteFile({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, \"meta\"], exact: false }),\n });\n\nexport const batchDeleteFilesMutationOptions = () =>\n mutationOptions({\n mutationFn: (data: z.input<typeof GetFileMetasSchema>) => batchDeleteFiles({ data }),\n onSettled: () => queryClient.invalidateQueries({ queryKey: [QUERY_KEY, \"meta\"], exact: false }),\n });\n\ninterface UseUploadFileProps {\n onSuccess?: (result: Awaited<ReturnType<typeof uploadFile>>) => void;\n onError?: (error: Error) => void;\n}\n\nexport const useUploadFile = ({ onSuccess, onError }: UseUploadFileProps = {}) => {\n const mutate = async (data: z.input<typeof UploadFileMetaSchema>) => {\n if (!data.subId) throw new Error(\"subId is required for file upload\");\n\n try {\n const result = await uploadFile({ data });\n queryClient.invalidateQueries({\n queryKey: [QUERY_KEY, \"meta\", data.appName, data.subId],\n exact: false,\n });\n onSuccess?.(result);\n } catch (error) {\n onError?.(error as Error);\n }\n };\n\n return { mutate };\n};\n"],"mappings":";;;;;AAqBA,MAAMiB,YAAY;AAClB,MAAMC,OAAO,MAAO,KAAK;AAEzB,MAAMC,cAAc;CAClBC,WAAWF;CACXG,QAAQH;CACRI,sBAAsB;CACvB;AAED,eAAeC,oBAAoBC,UAAqC;CACtE,MAAMG,OAAO,MAAMH,SAASG,MAAM;AAClC,QAAOC,IAAIC,gBAAgBF,KAAK;;AAGlC,MAAaG,yBAAyBC,WACpC9B,aAAa;CACXgC,UAAU;EAAChB;EAAW;EAAQc,OAAOG;EAASH,OAAOI;EAAM;CAC3DC,eAAe3B,aAAa,EAAE4B,MAAMN,QAAQ,CAAC;CAC7C,GAAGZ;CACJ,CAAC;AAEJ,MAAamB,6BAA6BP,WACxC9B,aAAa;CACXgC,UAAU;EAAChB;EAAW;EAAac,OAAOG;EAASH,OAAOQ;EAAG;CAC7DH,SAAS,YAAYb,oBAAoB,MAAMb,iBAAiB,EAAE2B,MAAMN,QAAQ,CAAC,CAAC;CAClFS,SAAS,CAAC,CAACT,OAAOQ;CAClB,GAAGpB;CACJ,CAAC;AAEJ,MAAasB,oBAAoBV,WAC/B9B,aAAa;CACXgC,UAAU;EAAChB;EAAWc,OAAOG;EAASH,OAAOQ;EAAG;CAChDH,SAAS,YAAYb,oBAAoB,MAAMf,QAAQ,EAAE6B,MAAMN,QAAQ,CAAC,CAAC;CACzES,SAAS,CAAC,CAACT,OAAOQ;CAClB,GAAGpB;CACJ,CAAC;AAEJ,MA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AAM;IACvDkB,OAAO;IACR,CAAC;AACFI,eAAYC,OAAO;WACZI,OAAO;AACdD,aAAUC,MAAe;;;AAI7B,QAAO,EAAEE,QAAQ"}
package/dist/hooks.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as getFieldStatus } from "./utils-CBa4vtgn.js";
1
+ import { a as getFieldStatus } from "./utils-B7LPctqx.js";
2
2
  import { t as NotificationContext } from "./NotificationContext-FQRaNZRx.js";
3
- import { t as useDialogs } from "./useDialogs-DBcNu-LV.js";
3
+ import { t as useDialogs } from "./useDialogs-BQEh6of8.js";
4
4
  import { c } from "react/compiler-runtime";
5
5
  import { Autocomplete, Button, Checkbox, FormControl, FormControlLabel, FormHelperText, FormLabel, Radio, RadioGroup, Slider, Switch, TextField } from "@mui/material";
6
6
  import { useContext, useEffect, useRef } from "react";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as clientEnv } from "./env-szOeLEuD.js";
2
- import { c as TanStackNavigationClient, d as pca, l as getAccessToken, n as WISTRON_PRIMARY_COLOR, r as WISTRON_SECONDARY_COLOR, s as rootRouteHead, t as Platform, u as getUser } from "./utils-CBa4vtgn.js";
1
+ import { t as clientEnv } from "./env-Dgbk8SQN.js";
2
+ import { c as TanStackNavigationClient, d as pca, l as getAccessToken, n as WISTRON_PRIMARY_COLOR, r as WISTRON_SECONDARY_COLOR, s as rootRouteHead, t as Platform, u as getUser } from "./utils-B7LPctqx.js";
3
3
  import { t as queryClient } from "./queryClient-1OJ5Va3i.js";
4
4
  import { n as RouterIconButton, t as RouterListItemButton } from "./RouterListItemButton-p9U4Z0SW.js";
5
5
  import { t as DialogsContext } from "./DialogsContext-DkePghS6.js";
@@ -839,9 +839,9 @@ const routerButtonSx = (theme) => ({
839
839
  });
840
840
  const IconOrAvatar = (t0) => {
841
841
  const $ = c(18);
842
- if ($[0] !== "cbde515b86a86fea1331dbff3d4f8958ea6789240860d17833ef136340d87e88") {
842
+ if ($[0] !== "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9") {
843
843
  for (let $i = 0; $i < 18; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
844
- $[0] = "cbde515b86a86fea1331dbff3d4f8958ea6789240860d17833ef136340d87e88";
844
+ $[0] = "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9";
845
845
  }
846
846
  const { item, collapsed } = t0;
847
847
  if (item.icon || collapsed) {
@@ -932,9 +932,9 @@ const IconOrAvatar = (t0) => {
932
932
  };
933
933
  const MiniPopover = (t0) => {
934
934
  const $ = c(8);
935
- if ($[0] !== "cbde515b86a86fea1331dbff3d4f8958ea6789240860d17833ef136340d87e88") {
935
+ if ($[0] !== "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9") {
936
936
  for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
937
- $[0] = "cbde515b86a86fea1331dbff3d4f8958ea6789240860d17833ef136340d87e88";
937
+ $[0] = "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9";
938
938
  }
939
939
  const { open, children } = t0;
940
940
  let t1;
@@ -985,9 +985,9 @@ const MiniPopover = (t0) => {
985
985
  };
986
986
  const NavigationListItem = (t0) => {
987
987
  const $ = c(62);
988
- if ($[0] !== "cbde515b86a86fea1331dbff3d4f8958ea6789240860d17833ef136340d87e88") {
988
+ if ($[0] !== "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9") {
989
989
  for (let $i = 0; $i < 62; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
990
- $[0] = "cbde515b86a86fea1331dbff3d4f8958ea6789240860d17833ef136340d87e88";
990
+ $[0] = "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9";
991
991
  }
992
992
  const { item, isOpen, selected, disabled, collapsed, isSidebarFullyExpanded: t1, isSidebarFullyCollapsed, onClick, renderNested, onClose } = t0;
993
993
  const isSidebarFullyExpanded = t1 === void 0 ? true : t1;
@@ -1213,9 +1213,9 @@ function _temp$3(word) {
1213
1213
  //#region src/components/core/navigation/NavigationList.tsx
1214
1214
  const NavigationList = (t0) => {
1215
1215
  const $ = c(29);
1216
- if ($[0] !== "54b4ebd58dbce1d2924089c3a4b49d010b8b2d08b36cb8fffffa71372840d7c7") {
1216
+ if ($[0] !== "4dbd114545118530db002b7c781f97683277f7b721a30074e8778a8e4ea56119") {
1217
1217
  for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1218
- $[0] = "54b4ebd58dbce1d2924089c3a4b49d010b8b2d08b36cb8fffffa71372840d7c7";
1218
+ $[0] = "4dbd114545118530db002b7c781f97683277f7b721a30074e8778a8e4ea56119";
1219
1219
  }
1220
1220
  const { subNavigation, depth: t1, collapsed, isPopover, isSidebarFullyExpanded: t2, isSidebarFullyCollapsed, renderItem, activePath, onClose } = t0;
1221
1221
  const depth = t1 === void 0 ? 0 : t1;
@@ -2024,9 +2024,9 @@ i18n.on("languageChanged", (language) => {
2024
2024
  });
2025
2025
  const LayoutProvider = (t0) => {
2026
2026
  const $ = c(12);
2027
- if ($[0] !== "1c241c500656a85c82e2db9988e1f3fe294bfa7c895557871c9ebbc97b5aea15") {
2027
+ if ($[0] !== "7d53a8f475a1db0d90470b3e6f4eb7def00335ac04ea3deb04c263c20cfc27ec") {
2028
2028
  for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
2029
- $[0] = "1c241c500656a85c82e2db9988e1f3fe294bfa7c895557871c9ebbc97b5aea15";
2029
+ $[0] = "7d53a8f475a1db0d90470b3e6f4eb7def00335ac04ea3deb04c263c20cfc27ec";
2030
2030
  }
2031
2031
  const { options, navigation, theme, children } = t0;
2032
2032
  let t1;