diff --git a/backend/dist/controllers/contract.controller.d.ts b/backend/dist/controllers/contract.controller.d.ts index 5ea09c1b..401de5a7 100644 --- a/backend/dist/controllers/contract.controller.d.ts +++ b/backend/dist/controllers/contract.controller.d.ts @@ -5,7 +5,7 @@ export declare function getContract(req: AuthRequest, res: Response): Promise; export declare function updateContract(req: Request, res: Response): Promise; export declare function deleteContract(req: Request, res: Response): Promise; -export declare function createFollowUp(req: Request, res: Response): Promise; +export declare function createFollowUp(req: AuthRequest, res: Response): Promise; export declare function getContractPassword(req: Request, res: Response): Promise; export declare function getSimCardCredentials(req: Request, res: Response): Promise; export declare function getInternetCredentials(req: Request, res: Response): Promise; diff --git a/backend/dist/controllers/contract.controller.d.ts.map b/backend/dist/controllers/contract.controller.d.ts.map index 1d0f52ad..34a5ce51 100644 --- a/backend/dist/controllers/contract.controller.d.ts.map +++ b/backend/dist/controllers/contract.controller.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"contract.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/contract.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI5C,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAI7D,wBAAsB,YAAY,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCjF;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BhF;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAU/E;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAU/E;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAU/E;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAU/E;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBpF;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAUtF;AAED,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAUvF;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAUlF;AAID,wBAAsB,UAAU,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAW/E;AAID,wBAAsB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAyC/E"} \ No newline at end of file +{"version":3,"file":"contract.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/contract.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAI7D,wBAAsB,YAAY,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCjF;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BhF;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAU/E;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAU/E;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAU/E;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAuCnF;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBpF;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAUtF;AAED,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAUvF;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAUlF;AAID,wBAAsB,UAAU,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAW/E;AAID,wBAAsB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAyC/E"} \ No newline at end of file diff --git a/backend/dist/controllers/contract.controller.js b/backend/dist/controllers/contract.controller.js index 4a520066..fee0983d 100644 --- a/backend/dist/controllers/contract.controller.js +++ b/backend/dist/controllers/contract.controller.js @@ -48,6 +48,7 @@ exports.snoozeContract = snoozeContract; const client_1 = require("@prisma/client"); const contractService = __importStar(require("../services/contract.service.js")); const contractCockpitService = __importStar(require("../services/contractCockpit.service.js")); +const contractHistoryService = __importStar(require("../services/contractHistory.service.js")); const prisma = new client_1.PrismaClient(); async function getContracts(req, res) { try { @@ -154,7 +155,22 @@ async function deleteContract(req, res) { } async function createFollowUp(req, res) { try { - const contract = await contractService.createFollowUpContract(parseInt(req.params.id)); + const previousContractId = parseInt(req.params.id); + // Vorgängervertrag laden für Vertragsnummer + const previousContract = await prisma.contract.findUnique({ + where: { id: previousContractId }, + select: { contractNumber: true }, + }); + if (!previousContract) { + res.status(404).json({ success: false, error: 'Vorgängervertrag nicht gefunden' }); + return; + } + const contract = await contractService.createFollowUpContract(previousContractId); + const createdBy = req.user?.email || 'unbekannt'; + // Historie-Eintrag für den Vorgängervertrag erstellen + await contractHistoryService.createFollowUpHistoryEntry(previousContractId, contract.contractNumber, createdBy); + // Historie-Eintrag für den neuen Folgevertrag erstellen + await contractHistoryService.createNewContractFromPredecessorEntry(contract.id, previousContract.contractNumber, createdBy); res.status(201).json({ success: true, data: contract }); } catch (error) { diff --git a/backend/dist/controllers/contract.controller.js.map b/backend/dist/controllers/contract.controller.js.map index 0f816e1d..41224387 100644 --- a/backend/dist/controllers/contract.controller.js.map +++ b/backend/dist/controllers/contract.controller.js.map @@ -1 +1 @@ -{"version":3,"file":"contract.controller.js","sourceRoot":"","sources":["../../src/controllers/contract.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,oCAwCC;AAED,kCA8BC;AAED,wCAUC;AAED,wCAUC;AAED,wCAUC;AAED,wCAUC;AAED,kDAiBC;AAED,sDAUC;AAED,wDAUC;AAED,8CAUC;AAID,gCAWC;AAID,wCAyCC;AAlPD,2CAA8C;AAC9C,iFAAmE;AACnE,+FAAiF;AAGjF,MAAM,MAAM,GAAG,IAAI,qBAAY,EAAE,CAAC;AAE3B,KAAK,UAAU,YAAY,CAAC,GAAgB,EAAE,GAAa;IAChE,IAAI,CAAC;QACH,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC;QAE1E,iCAAiC;QACjC,IAAI,IAAI,KAAK,MAAM,IAAI,UAAU,EAAE,CAAC;YAClC,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,0BAA0B,CAC/D,QAAQ,CAAC,UAAoB,CAAC,CAC/B,CAAC;YACF,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAiB,CAAC,CAAC;YAC3D,OAAO;QACT,CAAC;QAED,8EAA8E;QAC9E,IAAI,WAAiC,CAAC;QACtC,IAAI,GAAG,CAAC,IAAI,EAAE,gBAAgB,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACtD,mDAAmD;YACnD,WAAW,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC,CAAC;QAClF,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,eAAe,CAAC;YACnD,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAoB,CAAC,CAAC,CAAC,CAAC,SAAS;YACnE,WAAW,EAAE,6CAA6C;YAC1D,IAAI,EAAE,IAAW;YACjB,MAAM,EAAE,MAAa;YACrB,MAAM,EAAE,MAAgB;YACxB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAc,CAAC,CAAC,CAAC,CAAC,SAAS;YACjD,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAe,CAAC,CAAC,CAAC,CAAC,SAAS;SACrD,CAAC,CAAC;QACH,GAAG,CAAC,IAAI,CAAC;YACP,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,MAAM,CAAC,SAAS;YACtB,UAAU,EAAE,MAAM,CAAC,UAAU;SACf,CAAC,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,gCAAgC;SACzB,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,WAAW,CAAC,GAAgB,EAAE,GAAa;IAC/D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAChF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,wBAAwB;aACjB,CAAC,CAAC;YAClB,OAAO;QACT,CAAC;QAED,iFAAiF;QACjF,IAAI,GAAG,CAAC,IAAI,EAAE,gBAAgB,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACtD,MAAM,kBAAkB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC,CAAC;YAC7F,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBACtD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBACnB,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,iCAAiC;iBAC1B,CAAC,CAAC;gBAClB,OAAO;YACT,CAAC;QACH,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAiB,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,gCAAgC;SACzB,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,GAAY,EAAE,GAAa;IAC9D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAiB,CAAC,CAAC;IACzE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,oCAAoC;SACtE,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,GAAY,EAAE,GAAa;IAC9D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QACzF,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAiB,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wCAAwC;SAC1E,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,GAAY,EAAE,GAAa;IAC9D,IAAI,CAAC;QACH,MAAM,eAAe,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9D,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAiB,CAAC,CAAC;IAC1E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,kCAAkC;SACpE,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,GAAY,EAAE,GAAa;IAC9D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,sBAAsB,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QACvF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAiB,CAAC,CAAC;IACzE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,yCAAyC;SAC3E,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,mBAAmB,CAAC,GAAY,EAAE,GAAa;IACnE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QACpF,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,0BAA0B;aACnB,CAAC,CAAC;YAClB,OAAO;QACT,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,EAAiB,CAAC,CAAC;IACjE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,yCAAyC;SAClC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,qBAAqB,CAAC,GAAY,EAAE,GAAa;IACrE,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,qBAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAChG,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAiB,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,gDAAgD;SACzC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,sBAAsB,CAAC,GAAY,EAAE,GAAa;IACtE,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,sBAAsB,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1F,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAiB,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,kDAAkD;SAC3C,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,iBAAiB,CAAC,GAAY,EAAE,GAAa;IACjE,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;QAChG,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAiB,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,6CAA6C;SACtC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED,6DAA6D;AAEtD,KAAK,UAAU,UAAU,CAAC,GAAgB,EAAE,GAAa;IAC9D,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,sBAAsB,CAAC,cAAc,EAAE,CAAC;QAClE,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAiB,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QACvC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,yCAAyC;SAClC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED,2EAA2E;AAEpE,KAAK,UAAU,cAAc,CAAC,GAAY,EAAE,GAAa;IAC9D,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACnC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QAE5C,IAAI,UAAU,GAAgB,IAAI,CAAC;QAEnC,IAAI,cAAc,EAAE,CAAC;YACnB,6BAA6B;YAC7B,UAAU,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC;QACxC,CAAC;aAAM,IAAI,MAAM,EAAE,CAAC;YAClB,oCAAoC;YACpC,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;YACxB,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC;QACtD,CAAC;QACD,4EAA4E;QAE5E,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC3C,KAAK,EAAE,EAAE,EAAE,EAAE;YACb,IAAI,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE;YACpC,MAAM,EAAE;gBACN,EAAE,EAAE,IAAI;gBACR,cAAc,EAAE,IAAI;gBACpB,cAAc,EAAE,IAAI;aACrB;SACF,CAAC,CAAC;QAEH,GAAG,CAAC,IAAI,CAAC;YACP,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,UAAU;gBACjB,CAAC,CAAC,8BAA8B,UAAU,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE;gBACxE,CAAC,CAAC,2BAA2B;SACjB,CAAC,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACtC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,wCAAwC;SACjC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC"} \ No newline at end of file +{"version":3,"file":"contract.controller.js","sourceRoot":"","sources":["../../src/controllers/contract.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,oCAwCC;AAED,kCA8BC;AAED,wCAUC;AAED,wCAUC;AAED,wCAUC;AAED,wCAuCC;AAED,kDAiBC;AAED,sDAUC;AAED,wDAUC;AAED,8CAUC;AAID,gCAWC;AAID,wCAyCC;AAhRD,2CAA8C;AAC9C,iFAAmE;AACnE,+FAAiF;AACjF,+FAAiF;AAGjF,MAAM,MAAM,GAAG,IAAI,qBAAY,EAAE,CAAC;AAE3B,KAAK,UAAU,YAAY,CAAC,GAAgB,EAAE,GAAa;IAChE,IAAI,CAAC;QACH,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC;QAE1E,iCAAiC;QACjC,IAAI,IAAI,KAAK,MAAM,IAAI,UAAU,EAAE,CAAC;YAClC,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,0BAA0B,CAC/D,QAAQ,CAAC,UAAoB,CAAC,CAC/B,CAAC;YACF,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAiB,CAAC,CAAC;YAC3D,OAAO;QACT,CAAC;QAED,8EAA8E;QAC9E,IAAI,WAAiC,CAAC;QACtC,IAAI,GAAG,CAAC,IAAI,EAAE,gBAAgB,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACtD,mDAAmD;YACnD,WAAW,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC,CAAC;QAClF,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,eAAe,CAAC;YACnD,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAoB,CAAC,CAAC,CAAC,CAAC,SAAS;YACnE,WAAW,EAAE,6CAA6C;YAC1D,IAAI,EAAE,IAAW;YACjB,MAAM,EAAE,MAAa;YACrB,MAAM,EAAE,MAAgB;YACxB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAc,CAAC,CAAC,CAAC,CAAC,SAAS;YACjD,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAe,CAAC,CAAC,CAAC,CAAC,SAAS;SACrD,CAAC,CAAC;QACH,GAAG,CAAC,IAAI,CAAC;YACP,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,MAAM,CAAC,SAAS;YACtB,UAAU,EAAE,MAAM,CAAC,UAAU;SACf,CAAC,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,gCAAgC;SACzB,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,WAAW,CAAC,GAAgB,EAAE,GAAa;IAC/D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAChF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,wBAAwB;aACjB,CAAC,CAAC;YAClB,OAAO;QACT,CAAC;QAED,iFAAiF;QACjF,IAAI,GAAG,CAAC,IAAI,EAAE,gBAAgB,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACtD,MAAM,kBAAkB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC,CAAC;YAC7F,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBACtD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBACnB,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,iCAAiC;iBAC1B,CAAC,CAAC;gBAClB,OAAO;YACT,CAAC;QACH,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAiB,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,gCAAgC;SACzB,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,GAAY,EAAE,GAAa;IAC9D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAiB,CAAC,CAAC;IACzE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,oCAAoC;SACtE,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,GAAY,EAAE,GAAa;IAC9D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QACzF,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAiB,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wCAAwC;SAC1E,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,GAAY,EAAE,GAAa;IAC9D,IAAI,CAAC;QACH,MAAM,eAAe,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9D,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAiB,CAAC,CAAC;IAC1E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,kCAAkC;SACpE,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,GAAgB,EAAE,GAAa;IAClE,IAAI,CAAC;QACH,MAAM,kBAAkB,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAEnD,4CAA4C;QAC5C,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;YACxD,KAAK,EAAE,EAAE,EAAE,EAAE,kBAAkB,EAAE;YACjC,MAAM,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;SACjC,CAAC,CAAC;QAEH,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,iCAAiC,EAAiB,CAAC,CAAC;YAClG,OAAO;QACT,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;QAClF,MAAM,SAAS,GAAG,GAAG,CAAC,IAAI,EAAE,KAAK,IAAI,WAAW,CAAC;QAEjD,sDAAsD;QACtD,MAAM,sBAAsB,CAAC,0BAA0B,CACrD,kBAAkB,EAClB,QAAQ,CAAC,cAAc,EACvB,SAAS,CACV,CAAC;QAEF,wDAAwD;QACxD,MAAM,sBAAsB,CAAC,qCAAqC,CAChE,QAAQ,CAAC,EAAE,EACX,gBAAgB,CAAC,cAAc,EAC/B,SAAS,CACV,CAAC;QAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAiB,CAAC,CAAC;IACzE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,yCAAyC;SAC3E,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,mBAAmB,CAAC,GAAY,EAAE,GAAa;IACnE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QACpF,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,0BAA0B;aACnB,CAAC,CAAC;YAClB,OAAO;QACT,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,EAAiB,CAAC,CAAC;IACjE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,yCAAyC;SAClC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,qBAAqB,CAAC,GAAY,EAAE,GAAa;IACrE,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,qBAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAChG,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAiB,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,gDAAgD;SACzC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,sBAAsB,CAAC,GAAY,EAAE,GAAa;IACtE,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,sBAAsB,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1F,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAiB,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,kDAAkD;SAC3C,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,iBAAiB,CAAC,GAAY,EAAE,GAAa;IACjE,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;QAChG,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAiB,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,6CAA6C;SACtC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED,6DAA6D;AAEtD,KAAK,UAAU,UAAU,CAAC,GAAgB,EAAE,GAAa;IAC9D,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,sBAAsB,CAAC,cAAc,EAAE,CAAC;QAClE,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAiB,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QACvC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,yCAAyC;SAClC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED,2EAA2E;AAEpE,KAAK,UAAU,cAAc,CAAC,GAAY,EAAE,GAAa;IAC9D,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACnC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QAE5C,IAAI,UAAU,GAAgB,IAAI,CAAC;QAEnC,IAAI,cAAc,EAAE,CAAC;YACnB,6BAA6B;YAC7B,UAAU,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC;QACxC,CAAC;aAAM,IAAI,MAAM,EAAE,CAAC;YAClB,oCAAoC;YACpC,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;YACxB,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC;QACtD,CAAC;QACD,4EAA4E;QAE5E,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC3C,KAAK,EAAE,EAAE,EAAE,EAAE;YACb,IAAI,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE;YACpC,MAAM,EAAE;gBACN,EAAE,EAAE,IAAI;gBACR,cAAc,EAAE,IAAI;gBACpB,cAAc,EAAE,IAAI;aACrB;SACF,CAAC,CAAC;QAEH,GAAG,CAAC,IAAI,CAAC;YACP,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,UAAU;gBACjB,CAAC,CAAC,8BAA8B,UAAU,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE;gBACxE,CAAC,CAAC,2BAA2B;SACjB,CAAC,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACtC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,wCAAwC;SACjC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC"} \ No newline at end of file diff --git a/backend/dist/index.js b/backend/dist/index.js index fab9b882..f1ebcb4f 100644 --- a/backend/dist/index.js +++ b/backend/dist/index.js @@ -29,6 +29,7 @@ const appSetting_routes_js_1 = __importDefault(require("./routes/appSetting.rout const emailProvider_routes_js_1 = __importDefault(require("./routes/emailProvider.routes.js")); const cachedEmail_routes_js_1 = __importDefault(require("./routes/cachedEmail.routes.js")); const invoice_routes_js_1 = __importDefault(require("./routes/invoice.routes.js")); +const contractHistory_routes_js_1 = __importDefault(require("./routes/contractHistory.routes.js")); dotenv_1.default.config(); const app = (0, express_1.default)(); const PORT = process.env.PORT || 3001; @@ -60,6 +61,7 @@ app.use('/api/settings', appSetting_routes_js_1.default); app.use('/api/email-providers', emailProvider_routes_js_1.default); app.use('/api', cachedEmail_routes_js_1.default); app.use('/api/energy-details', invoice_routes_js_1.default); +app.use('/api', contractHistory_routes_js_1.default); // Health check app.get('/api/health', (req, res) => { res.json({ status: 'ok', timestamp: new Date().toISOString() }); diff --git a/backend/dist/index.js.map b/backend/dist/index.js.map index 653deff5..dd5894f8 100644 --- a/backend/dist/index.js.map +++ b/backend/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,sDAA8B;AAC9B,gDAAwB;AACxB,gDAAwB;AACxB,oDAA4B;AAE5B,6EAAiD;AACjD,qFAAyD;AACzD,mFAAuD;AACvD,qFAAyD;AACzD,qFAAyD;AACzD,+EAAmD;AACnD,mGAAuE;AACvE,qFAAyD;AACzD,qFAAyD;AACzD,2GAA8E;AAC9E,uGAA0E;AAC1E,qFAAyD;AACzD,iFAAqD;AACrD,6EAAiD;AACjD,iFAAqD;AACrD,uFAA2D;AAC3D,qGAAyE;AACzE,6FAAiE;AACjE,yFAA6D;AAC7D,+FAAmE;AACnE,2FAA+D;AAC/D,mFAAuD;AAEvD,gBAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;AACtB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC;AAEtC,aAAa;AACb,GAAG,CAAC,GAAG,CAAC,IAAA,cAAI,GAAE,CAAC,CAAC;AAChB,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AAExB,gCAAgC;AAChC,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,iBAAO,CAAC,MAAM,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAE7E,SAAS;AACT,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,wBAAU,CAAC,CAAC;AACjC,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,4BAAc,CAAC,CAAC;AAC1C,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,2BAAa,CAAC,CAAC;AACzC,GAAG,CAAC,GAAG,CAAC,iBAAiB,EAAE,4BAAc,CAAC,CAAC;AAC3C,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,4BAAc,CAAC,CAAC;AAC1C,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,yBAAW,CAAC,CAAC;AACpC,GAAG,CAAC,GAAG,CAAC,wBAAwB,EAAE,mCAAqB,CAAC,CAAC;AACzD,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,4BAAc,CAAC,CAAC;AAC1C,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,4BAAc,CAAC,CAAC;AAC1C,GAAG,CAAC,GAAG,CAAC,2BAA2B,EAAE,uCAAwB,CAAC,CAAC;AAC/D,GAAG,CAAC,GAAG,CAAC,yBAAyB,EAAE,qCAAsB,CAAC,CAAC;AAC3D,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,4BAAc,CAAC,CAAC;AAC1C,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,0BAAY,CAAC,CAAC;AACtC,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,wBAAU,CAAC,CAAC;AAClC,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,0BAAY,CAAC,CAAC;AACrC,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,6BAAe,CAAC,CAAC;AAC3C,GAAG,CAAC,GAAG,CAAC,0BAA0B,EAAE,oCAAsB,CAAC,CAAC;AAC5D,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,gCAAkB,CAAC,CAAC;AACpC,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,8BAAgB,CAAC,CAAC;AAC3C,GAAG,CAAC,GAAG,CAAC,sBAAsB,EAAE,iCAAmB,CAAC,CAAC;AACrD,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,+BAAiB,CAAC,CAAC;AACnC,GAAG,CAAC,GAAG,CAAC,qBAAqB,EAAE,2BAAa,CAAC,CAAC;AAE9C,eAAe;AACf,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAClC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC,CAAC;AAEH,iBAAiB;AACjB,GAAG,CAAC,GAAG,CAAC,CAAC,GAAU,EAAE,GAAoB,EAAE,GAAqB,EAAE,IAA0B,EAAE,EAAE;IAC9F,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC;AAC3E,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;IACpB,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,sDAA8B;AAC9B,gDAAwB;AACxB,gDAAwB;AACxB,oDAA4B;AAE5B,6EAAiD;AACjD,qFAAyD;AACzD,mFAAuD;AACvD,qFAAyD;AACzD,qFAAyD;AACzD,+EAAmD;AACnD,mGAAuE;AACvE,qFAAyD;AACzD,qFAAyD;AACzD,2GAA8E;AAC9E,uGAA0E;AAC1E,qFAAyD;AACzD,iFAAqD;AACrD,6EAAiD;AACjD,iFAAqD;AACrD,uFAA2D;AAC3D,qGAAyE;AACzE,6FAAiE;AACjE,yFAA6D;AAC7D,+FAAmE;AACnE,2FAA+D;AAC/D,mFAAuD;AACvD,mGAAuE;AAEvE,gBAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;AACtB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC;AAEtC,aAAa;AACb,GAAG,CAAC,GAAG,CAAC,IAAA,cAAI,GAAE,CAAC,CAAC;AAChB,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AAExB,gCAAgC;AAChC,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,iBAAO,CAAC,MAAM,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAE7E,SAAS;AACT,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,wBAAU,CAAC,CAAC;AACjC,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,4BAAc,CAAC,CAAC;AAC1C,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,2BAAa,CAAC,CAAC;AACzC,GAAG,CAAC,GAAG,CAAC,iBAAiB,EAAE,4BAAc,CAAC,CAAC;AAC3C,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,4BAAc,CAAC,CAAC;AAC1C,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,yBAAW,CAAC,CAAC;AACpC,GAAG,CAAC,GAAG,CAAC,wBAAwB,EAAE,mCAAqB,CAAC,CAAC;AACzD,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,4BAAc,CAAC,CAAC;AAC1C,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,4BAAc,CAAC,CAAC;AAC1C,GAAG,CAAC,GAAG,CAAC,2BAA2B,EAAE,uCAAwB,CAAC,CAAC;AAC/D,GAAG,CAAC,GAAG,CAAC,yBAAyB,EAAE,qCAAsB,CAAC,CAAC;AAC3D,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,4BAAc,CAAC,CAAC;AAC1C,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,0BAAY,CAAC,CAAC;AACtC,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,wBAAU,CAAC,CAAC;AAClC,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,0BAAY,CAAC,CAAC;AACrC,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,6BAAe,CAAC,CAAC;AAC3C,GAAG,CAAC,GAAG,CAAC,0BAA0B,EAAE,oCAAsB,CAAC,CAAC;AAC5D,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,gCAAkB,CAAC,CAAC;AACpC,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,8BAAgB,CAAC,CAAC;AAC3C,GAAG,CAAC,GAAG,CAAC,sBAAsB,EAAE,iCAAmB,CAAC,CAAC;AACrD,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,+BAAiB,CAAC,CAAC;AACnC,GAAG,CAAC,GAAG,CAAC,qBAAqB,EAAE,2BAAa,CAAC,CAAC;AAC9C,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,mCAAqB,CAAC,CAAC;AAEvC,eAAe;AACf,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAClC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC,CAAC;AAEH,iBAAiB;AACjB,GAAG,CAAC,GAAG,CAAC,CAAC,GAAU,EAAE,GAAoB,EAAE,GAAqB,EAAE,IAA0B,EAAE,EAAE;IAC9F,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC;AAC3E,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;IACpB,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/backend/dist/services/contract.service.js b/backend/dist/services/contract.service.js index c1e5fb8f..bde0c36e 100644 --- a/backend/dist/services/contract.service.js +++ b/backend/dist/services/contract.service.js @@ -467,7 +467,7 @@ async function createFollowUpContract(previousContractId) { // Explicitly NOT copying: providerName, tariffName, portalUsername, portalPassword, price fields cancellationPeriodId: previousContract.cancellationPeriodId ?? undefined, contractDurationId: previousContract.contractDurationId ?? undefined, - notes: `Folgevertrag zu ${previousContract.contractNumber}`, + // notes nicht mehr automatisch setzen - wird jetzt über Historie-Eintrag dokumentiert }; // Copy type-specific details (without credentials) if (previousContract.energyDetails) { diff --git a/backend/dist/services/contract.service.js.map b/backend/dist/services/contract.service.js.map index 7c7490cf..32eed528 100644 --- a/backend/dist/services/contract.service.js.map +++ b/backend/dist/services/contract.service.js.map @@ -1 +1 @@ -{"version":3,"file":"contract.service.js","sourceRoot":"","sources":["../../src/services/contract.service.ts"],"names":[],"mappings":";;AAgBA,0CA2FC;AAED,0CAmDC;AA4GD,wCAyGC;AAED,wCA2MC;AAED,wCAkBC;AAED,wDAiHC;AAGD,kDAaC;AAGD,sDAgBC;AAGD,wDAeC;AAGD,8CAeC;AA4BD,gEAiEC;AA72BD,2CAA4E;AAC5E,oDAAgG;AAChG,0DAA0D;AAE1D,MAAM,MAAM,GAAG,IAAI,qBAAY,EAAE,CAAC;AAY3B,KAAK,UAAU,eAAe,CAAC,OAAwB;IAC5D,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IACxF,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAA,qBAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAE7C,MAAM,KAAK,GAA4B,EAAE,CAAC;IAE1C,6EAA6E;IAC7E,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,KAAK,CAAC,UAAU,GAAG,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC;IACzC,CAAC;SAAM,IAAI,UAAU,EAAE,CAAC;QACtB,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC;IAChC,CAAC;IACD,IAAI,IAAI;QAAE,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;IAE5B,gEAAgE;IAChE,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACxB,CAAC;SAAM,CAAC;QACN,mEAAmE;QACnE,KAAK,CAAC,MAAM,GAAG,EAAE,GAAG,EAAE,uBAAc,CAAC,WAAW,EAAE,CAAC;IACrD,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,CAAC,EAAE,GAAG;YACT,uBAAuB;YACvB,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;YACxC,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;YACtC,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;YACpC,EAAE,wBAAwB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;YAClD,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YAC5C,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YAC1C,aAAa;YACb,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACjD,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YAChD,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACnD,EAAE,QAAQ,EAAE,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACtD,2BAA2B;YAC3B,EAAE,eAAe,EAAE,EAAE,kBAAkB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACjE,EAAE,eAAe,EAAE,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACrD,EAAE,eAAe,EAAE,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YAC7D,EAAE,eAAe,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE;YACtF,4BAA4B;YAC5B,EAAE,aAAa,EAAE,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACxD,EAAE,aAAa,EAAE,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YAC1D,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACvD,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE;YAChF,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE;YAClF,yCAAyC;YACzC,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE;YACnE,qBAAqB;YACrB,EAAE,SAAS,EAAE,EAAE,eAAe,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACxD,mBAAmB;YACnB,EAAE,mBAAmB,EAAE,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YAC/D,EAAE,mBAAmB,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACtD,EAAE,mBAAmB,EAAE,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;SAChE,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC3C,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACvB,KAAK;YACL,IAAI;YACJ,IAAI;YACJ,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;YAChC,OAAO,EAAE;gBACP,QAAQ,EAAE;oBACR,MAAM,EAAE;wBACN,EAAE,EAAE,IAAI;wBACR,cAAc,EAAE,IAAI;wBACpB,SAAS,EAAE,IAAI;wBACf,QAAQ,EAAE,IAAI;wBACd,WAAW,EAAE,IAAI;qBAClB;iBACF;gBACD,OAAO,EAAE,IAAI;gBACb,cAAc,EAAE,IAAI;gBACpB,aAAa,EAAE,IAAI;gBACnB,kBAAkB,EAAE,IAAI;gBACxB,gBAAgB,EAAE,IAAI;gBACtB,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,IAAI;gBACZ,gBAAgB,EAAE,IAAI;aACvB;SACF,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;KACjC,CAAC,CAAC;IAEH,OAAO;QACL,SAAS;QACT,UAAU,EAAE,IAAA,oCAAuB,EAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC;KACxD,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,eAAe,CAAC,EAAU,EAAE,eAAe,GAAG,KAAK;IACvE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;QAChD,KAAK,EAAE,EAAE,EAAE,EAAE;QACb,OAAO,EAAE;YACP,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;YACb,cAAc,EAAE,IAAI;YACpB,QAAQ,EAAE,IAAI;YACd,gBAAgB,EAAE,IAAI;YACtB,aAAa,EAAE,IAAI;YACnB,kBAAkB,EAAE,IAAI;YACxB,gBAAgB,EAAE,IAAI;YACtB,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI;YACZ,gBAAgB,EAAE,IAAI;YACtB,gBAAgB,EAAE,IAAI;YACtB,gBAAgB,EAAE;gBAChB,OAAO,EAAE;oBACP,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;oBACtF,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE;oBACpD,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;oBAC9C,SAAS,EAAE,IAAI;oBACf,mBAAmB,EAAE,IAAI;iBAC1B;aACF;YACD,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;YACtF,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE;YACpD,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;YAC9C,SAAS,EAAE,IAAI;YACf,mBAAmB,EAAE,IAAI;YACzB,eAAe,EAAE,IAAI;YACrB,gBAAgB,EAAE;gBAChB,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;aACzD;SACF;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,2CAA2C;IAC3C,IAAI,eAAe,IAAI,QAAQ,CAAC,uBAAuB,EAAE,CAAC;QACxD,IAAI,CAAC;YACF,QAAoC,CAAC,uBAAuB,GAAG,IAAA,uBAAO,EACrE,QAAQ,CAAC,uBAAuB,CACjC,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,0CAA0C;QAC5C,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AA4GM,KAAK,UAAU,cAAc,CAAC,IAAwB;IAC3D,MAAM,EACJ,aAAa,EACb,eAAe,EACf,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,cAAc,EACd,GAAG,YAAY,EAChB,GAAG,IAAI,CAAC;IAET,+BAA+B;IAC/B,MAAM,uBAAuB,GAAG,cAAc;QAC5C,CAAC,CAAC,IAAA,uBAAO,EAAC,cAAc,CAAC;QACzB,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC5C,IAAI,EAAE;YACJ,GAAG,YAAY;YACf,cAAc,EAAE,IAAA,mCAAsB,EAAC,IAAI,CAAC,IAAI,CAAC;YACjD,uBAAuB;YACvB,GAAG,CAAC,aAAa,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC7D,CAAC,CAAC,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE;gBAC9C,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,eAAe,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBAClE,CAAC,CAAC;oBACE,eAAe,EAAE;wBACf,MAAM,EAAE;4BACN,aAAa,EAAE,eAAe,CAAC,aAAa;4BAC5C,WAAW,EAAE,eAAe,CAAC,WAAW;4BACxC,WAAW,EAAE,eAAe,CAAC,WAAW;4BACxC,kBAAkB,EAAE,eAAe,CAAC,kBAAkB;4BACtD,gBAAgB,EAAE,eAAe,CAAC,gBAAgB;4BAClD,gBAAgB,EAAE,eAAe,CAAC,gBAAgB;4BAClD,yBAAyB,EAAE,eAAe,CAAC,gBAAgB;gCACzD,CAAC,CAAC,IAAA,uBAAO,EAAC,eAAe,CAAC,gBAAgB,CAAC;gCAC3C,CAAC,CAAC,SAAS;4BACb,MAAM,EAAE,eAAe,CAAC,MAAM;4BAC9B,cAAc,EAAE,eAAe,CAAC,cAAc;4BAC9C,YAAY,EAAE,eAAe,CAAC,YAAY,IAAI,eAAe,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;gCACnF,CAAC,CAAC;oCACE,MAAM,EAAE,eAAe,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;wCAChD,WAAW,EAAE,EAAE,CAAC,WAAW;wCAC3B,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK;wCAC1B,WAAW,EAAE,EAAE,CAAC,WAAW;wCAC3B,oBAAoB,EAAE,EAAE,CAAC,WAAW;4CAClC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,WAAW,CAAC;4CACzB,CAAC,CAAC,SAAS;wCACb,SAAS,EAAE,EAAE,CAAC,SAAS;qCACxB,CAAC,CAAC;iCACJ;gCACH,CAAC,CAAC,SAAS;yBACd;qBACF;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;gBACzC,CAAC,CAAC;oBACE,aAAa,EAAE;wBACb,MAAM,EAAE;4BACN,gBAAgB,EAAE,aAAa,CAAC,gBAAgB;4BAChD,UAAU,EAAE,aAAa,CAAC,UAAU;4BACpC,eAAe,EAAE,aAAa,CAAC,eAAe;4BAC9C,WAAW,EAAE,aAAa,CAAC,WAAW;4BACtC,WAAW,EAAE,aAAa,CAAC,WAAW;4BACtC,UAAU,EAAE,aAAa,CAAC,UAAU;4BACpC,WAAW,EAAE,aAAa,CAAC,WAAW;4BACtC,aAAa,EAAE,aAAa,CAAC,aAAa;4BAC1C,QAAQ,EAAE,aAAa,CAAC,QAAQ;gCAC9B,CAAC,CAAC;oCACE,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;wCAC1C,WAAW,EAAE,EAAE,CAAC,WAAW;wCAC3B,aAAa,EAAE,EAAE,CAAC,aAAa;wCAC/B,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;wCACzC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;wCACzC,UAAU,EAAE,EAAE,CAAC,UAAU,IAAI,KAAK;wCAClC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK;qCAC3B,CAAC,CAAC;iCACJ;gCACH,CAAC,CAAC,SAAS;yBACd;qBACF;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI;gBACjC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;gBACtC,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,mBAAmB,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe;gBACtD,CAAC,CAAC,EAAE,mBAAmB,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE;gBAC1D,CAAC,CAAC,EAAE,CAAC;SACR;QACD,OAAO,EAAE;YACP,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;YACb,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,IAAI;YACnB,aAAa,EAAE,IAAI;YACnB,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE;YACpD,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;YAC9C,SAAS,EAAE,IAAI;YACf,mBAAmB,EAAE,IAAI;SAC1B;KACF,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAEM,KAAK,UAAU,cAAc,CAClC,EAAU,EACV,IAAiC;IAEjC,MAAM,EACJ,aAAa,EACb,eAAe,EACf,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,cAAc,EACd,GAAG,YAAY,EAChB,GAAG,IAAI,CAAC;IAET,+BAA+B;IAC/B,MAAM,uBAAuB,GAAG,cAAc;QAC5C,CAAC,CAAC,IAAA,uBAAO,EAAC,cAAc,CAAC;QACzB,CAAC,CAAC,SAAS,CAAC;IAEd,uBAAuB;IACvB,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC3B,KAAK,EAAE,EAAE,EAAE,EAAE;QACb,IAAI,EAAE;YACJ,GAAG,YAAY;YACf,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChE;KACF,CAAC,CAAC;IAEH,+BAA+B;IAC/B,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC;YACxC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;YACzB,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,GAAG,aAAa,EAAE;SAC7C,CAAC,CAAC;IACL,CAAC;IAED,IAAI,eAAe,EAAE,CAAC;QACpB,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,YAAY,EAAE,GAAG,eAAe,CAAC;QAC5E,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,UAAU,CAAC;YAC/D,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;YACzB,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;SAChC,CAAC,CAAC;QAEH,wCAAwC;QACxC,MAAM,oBAAoB,GAAG;YAC3B,aAAa,EAAE,YAAY,CAAC,aAAa;YACzC,WAAW,EAAE,YAAY,CAAC,WAAW;YACrC,WAAW,EAAE,YAAY,CAAC,WAAW;YACrC,kBAAkB,EAAE,YAAY,CAAC,kBAAkB;YACnD,gBAAgB,EAAE,YAAY,CAAC,gBAAgB;YAC/C,gBAAgB,EAAE,YAAY,CAAC,gBAAgB;YAC/C,sEAAsE;YACtE,GAAG,CAAC,gBAAgB;gBAClB,CAAC,CAAC,EAAE,yBAAyB,EAAE,IAAA,uBAAO,EAAC,gBAAgB,CAAC,EAAE;gBAC1D,CAAC,CAAC,EAAE,CAAC;YACP,MAAM,EAAE,YAAY,CAAC,MAAM;YAC3B,cAAc,EAAE,YAAY,CAAC,cAAc;SAC5C,CAAC;QAEF,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAC;gBAC1C,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;gBACzB,IAAI,EAAE,oBAAoB;aAC3B,CAAC,CAAC;YAEH,IAAI,YAAY,EAAE,CAAC;gBACjB,gEAAgE;gBAChE,MAAM,oBAAoB,GAAG,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC;gBAEzD,oCAAoC;gBACpC,MAAM,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC;oBAClC,KAAK,EAAE,EAAE,yBAAyB,EAAE,QAAQ,CAAC,EAAE,EAAE;iBAClD,CAAC,CAAC;gBAEH,2CAA2C;gBAC3C,MAAM,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC;oBAClC,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;wBAC5B,6DAA6D;wBAC7D,MAAM,UAAU,GAAG,EAAE,CAAC,EAAE;4BACtB,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;4BAClD,CAAC,CAAC,SAAS,CAAC;wBAEd,OAAO;4BACL,yBAAyB,EAAE,QAAQ,CAAC,EAAE;4BACtC,WAAW,EAAE,EAAE,CAAC,WAAW;4BAC3B,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK;4BAC1B,WAAW,EAAE,EAAE,CAAC,WAAW;4BAC3B,yDAAyD;4BACzD,oBAAoB,EAAE,EAAE,CAAC,WAAW;gCAClC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,WAAW,CAAC;gCACzB,CAAC,CAAC,UAAU,EAAE,oBAAoB,IAAI,SAAS;4BACjD,SAAS,EAAE,EAAE,CAAC,SAAS;yBACxB,CAAC;oBACJ,CAAC,CAAC;iBACH,CAAC,CAAC;YACL,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAC;gBAC1C,IAAI,EAAE;oBACJ,UAAU,EAAE,EAAE;oBACd,GAAG,oBAAoB;oBACvB,GAAG,CAAC,gBAAgB;wBAClB,CAAC,CAAC,EAAE,yBAAyB,EAAE,IAAA,uBAAO,EAAC,gBAAgB,CAAC,EAAE;wBAC1D,CAAC,CAAC,EAAE,CAAC;oBACP,YAAY,EAAE,YAAY;wBACxB,CAAC,CAAC;4BACE,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gCAChC,WAAW,EAAE,EAAE,CAAC,WAAW;gCAC3B,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK;gCAC1B,WAAW,EAAE,EAAE,CAAC,WAAW;gCAC3B,oBAAoB,EAAE,EAAE,CAAC,WAAW;oCAClC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,WAAW,CAAC;oCACzB,CAAC,CAAC,SAAS;gCACb,SAAS,EAAE,EAAE,CAAC,SAAS;6BACxB,CAAC,CAAC;yBACJ;wBACH,CAAC,CAAC,SAAS;iBACd;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,aAAa,CAAC;QAClD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,UAAU,CAAC;YAC7D,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;SAC1B,CAAC,CAAC;QAEH,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC;gBACxC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;gBACzB,IAAI,EAAE,UAAU;aACjB,CAAC,CAAC;YAEH,IAAI,QAAQ,EAAE,CAAC;gBACb,6DAA6D;gBAC7D,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;oBACrD,KAAK,EAAE,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,EAAE;iBACxC,CAAC,CAAC;gBACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;gBAE5E,4BAA4B;gBAC5B,MAAM,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;oBAC9B,KAAK,EAAE,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,EAAE;iBACxC,CAAC,CAAC;gBAEH,2DAA2D;gBAC3D,MAAM,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;oBAC9B,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;wBACxB,MAAM,UAAU,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;wBACrE,OAAO;4BACL,eAAe,EAAE,QAAQ,CAAC,EAAE;4BAC5B,WAAW,EAAE,EAAE,CAAC,WAAW;4BAC3B,aAAa,EAAE,EAAE,CAAC,aAAa;4BAC/B,qDAAqD;4BACrD,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,GAAG,IAAI,SAAS,CAAC;4BAC9D,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,GAAG,IAAI,SAAS,CAAC;4BAC9D,UAAU,EAAE,EAAE,CAAC,UAAU,IAAI,KAAK;4BAClC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK;yBAC3B,CAAC;oBACJ,CAAC,CAAC;iBACH,CAAC,CAAC;YACL,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC;gBACxC,IAAI,EAAE;oBACJ,UAAU,EAAE,EAAE;oBACd,GAAG,UAAU;oBACb,QAAQ,EAAE,QAAQ;wBAChB,CAAC,CAAC;4BACE,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gCAC5B,WAAW,EAAE,EAAE,CAAC,WAAW;gCAC3B,aAAa,EAAE,EAAE,CAAC,aAAa;gCAC/B,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;gCACzC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;gCACzC,UAAU,EAAE,EAAE,CAAC,UAAU,IAAI,KAAK;gCAClC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK;6BAC3B,CAAC,CAAC;yBACJ;wBACH,CAAC,CAAC,SAAS;iBACd;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC;YACpC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;YACzB,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,GAAG,SAAS,EAAE;SACzC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,mBAAmB,EAAE,CAAC;QACxB,MAAM,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC;YACtC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;YACzB,MAAM,EAAE,mBAAmB;YAC3B,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,GAAG,mBAAmB,EAAE;SACnD,CAAC,CAAC;IACL,CAAC;IAED,OAAO,eAAe,CAAC,EAAE,CAAC,CAAC;AAC7B,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,EAAU;IAC7C,uCAAuC;IACvC,yEAAyE;IAEzE,+DAA+D;IAC/D,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;QACxD,KAAK,EAAE,EAAE,EAAE,EAAE;QACb,MAAM,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE;KACrC,CAAC,CAAC;IAEH,yEAAyE;IACzE,wDAAwD;IACxD,MAAM,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC/B,KAAK,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE;QACjC,IAAI,EAAE,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,kBAAkB,IAAI,IAAI,EAAE;KAC3E,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AACnD,CAAC;AAEM,KAAK,UAAU,sBAAsB,CAAC,kBAA0B;IACrE,MAAM,gBAAgB,GAAG,MAAM,eAAe,CAAC,kBAAkB,CAAC,CAAC;IACnE,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,+CAA+C;IAC/C,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACvD,KAAK,EAAE,EAAE,kBAAkB,EAAE;QAC7B,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE;KAC3C,CAAC,CAAC;IACH,IAAI,gBAAgB,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,0CAA0C,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED,6DAA6D;IAC7D,MAAM,eAAe,GAAuB;QAC1C,UAAU,EAAE,gBAAgB,CAAC,UAAU;QACvC,IAAI,EAAE,gBAAgB,CAAC,IAAI;QAC3B,MAAM,EAAE,OAAO;QACf,SAAS,EAAE,gBAAgB,CAAC,SAAS,IAAI,SAAS;QAClD,UAAU,EAAE,gBAAgB,CAAC,UAAU,IAAI,SAAS;QACpD,kBAAkB,EAAE,gBAAgB,CAAC,kBAAkB,IAAI,SAAS;QACpE,eAAe,EAAE,gBAAgB,CAAC,eAAe,IAAI,SAAS;QAC9D,kBAAkB,EAAE,gBAAgB,CAAC,EAAE;QACvC,iGAAiG;QACjG,oBAAoB,EAAE,gBAAgB,CAAC,oBAAoB,IAAI,SAAS;QACxE,kBAAkB,EAAE,gBAAgB,CAAC,kBAAkB,IAAI,SAAS;QACpE,KAAK,EAAE,mBAAmB,gBAAgB,CAAC,cAAc,EAAE;KAC5D,CAAC;IAEF,mDAAmD;IACnD,IAAI,gBAAgB,CAAC,aAAa,EAAE,CAAC;QACnC,eAAe,CAAC,aAAa,GAAG;YAC9B,OAAO,EAAE,gBAAgB,CAAC,aAAa,CAAC,OAAO,IAAI,SAAS;YAC5D,iBAAiB,EACf,gBAAgB,CAAC,aAAa,CAAC,iBAAiB,IAAI,SAAS;YAC/D,SAAS,EAAE,gBAAgB,CAAC,aAAa,CAAC,SAAS,IAAI,SAAS;YAChE,SAAS,EAAE,gBAAgB,CAAC,aAAa,CAAC,SAAS,IAAI,SAAS;YAChE,KAAK,EAAE,gBAAgB,CAAC,aAAa,CAAC,KAAK,IAAI,SAAS;YACxD,oBAAoB,EAAE,gBAAgB,CAAC,YAAY,IAAI,SAAS;YAChE,sBAAsB,EACpB,gBAAgB,CAAC,wBAAwB,IAAI,SAAS;SACzD,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,CAAC,eAAe,EAAE,CAAC;QACrC,eAAe,CAAC,eAAe,GAAG;YAChC,aAAa,EACX,gBAAgB,CAAC,eAAe,CAAC,aAAa,IAAI,SAAS;YAC7D,WAAW,EAAE,gBAAgB,CAAC,eAAe,CAAC,WAAW,IAAI,SAAS;YACtE,WAAW,EAAE,gBAAgB,CAAC,eAAe,CAAC,WAAW,IAAI,SAAS;YACtE,kBAAkB,EAChB,gBAAgB,CAAC,eAAe,CAAC,kBAAkB,IAAI,SAAS;YAClE,YAAY,EAAE,gBAAgB,CAAC,eAAe,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBACvE,WAAW,EAAE,EAAE,CAAC,WAAW;gBAC3B,MAAM,EAAE,EAAE,CAAC,MAAM;aAClB,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,CAAC,aAAa,EAAE,CAAC;QACnC,eAAe,CAAC,aAAa,GAAG;YAC9B,gBAAgB,EAAE,gBAAgB,CAAC,aAAa,CAAC,gBAAgB,IAAI,SAAS;YAC9E,UAAU,EAAE,gBAAgB,CAAC,aAAa,CAAC,UAAU,IAAI,SAAS;YAClE,eAAe,EACb,gBAAgB,CAAC,aAAa,CAAC,eAAe,IAAI,SAAS;YAC7D,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,WAAW,IAAI,SAAS;YACpE,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,WAAW,IAAI,SAAS;YACpE,UAAU,EAAE,gBAAgB,CAAC,aAAa,CAAC,UAAU,IAAI,SAAS;YAClE,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,WAAW,IAAI,SAAS;YACpE,aAAa,EAAE,gBAAgB,CAAC,aAAa,CAAC,aAAa,IAAI,SAAS;YACxE,2CAA2C;YAC3C,QAAQ,EAAE,gBAAgB,CAAC,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC9D,WAAW,EAAE,EAAE,CAAC,WAAW,IAAI,SAAS;gBACxC,aAAa,EAAE,EAAE,CAAC,aAAa,IAAI,SAAS;gBAC5C,UAAU,EAAE,EAAE,CAAC,UAAU;gBACzB,MAAM,EAAE,EAAE,CAAC,MAAM;aAClB,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,CAAC,SAAS,EAAE,CAAC;QAC/B,eAAe,CAAC,SAAS,GAAG;YAC1B,aAAa,EAAE,gBAAgB,CAAC,SAAS,CAAC,aAAa,IAAI,SAAS;YACpE,eAAe,EACb,gBAAgB,CAAC,SAAS,CAAC,eAAe,IAAI,SAAS;YACzD,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,OAAO,IAAI,SAAS;SACzD,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,CAAC,mBAAmB,EAAE,CAAC;QACzC,eAAe,CAAC,mBAAmB,GAAG;YACpC,YAAY,EACV,gBAAgB,CAAC,mBAAmB,CAAC,YAAY,IAAI,SAAS;YAChE,GAAG,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,GAAG,IAAI,SAAS;YAC1D,GAAG,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,GAAG,IAAI,SAAS;YAC1D,GAAG,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,GAAG,IAAI,SAAS;YAC1D,WAAW,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,WAAW,IAAI,SAAS;YAC1E,iBAAiB,EACf,gBAAgB,CAAC,mBAAmB,CAAC,iBAAiB,IAAI,SAAS;YACrE,aAAa,EACX,gBAAgB,CAAC,mBAAmB,CAAC,aAAa,IAAI,SAAS;YACjE,aAAa,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,aAAa;YACjE,iBAAiB,EACf,gBAAgB,CAAC,mBAAmB,CAAC,iBAAiB,IAAI,SAAS;YACrE,cAAc,EACZ,gBAAgB,CAAC,mBAAmB,CAAC,cAAc,IAAI,SAAS;YAClE,eAAe,EAAE,gBAAgB,CAAC,YAAY,IAAI,SAAS;SAC5D,CAAC;IACJ,CAAC;IAED,OAAO,cAAc,CAAC,eAAe,CAAC,CAAC;AACzC,CAAC;AAED,+BAA+B;AACxB,KAAK,UAAU,mBAAmB,CAAC,EAAU;IAClD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;QAChD,KAAK,EAAE,EAAE,EAAE,EAAE;QACb,MAAM,EAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE;KAC1C,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,uBAAuB;QAAE,OAAO,IAAI,CAAC;IAEpD,IAAI,CAAC;QACH,OAAO,IAAA,uBAAO,EAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,0BAA0B;AACnB,KAAK,UAAU,qBAAqB,CAAC,SAAiB;IAC3D,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;QAC9C,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE;QACxB,MAAM,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE;KACjC,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IAE9C,IAAI,CAAC;QACH,OAAO;YACL,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;YAC9C,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;SAC/C,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IAClC,CAAC;AACH,CAAC;AAED,4BAA4B;AACrB,KAAK,UAAU,sBAAsB,CAAC,UAAkB;IAC7D,MAAM,eAAe,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,UAAU,CAAC;QACtE,KAAK,EAAE,EAAE,UAAU,EAAE;QACrB,MAAM,EAAE,EAAE,yBAAyB,EAAE,IAAI,EAAE;KAC5C,CAAC,CAAC;IAEH,IAAI,CAAC,eAAe,EAAE,yBAAyB;QAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAE3E,IAAI,CAAC;QACH,OAAO;YACL,QAAQ,EAAE,IAAA,uBAAO,EAAC,eAAe,CAAC,yBAAyB,CAAC;SAC7D,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,0CAA0C;AACnC,KAAK,UAAU,iBAAiB,CAAC,aAAqB;IAC3D,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC;QACtD,KAAK,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE;QAC5B,MAAM,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE;KACvC,CAAC,CAAC;IAEH,IAAI,CAAC,WAAW,EAAE,oBAAoB;QAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAElE,IAAI,CAAC;QACH,OAAO;YACL,QAAQ,EAAE,IAAA,uBAAO,EAAC,WAAW,CAAC,oBAAoB,CAAC;SACpD,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC;AAuBD;;;;GAIG;AACI,KAAK,UAAU,0BAA0B,CAAC,UAAkB;IACjE,qDAAqD;IACrD,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAClD,KAAK,EAAE;YACL,UAAU;YACV,MAAM,EAAE,EAAE,GAAG,EAAE,uBAAc,CAAC,WAAW,EAAE;SAC5C;QACD,MAAM,EAAE;YACN,EAAE,EAAE,IAAI;YACR,cAAc,EAAE,IAAI;YACpB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,IAAI;YAChB,kBAAkB,EAAE,IAAI;YACxB,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;YAC9C,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;YAC5C,gBAAgB,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;SACvD;QACD,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;KACxD,CAAC,CAAC;IAEH,oDAAoD;IACpD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9D,oDAAoD;IACpD,MAAM,cAAc,GAAG,IAAI,GAAG,CAC5B,YAAY;SACT,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,KAAK,IAAI,CAAC;SAC1C,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAmB,CAAC,CACnC,CAAC;IAEF,wDAAwD;IACxD,0EAA0E;IAC1E,MAAM,aAAa,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE1E,kDAAkD;IAClD,SAAS,qBAAqB,CAAC,UAAyB;QACtD,IAAI,UAAU,KAAK,IAAI;YAAE,OAAO,EAAE,CAAC;QAEnC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,CAAC;QAEzB,MAAM,YAAY,GAAG,qBAAqB,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QAExE,OAAO,CAAC;gBACN,QAAQ;gBACR,YAAY;gBACZ,UAAU,EAAE,YAAY,CAAC,MAAM,GAAG,CAAC;aACpC,CAAC,CAAC;IACL,CAAC;IAED,gDAAgD;IAChD,MAAM,IAAI,GAAuB,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QAC5D,MAAM,YAAY,GAAG,qBAAqB,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QACxE,OAAO;YACL,QAAQ;YACR,YAAY;YACZ,UAAU,EAAE,YAAY,CAAC,MAAM,GAAG,CAAC;SACpC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC"} \ No newline at end of file +{"version":3,"file":"contract.service.js","sourceRoot":"","sources":["../../src/services/contract.service.ts"],"names":[],"mappings":";;AAgBA,0CA2FC;AAED,0CAmDC;AA4GD,wCAyGC;AAED,wCA2MC;AAED,wCAkBC;AAED,wDAiHC;AAGD,kDAaC;AAGD,sDAgBC;AAGD,wDAeC;AAGD,8CAeC;AA4BD,gEAiEC;AA72BD,2CAA4E;AAC5E,oDAAgG;AAChG,0DAA0D;AAE1D,MAAM,MAAM,GAAG,IAAI,qBAAY,EAAE,CAAC;AAY3B,KAAK,UAAU,eAAe,CAAC,OAAwB;IAC5D,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IACxF,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAA,qBAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAE7C,MAAM,KAAK,GAA4B,EAAE,CAAC;IAE1C,6EAA6E;IAC7E,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,KAAK,CAAC,UAAU,GAAG,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC;IACzC,CAAC;SAAM,IAAI,UAAU,EAAE,CAAC;QACtB,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC;IAChC,CAAC;IACD,IAAI,IAAI;QAAE,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;IAE5B,gEAAgE;IAChE,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACxB,CAAC;SAAM,CAAC;QACN,mEAAmE;QACnE,KAAK,CAAC,MAAM,GAAG,EAAE,GAAG,EAAE,uBAAc,CAAC,WAAW,EAAE,CAAC;IACrD,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,CAAC,EAAE,GAAG;YACT,uBAAuB;YACvB,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;YACxC,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;YACtC,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;YACpC,EAAE,wBAAwB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;YAClD,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YAC5C,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YAC1C,aAAa;YACb,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACjD,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YAChD,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACnD,EAAE,QAAQ,EAAE,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACtD,2BAA2B;YAC3B,EAAE,eAAe,EAAE,EAAE,kBAAkB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACjE,EAAE,eAAe,EAAE,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACrD,EAAE,eAAe,EAAE,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YAC7D,EAAE,eAAe,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE;YACtF,4BAA4B;YAC5B,EAAE,aAAa,EAAE,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACxD,EAAE,aAAa,EAAE,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YAC1D,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACvD,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE;YAChF,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE;YAClF,yCAAyC;YACzC,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE;YACnE,qBAAqB;YACrB,EAAE,SAAS,EAAE,EAAE,eAAe,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACxD,mBAAmB;YACnB,EAAE,mBAAmB,EAAE,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YAC/D,EAAE,mBAAmB,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YACtD,EAAE,mBAAmB,EAAE,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;SAChE,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC3C,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACvB,KAAK;YACL,IAAI;YACJ,IAAI;YACJ,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;YAChC,OAAO,EAAE;gBACP,QAAQ,EAAE;oBACR,MAAM,EAAE;wBACN,EAAE,EAAE,IAAI;wBACR,cAAc,EAAE,IAAI;wBACpB,SAAS,EAAE,IAAI;wBACf,QAAQ,EAAE,IAAI;wBACd,WAAW,EAAE,IAAI;qBAClB;iBACF;gBACD,OAAO,EAAE,IAAI;gBACb,cAAc,EAAE,IAAI;gBACpB,aAAa,EAAE,IAAI;gBACnB,kBAAkB,EAAE,IAAI;gBACxB,gBAAgB,EAAE,IAAI;gBACtB,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,IAAI;gBACZ,gBAAgB,EAAE,IAAI;aACvB;SACF,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;KACjC,CAAC,CAAC;IAEH,OAAO;QACL,SAAS;QACT,UAAU,EAAE,IAAA,oCAAuB,EAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC;KACxD,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,eAAe,CAAC,EAAU,EAAE,eAAe,GAAG,KAAK;IACvE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;QAChD,KAAK,EAAE,EAAE,EAAE,EAAE;QACb,OAAO,EAAE;YACP,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;YACb,cAAc,EAAE,IAAI;YACpB,QAAQ,EAAE,IAAI;YACd,gBAAgB,EAAE,IAAI;YACtB,aAAa,EAAE,IAAI;YACnB,kBAAkB,EAAE,IAAI;YACxB,gBAAgB,EAAE,IAAI;YACtB,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI;YACZ,gBAAgB,EAAE,IAAI;YACtB,gBAAgB,EAAE,IAAI;YACtB,gBAAgB,EAAE;gBAChB,OAAO,EAAE;oBACP,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;oBACtF,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE;oBACpD,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;oBAC9C,SAAS,EAAE,IAAI;oBACf,mBAAmB,EAAE,IAAI;iBAC1B;aACF;YACD,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;YACtF,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE;YACpD,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;YAC9C,SAAS,EAAE,IAAI;YACf,mBAAmB,EAAE,IAAI;YACzB,eAAe,EAAE,IAAI;YACrB,gBAAgB,EAAE;gBAChB,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;aACzD;SACF;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,2CAA2C;IAC3C,IAAI,eAAe,IAAI,QAAQ,CAAC,uBAAuB,EAAE,CAAC;QACxD,IAAI,CAAC;YACF,QAAoC,CAAC,uBAAuB,GAAG,IAAA,uBAAO,EACrE,QAAQ,CAAC,uBAAuB,CACjC,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,0CAA0C;QAC5C,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AA4GM,KAAK,UAAU,cAAc,CAAC,IAAwB;IAC3D,MAAM,EACJ,aAAa,EACb,eAAe,EACf,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,cAAc,EACd,GAAG,YAAY,EAChB,GAAG,IAAI,CAAC;IAET,+BAA+B;IAC/B,MAAM,uBAAuB,GAAG,cAAc;QAC5C,CAAC,CAAC,IAAA,uBAAO,EAAC,cAAc,CAAC;QACzB,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC5C,IAAI,EAAE;YACJ,GAAG,YAAY;YACf,cAAc,EAAE,IAAA,mCAAsB,EAAC,IAAI,CAAC,IAAI,CAAC;YACjD,uBAAuB;YACvB,GAAG,CAAC,aAAa,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC7D,CAAC,CAAC,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE;gBAC9C,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,eAAe,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBAClE,CAAC,CAAC;oBACE,eAAe,EAAE;wBACf,MAAM,EAAE;4BACN,aAAa,EAAE,eAAe,CAAC,aAAa;4BAC5C,WAAW,EAAE,eAAe,CAAC,WAAW;4BACxC,WAAW,EAAE,eAAe,CAAC,WAAW;4BACxC,kBAAkB,EAAE,eAAe,CAAC,kBAAkB;4BACtD,gBAAgB,EAAE,eAAe,CAAC,gBAAgB;4BAClD,gBAAgB,EAAE,eAAe,CAAC,gBAAgB;4BAClD,yBAAyB,EAAE,eAAe,CAAC,gBAAgB;gCACzD,CAAC,CAAC,IAAA,uBAAO,EAAC,eAAe,CAAC,gBAAgB,CAAC;gCAC3C,CAAC,CAAC,SAAS;4BACb,MAAM,EAAE,eAAe,CAAC,MAAM;4BAC9B,cAAc,EAAE,eAAe,CAAC,cAAc;4BAC9C,YAAY,EAAE,eAAe,CAAC,YAAY,IAAI,eAAe,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;gCACnF,CAAC,CAAC;oCACE,MAAM,EAAE,eAAe,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;wCAChD,WAAW,EAAE,EAAE,CAAC,WAAW;wCAC3B,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK;wCAC1B,WAAW,EAAE,EAAE,CAAC,WAAW;wCAC3B,oBAAoB,EAAE,EAAE,CAAC,WAAW;4CAClC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,WAAW,CAAC;4CACzB,CAAC,CAAC,SAAS;wCACb,SAAS,EAAE,EAAE,CAAC,SAAS;qCACxB,CAAC,CAAC;iCACJ;gCACH,CAAC,CAAC,SAAS;yBACd;qBACF;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;gBACzC,CAAC,CAAC;oBACE,aAAa,EAAE;wBACb,MAAM,EAAE;4BACN,gBAAgB,EAAE,aAAa,CAAC,gBAAgB;4BAChD,UAAU,EAAE,aAAa,CAAC,UAAU;4BACpC,eAAe,EAAE,aAAa,CAAC,eAAe;4BAC9C,WAAW,EAAE,aAAa,CAAC,WAAW;4BACtC,WAAW,EAAE,aAAa,CAAC,WAAW;4BACtC,UAAU,EAAE,aAAa,CAAC,UAAU;4BACpC,WAAW,EAAE,aAAa,CAAC,WAAW;4BACtC,aAAa,EAAE,aAAa,CAAC,aAAa;4BAC1C,QAAQ,EAAE,aAAa,CAAC,QAAQ;gCAC9B,CAAC,CAAC;oCACE,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;wCAC1C,WAAW,EAAE,EAAE,CAAC,WAAW;wCAC3B,aAAa,EAAE,EAAE,CAAC,aAAa;wCAC/B,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;wCACzC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;wCACzC,UAAU,EAAE,EAAE,CAAC,UAAU,IAAI,KAAK;wCAClC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK;qCAC3B,CAAC,CAAC;iCACJ;gCACH,CAAC,CAAC,SAAS;yBACd;qBACF;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI;gBACjC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;gBACtC,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,mBAAmB,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe;gBACtD,CAAC,CAAC,EAAE,mBAAmB,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE;gBAC1D,CAAC,CAAC,EAAE,CAAC;SACR;QACD,OAAO,EAAE;YACP,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;YACb,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,IAAI;YACnB,aAAa,EAAE,IAAI;YACnB,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE;YACpD,aAAa,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;YAC9C,SAAS,EAAE,IAAI;YACf,mBAAmB,EAAE,IAAI;SAC1B;KACF,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAEM,KAAK,UAAU,cAAc,CAClC,EAAU,EACV,IAAiC;IAEjC,MAAM,EACJ,aAAa,EACb,eAAe,EACf,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,cAAc,EACd,GAAG,YAAY,EAChB,GAAG,IAAI,CAAC;IAET,+BAA+B;IAC/B,MAAM,uBAAuB,GAAG,cAAc;QAC5C,CAAC,CAAC,IAAA,uBAAO,EAAC,cAAc,CAAC;QACzB,CAAC,CAAC,SAAS,CAAC;IAEd,uBAAuB;IACvB,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC3B,KAAK,EAAE,EAAE,EAAE,EAAE;QACb,IAAI,EAAE;YACJ,GAAG,YAAY;YACf,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChE;KACF,CAAC,CAAC;IAEH,+BAA+B;IAC/B,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC;YACxC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;YACzB,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,GAAG,aAAa,EAAE;SAC7C,CAAC,CAAC;IACL,CAAC;IAED,IAAI,eAAe,EAAE,CAAC;QACpB,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,YAAY,EAAE,GAAG,eAAe,CAAC;QAC5E,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,UAAU,CAAC;YAC/D,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;YACzB,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;SAChC,CAAC,CAAC;QAEH,wCAAwC;QACxC,MAAM,oBAAoB,GAAG;YAC3B,aAAa,EAAE,YAAY,CAAC,aAAa;YACzC,WAAW,EAAE,YAAY,CAAC,WAAW;YACrC,WAAW,EAAE,YAAY,CAAC,WAAW;YACrC,kBAAkB,EAAE,YAAY,CAAC,kBAAkB;YACnD,gBAAgB,EAAE,YAAY,CAAC,gBAAgB;YAC/C,gBAAgB,EAAE,YAAY,CAAC,gBAAgB;YAC/C,sEAAsE;YACtE,GAAG,CAAC,gBAAgB;gBAClB,CAAC,CAAC,EAAE,yBAAyB,EAAE,IAAA,uBAAO,EAAC,gBAAgB,CAAC,EAAE;gBAC1D,CAAC,CAAC,EAAE,CAAC;YACP,MAAM,EAAE,YAAY,CAAC,MAAM;YAC3B,cAAc,EAAE,YAAY,CAAC,cAAc;SAC5C,CAAC;QAEF,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAC;gBAC1C,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;gBACzB,IAAI,EAAE,oBAAoB;aAC3B,CAAC,CAAC;YAEH,IAAI,YAAY,EAAE,CAAC;gBACjB,gEAAgE;gBAChE,MAAM,oBAAoB,GAAG,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC;gBAEzD,oCAAoC;gBACpC,MAAM,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC;oBAClC,KAAK,EAAE,EAAE,yBAAyB,EAAE,QAAQ,CAAC,EAAE,EAAE;iBAClD,CAAC,CAAC;gBAEH,2CAA2C;gBAC3C,MAAM,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC;oBAClC,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;wBAC5B,6DAA6D;wBAC7D,MAAM,UAAU,GAAG,EAAE,CAAC,EAAE;4BACtB,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;4BAClD,CAAC,CAAC,SAAS,CAAC;wBAEd,OAAO;4BACL,yBAAyB,EAAE,QAAQ,CAAC,EAAE;4BACtC,WAAW,EAAE,EAAE,CAAC,WAAW;4BAC3B,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK;4BAC1B,WAAW,EAAE,EAAE,CAAC,WAAW;4BAC3B,yDAAyD;4BACzD,oBAAoB,EAAE,EAAE,CAAC,WAAW;gCAClC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,WAAW,CAAC;gCACzB,CAAC,CAAC,UAAU,EAAE,oBAAoB,IAAI,SAAS;4BACjD,SAAS,EAAE,EAAE,CAAC,SAAS;yBACxB,CAAC;oBACJ,CAAC,CAAC;iBACH,CAAC,CAAC;YACL,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAC;gBAC1C,IAAI,EAAE;oBACJ,UAAU,EAAE,EAAE;oBACd,GAAG,oBAAoB;oBACvB,GAAG,CAAC,gBAAgB;wBAClB,CAAC,CAAC,EAAE,yBAAyB,EAAE,IAAA,uBAAO,EAAC,gBAAgB,CAAC,EAAE;wBAC1D,CAAC,CAAC,EAAE,CAAC;oBACP,YAAY,EAAE,YAAY;wBACxB,CAAC,CAAC;4BACE,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gCAChC,WAAW,EAAE,EAAE,CAAC,WAAW;gCAC3B,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK;gCAC1B,WAAW,EAAE,EAAE,CAAC,WAAW;gCAC3B,oBAAoB,EAAE,EAAE,CAAC,WAAW;oCAClC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,WAAW,CAAC;oCACzB,CAAC,CAAC,SAAS;gCACb,SAAS,EAAE,EAAE,CAAC,SAAS;6BACxB,CAAC,CAAC;yBACJ;wBACH,CAAC,CAAC,SAAS;iBACd;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,aAAa,CAAC;QAClD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,UAAU,CAAC;YAC7D,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;SAC1B,CAAC,CAAC;QAEH,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC;gBACxC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;gBACzB,IAAI,EAAE,UAAU;aACjB,CAAC,CAAC;YAEH,IAAI,QAAQ,EAAE,CAAC;gBACb,6DAA6D;gBAC7D,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;oBACrD,KAAK,EAAE,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,EAAE;iBACxC,CAAC,CAAC;gBACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;gBAE5E,4BAA4B;gBAC5B,MAAM,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;oBAC9B,KAAK,EAAE,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,EAAE;iBACxC,CAAC,CAAC;gBAEH,2DAA2D;gBAC3D,MAAM,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;oBAC9B,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;wBACxB,MAAM,UAAU,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;wBACrE,OAAO;4BACL,eAAe,EAAE,QAAQ,CAAC,EAAE;4BAC5B,WAAW,EAAE,EAAE,CAAC,WAAW;4BAC3B,aAAa,EAAE,EAAE,CAAC,aAAa;4BAC/B,qDAAqD;4BACrD,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,GAAG,IAAI,SAAS,CAAC;4BAC9D,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,GAAG,IAAI,SAAS,CAAC;4BAC9D,UAAU,EAAE,EAAE,CAAC,UAAU,IAAI,KAAK;4BAClC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK;yBAC3B,CAAC;oBACJ,CAAC,CAAC;iBACH,CAAC,CAAC;YACL,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC;gBACxC,IAAI,EAAE;oBACJ,UAAU,EAAE,EAAE;oBACd,GAAG,UAAU;oBACb,QAAQ,EAAE,QAAQ;wBAChB,CAAC,CAAC;4BACE,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gCAC5B,WAAW,EAAE,EAAE,CAAC,WAAW;gCAC3B,aAAa,EAAE,EAAE,CAAC,aAAa;gCAC/B,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;gCACzC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;gCACzC,UAAU,EAAE,EAAE,CAAC,UAAU,IAAI,KAAK;gCAClC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK;6BAC3B,CAAC,CAAC;yBACJ;wBACH,CAAC,CAAC,SAAS;iBACd;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC;YACpC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;YACzB,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,GAAG,SAAS,EAAE;SACzC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,mBAAmB,EAAE,CAAC;QACxB,MAAM,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC;YACtC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;YACzB,MAAM,EAAE,mBAAmB;YAC3B,MAAM,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,GAAG,mBAAmB,EAAE;SACnD,CAAC,CAAC;IACL,CAAC;IAED,OAAO,eAAe,CAAC,EAAE,CAAC,CAAC;AAC7B,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,EAAU;IAC7C,uCAAuC;IACvC,yEAAyE;IAEzE,+DAA+D;IAC/D,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;QACxD,KAAK,EAAE,EAAE,EAAE,EAAE;QACb,MAAM,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE;KACrC,CAAC,CAAC;IAEH,yEAAyE;IACzE,wDAAwD;IACxD,MAAM,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC/B,KAAK,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE;QACjC,IAAI,EAAE,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,kBAAkB,IAAI,IAAI,EAAE;KAC3E,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AACnD,CAAC;AAEM,KAAK,UAAU,sBAAsB,CAAC,kBAA0B;IACrE,MAAM,gBAAgB,GAAG,MAAM,eAAe,CAAC,kBAAkB,CAAC,CAAC;IACnE,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,+CAA+C;IAC/C,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACvD,KAAK,EAAE,EAAE,kBAAkB,EAAE;QAC7B,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE;KAC3C,CAAC,CAAC;IACH,IAAI,gBAAgB,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,0CAA0C,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED,6DAA6D;IAC7D,MAAM,eAAe,GAAuB;QAC1C,UAAU,EAAE,gBAAgB,CAAC,UAAU;QACvC,IAAI,EAAE,gBAAgB,CAAC,IAAI;QAC3B,MAAM,EAAE,OAAO;QACf,SAAS,EAAE,gBAAgB,CAAC,SAAS,IAAI,SAAS;QAClD,UAAU,EAAE,gBAAgB,CAAC,UAAU,IAAI,SAAS;QACpD,kBAAkB,EAAE,gBAAgB,CAAC,kBAAkB,IAAI,SAAS;QACpE,eAAe,EAAE,gBAAgB,CAAC,eAAe,IAAI,SAAS;QAC9D,kBAAkB,EAAE,gBAAgB,CAAC,EAAE;QACvC,iGAAiG;QACjG,oBAAoB,EAAE,gBAAgB,CAAC,oBAAoB,IAAI,SAAS;QACxE,kBAAkB,EAAE,gBAAgB,CAAC,kBAAkB,IAAI,SAAS;QACpE,sFAAsF;KACvF,CAAC;IAEF,mDAAmD;IACnD,IAAI,gBAAgB,CAAC,aAAa,EAAE,CAAC;QACnC,eAAe,CAAC,aAAa,GAAG;YAC9B,OAAO,EAAE,gBAAgB,CAAC,aAAa,CAAC,OAAO,IAAI,SAAS;YAC5D,iBAAiB,EACf,gBAAgB,CAAC,aAAa,CAAC,iBAAiB,IAAI,SAAS;YAC/D,SAAS,EAAE,gBAAgB,CAAC,aAAa,CAAC,SAAS,IAAI,SAAS;YAChE,SAAS,EAAE,gBAAgB,CAAC,aAAa,CAAC,SAAS,IAAI,SAAS;YAChE,KAAK,EAAE,gBAAgB,CAAC,aAAa,CAAC,KAAK,IAAI,SAAS;YACxD,oBAAoB,EAAE,gBAAgB,CAAC,YAAY,IAAI,SAAS;YAChE,sBAAsB,EACpB,gBAAgB,CAAC,wBAAwB,IAAI,SAAS;SACzD,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,CAAC,eAAe,EAAE,CAAC;QACrC,eAAe,CAAC,eAAe,GAAG;YAChC,aAAa,EACX,gBAAgB,CAAC,eAAe,CAAC,aAAa,IAAI,SAAS;YAC7D,WAAW,EAAE,gBAAgB,CAAC,eAAe,CAAC,WAAW,IAAI,SAAS;YACtE,WAAW,EAAE,gBAAgB,CAAC,eAAe,CAAC,WAAW,IAAI,SAAS;YACtE,kBAAkB,EAChB,gBAAgB,CAAC,eAAe,CAAC,kBAAkB,IAAI,SAAS;YAClE,YAAY,EAAE,gBAAgB,CAAC,eAAe,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBACvE,WAAW,EAAE,EAAE,CAAC,WAAW;gBAC3B,MAAM,EAAE,EAAE,CAAC,MAAM;aAClB,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,CAAC,aAAa,EAAE,CAAC;QACnC,eAAe,CAAC,aAAa,GAAG;YAC9B,gBAAgB,EAAE,gBAAgB,CAAC,aAAa,CAAC,gBAAgB,IAAI,SAAS;YAC9E,UAAU,EAAE,gBAAgB,CAAC,aAAa,CAAC,UAAU,IAAI,SAAS;YAClE,eAAe,EACb,gBAAgB,CAAC,aAAa,CAAC,eAAe,IAAI,SAAS;YAC7D,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,WAAW,IAAI,SAAS;YACpE,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,WAAW,IAAI,SAAS;YACpE,UAAU,EAAE,gBAAgB,CAAC,aAAa,CAAC,UAAU,IAAI,SAAS;YAClE,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,WAAW,IAAI,SAAS;YACpE,aAAa,EAAE,gBAAgB,CAAC,aAAa,CAAC,aAAa,IAAI,SAAS;YACxE,2CAA2C;YAC3C,QAAQ,EAAE,gBAAgB,CAAC,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC9D,WAAW,EAAE,EAAE,CAAC,WAAW,IAAI,SAAS;gBACxC,aAAa,EAAE,EAAE,CAAC,aAAa,IAAI,SAAS;gBAC5C,UAAU,EAAE,EAAE,CAAC,UAAU;gBACzB,MAAM,EAAE,EAAE,CAAC,MAAM;aAClB,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,CAAC,SAAS,EAAE,CAAC;QAC/B,eAAe,CAAC,SAAS,GAAG;YAC1B,aAAa,EAAE,gBAAgB,CAAC,SAAS,CAAC,aAAa,IAAI,SAAS;YACpE,eAAe,EACb,gBAAgB,CAAC,SAAS,CAAC,eAAe,IAAI,SAAS;YACzD,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,OAAO,IAAI,SAAS;SACzD,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,CAAC,mBAAmB,EAAE,CAAC;QACzC,eAAe,CAAC,mBAAmB,GAAG;YACpC,YAAY,EACV,gBAAgB,CAAC,mBAAmB,CAAC,YAAY,IAAI,SAAS;YAChE,GAAG,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,GAAG,IAAI,SAAS;YAC1D,GAAG,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,GAAG,IAAI,SAAS;YAC1D,GAAG,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,GAAG,IAAI,SAAS;YAC1D,WAAW,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,WAAW,IAAI,SAAS;YAC1E,iBAAiB,EACf,gBAAgB,CAAC,mBAAmB,CAAC,iBAAiB,IAAI,SAAS;YACrE,aAAa,EACX,gBAAgB,CAAC,mBAAmB,CAAC,aAAa,IAAI,SAAS;YACjE,aAAa,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,aAAa;YACjE,iBAAiB,EACf,gBAAgB,CAAC,mBAAmB,CAAC,iBAAiB,IAAI,SAAS;YACrE,cAAc,EACZ,gBAAgB,CAAC,mBAAmB,CAAC,cAAc,IAAI,SAAS;YAClE,eAAe,EAAE,gBAAgB,CAAC,YAAY,IAAI,SAAS;SAC5D,CAAC;IACJ,CAAC;IAED,OAAO,cAAc,CAAC,eAAe,CAAC,CAAC;AACzC,CAAC;AAED,+BAA+B;AACxB,KAAK,UAAU,mBAAmB,CAAC,EAAU;IAClD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;QAChD,KAAK,EAAE,EAAE,EAAE,EAAE;QACb,MAAM,EAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE;KAC1C,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,uBAAuB;QAAE,OAAO,IAAI,CAAC;IAEpD,IAAI,CAAC;QACH,OAAO,IAAA,uBAAO,EAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,0BAA0B;AACnB,KAAK,UAAU,qBAAqB,CAAC,SAAiB;IAC3D,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;QAC9C,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE;QACxB,MAAM,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE;KACjC,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IAE9C,IAAI,CAAC;QACH,OAAO;YACL,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;YAC9C,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,uBAAO,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;SAC/C,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IAClC,CAAC;AACH,CAAC;AAED,4BAA4B;AACrB,KAAK,UAAU,sBAAsB,CAAC,UAAkB;IAC7D,MAAM,eAAe,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,UAAU,CAAC;QACtE,KAAK,EAAE,EAAE,UAAU,EAAE;QACrB,MAAM,EAAE,EAAE,yBAAyB,EAAE,IAAI,EAAE;KAC5C,CAAC,CAAC;IAEH,IAAI,CAAC,eAAe,EAAE,yBAAyB;QAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAE3E,IAAI,CAAC;QACH,OAAO;YACL,QAAQ,EAAE,IAAA,uBAAO,EAAC,eAAe,CAAC,yBAAyB,CAAC;SAC7D,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,0CAA0C;AACnC,KAAK,UAAU,iBAAiB,CAAC,aAAqB;IAC3D,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC;QACtD,KAAK,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE;QAC5B,MAAM,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE;KACvC,CAAC,CAAC;IAEH,IAAI,CAAC,WAAW,EAAE,oBAAoB;QAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAElE,IAAI,CAAC;QACH,OAAO;YACL,QAAQ,EAAE,IAAA,uBAAO,EAAC,WAAW,CAAC,oBAAoB,CAAC;SACpD,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC;AAuBD;;;;GAIG;AACI,KAAK,UAAU,0BAA0B,CAAC,UAAkB;IACjE,qDAAqD;IACrD,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAClD,KAAK,EAAE;YACL,UAAU;YACV,MAAM,EAAE,EAAE,GAAG,EAAE,uBAAc,CAAC,WAAW,EAAE;SAC5C;QACD,MAAM,EAAE;YACN,EAAE,EAAE,IAAI;YACR,cAAc,EAAE,IAAI;YACpB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,IAAI;YAChB,kBAAkB,EAAE,IAAI;YACxB,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;YAC9C,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;YAC5C,gBAAgB,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;SACvD;QACD,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;KACxD,CAAC,CAAC;IAEH,oDAAoD;IACpD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9D,oDAAoD;IACpD,MAAM,cAAc,GAAG,IAAI,GAAG,CAC5B,YAAY;SACT,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,KAAK,IAAI,CAAC;SAC1C,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAmB,CAAC,CACnC,CAAC;IAEF,wDAAwD;IACxD,0EAA0E;IAC1E,MAAM,aAAa,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE1E,kDAAkD;IAClD,SAAS,qBAAqB,CAAC,UAAyB;QACtD,IAAI,UAAU,KAAK,IAAI;YAAE,OAAO,EAAE,CAAC;QAEnC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,CAAC;QAEzB,MAAM,YAAY,GAAG,qBAAqB,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QAExE,OAAO,CAAC;gBACN,QAAQ;gBACR,YAAY;gBACZ,UAAU,EAAE,YAAY,CAAC,MAAM,GAAG,CAAC;aACpC,CAAC,CAAC;IACL,CAAC;IAED,gDAAgD;IAChD,MAAM,IAAI,GAAuB,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QAC5D,MAAM,YAAY,GAAG,qBAAqB,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QACxE,OAAO;YACL,QAAQ;YACR,YAAY;YACZ,UAAU,EAAE,YAAY,CAAC,MAAM,GAAG,CAAC;SACpC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC"} \ No newline at end of file diff --git a/backend/node_modules/.prisma/client/edge.js b/backend/node_modules/.prisma/client/edge.js index 6d6be10f..a2ea39a2 100644 --- a/backend/node_modules/.prisma/client/edge.js +++ b/backend/node_modules/.prisma/client/edge.js @@ -411,6 +411,16 @@ exports.Prisma.ContractScalarFieldEnum = { updatedAt: 'updatedAt' }; +exports.Prisma.ContractHistoryEntryScalarFieldEnum = { + id: 'id', + contractId: 'contractId', + title: 'title', + description: 'description', + isAutomatic: 'isAutomatic', + createdBy: 'createdBy', + createdAt: 'createdAt' +}; + exports.Prisma.ContractTaskScalarFieldEnum = { id: 'id', contractId: 'contractId', @@ -644,6 +654,7 @@ exports.Prisma.ModelName = { Tariff: 'Tariff', ContractCategory: 'ContractCategory', Contract: 'Contract', + ContractHistoryEntry: 'ContractHistoryEntry', ContractTask: 'ContractTask', ContractTaskSubtask: 'ContractTaskSubtask', EnergyContractDetails: 'EnergyContractDetails', @@ -701,13 +712,13 @@ const config = { } } }, - "inlineSchema": "generator client {\n provider = \"prisma-client-js\"\n}\n\ndatasource db {\n provider = \"mysql\"\n url = env(\"DATABASE_URL\")\n}\n\n// ==================== APP SETTINGS ====================\n\nmodel AppSetting {\n id Int @id @default(autoincrement())\n key String @unique\n value String @db.Text\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== USERS & AUTH ====================\n\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n password String\n firstName String\n lastName String\n isActive Boolean @default(true)\n tokenInvalidatedAt DateTime? // Zeitpunkt ab dem alle Tokens ungültig sind (für Zwangslogout bei Rechteänderung)\n customerId Int? @unique\n customer Customer? @relation(fields: [customerId], references: [id])\n roles UserRole[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel Role {\n id Int @id @default(autoincrement())\n name String @unique\n description String?\n permissions RolePermission[]\n users UserRole[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel Permission {\n id Int @id @default(autoincrement())\n resource String\n action String\n roles RolePermission[]\n\n @@unique([resource, action])\n}\n\nmodel RolePermission {\n roleId Int\n permissionId Int\n role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)\n permission Permission @relation(fields: [permissionId], references: [id], onDelete: Cascade)\n\n @@id([roleId, permissionId])\n}\n\nmodel UserRole {\n userId Int\n roleId Int\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)\n\n @@id([userId, roleId])\n}\n\n// ==================== CUSTOMERS ====================\n\nenum CustomerType {\n PRIVATE\n BUSINESS\n}\n\nmodel Customer {\n id Int @id @default(autoincrement())\n customerNumber String @unique\n type CustomerType @default(PRIVATE)\n salutation String?\n firstName String\n lastName String\n companyName String?\n foundingDate DateTime? // Gründungsdatum (für Firmen)\n birthDate DateTime?\n birthPlace String?\n email String?\n phone String?\n mobile String?\n taxNumber String?\n businessRegistrationPath String? // PDF-Pfad zur Gewerbeanmeldung\n commercialRegisterPath String? // PDF-Pfad zum Handelsregisterauszug\n commercialRegisterNumber String? // Handelsregisternummer (Text)\n privacyPolicyPath String? // PDF-Pfad zur Datenschutzerklärung (für alle Kunden)\n notes String? @db.Text\n\n // ===== Portal-Zugangsdaten =====\n portalEnabled Boolean @default(false) // Portal aktiviert?\n portalEmail String? @unique // Portal-Login E-Mail\n portalPasswordHash String? // Gehashtes Passwort (für Login)\n portalPasswordEncrypted String? // Verschlüsseltes Passwort (für Anzeige)\n portalLastLogin DateTime? // Letzte Anmeldung\n\n user User?\n addresses Address[]\n bankCards BankCard[]\n identityDocuments IdentityDocument[]\n meters Meter[]\n stressfreiEmails StressfreiEmail[]\n contracts Contract[]\n\n // Vertreter-Beziehungen (Kunde kann für andere Kunden handeln)\n representingFor CustomerRepresentative[] @relation(\"RepresentativeCustomer\")\n representedBy CustomerRepresentative[] @relation(\"RepresentedCustomer\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CUSTOMER REPRESENTATIVES ====================\n// Vertretungsbeziehung: Ein Kunde kann die Verträge eines anderen Kunden einsehen\n// z.B. Sohn (representativeId) kann Verträge der Mutter (customerId) sehen\n\nmodel CustomerRepresentative {\n id Int @id @default(autoincrement())\n customerId Int // Der Kunde, dessen Verträge eingesehen werden (z.B. Mutter)\n customer Customer @relation(\"RepresentedCustomer\", fields: [customerId], references: [id], onDelete: Cascade)\n representativeId Int // Der Kunde, der einsehen darf (z.B. Sohn)\n representative Customer @relation(\"RepresentativeCustomer\", fields: [representativeId], references: [id], onDelete: Cascade)\n notes String? // Notizen zur Vertretung\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([customerId, representativeId]) // Keine doppelten Einträge\n}\n\n// ==================== ADDRESSES ====================\n\nenum AddressType {\n DELIVERY_RESIDENCE\n BILLING\n}\n\nmodel Address {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n type AddressType @default(DELIVERY_RESIDENCE)\n street String\n houseNumber String\n postalCode String\n city String\n country String @default(\"Deutschland\")\n isDefault Boolean @default(false)\n contractsAsDelivery Contract[] @relation(\"DeliveryAddress\")\n contractsAsBilling Contract[] @relation(\"BillingAddress\")\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== BANK CARDS ====================\n\nmodel BankCard {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n accountHolder String\n iban String\n bic String?\n bankName String?\n expiryDate DateTime?\n documentPath String? // Pfad zur hochgeladenen PDF\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== IDENTITY DOCUMENTS ====================\n\nenum DocumentType {\n ID_CARD\n PASSPORT\n DRIVERS_LICENSE\n OTHER\n}\n\nmodel IdentityDocument {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n type DocumentType @default(ID_CARD)\n documentNumber String\n issuingAuthority String?\n issueDate DateTime?\n expiryDate DateTime?\n documentPath String? // Pfad zur hochgeladenen PDF\n isActive Boolean @default(true)\n // Führerschein-spezifische Felder\n licenseClasses String? // z.B. \"B, BE, AM, L\" - kommasepariert\n licenseIssueDate DateTime? // Datum des Führerscheinerwerbs (Klasse B)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== EMAIL PROVIDER CONFIG (Plesk, cPanel etc.) ====================\n\nenum EmailProviderType {\n PLESK\n CPANEL\n DIRECTADMIN\n}\n\n// Verschlüsselungstyp für E-Mail-Verbindungen\nenum MailEncryption {\n SSL // Implicit SSL/TLS (Ports 465/993) - Verschlüsselung von Anfang an\n STARTTLS // STARTTLS (Ports 587/143) - Startet unverschlüsselt, dann Upgrade\n NONE // Keine Verschlüsselung (Ports 25/143)\n}\n\nmodel EmailProviderConfig {\n id Int @id @default(autoincrement())\n name String @unique // z.B. \"Plesk Hauptserver\"\n type EmailProviderType\n apiUrl String // API-URL (z.B. https://server.de:8443)\n apiKey String? // API-Key (verschlüsselt)\n username String? // Benutzername für API\n passwordEncrypted String? // Passwort (verschlüsselt)\n domain String // Domain für E-Mails (z.B. stressfrei-wechseln.de)\n defaultForwardEmail String? // Standard-Weiterleitungsadresse (unsere eigene)\n\n // IMAP/SMTP-Server für E-Mail-Client (optional, default: mail.{domain})\n imapServer String? // z.B. \"mail.stressfrei-wechseln.de\"\n imapPort Int? @default(993)\n smtpServer String?\n smtpPort Int? @default(465)\n\n // Verschlüsselungs-Einstellungen\n imapEncryption MailEncryption @default(SSL) // SSL, STARTTLS oder NONE\n smtpEncryption MailEncryption @default(SSL) // SSL, STARTTLS oder NONE\n allowSelfSignedCerts Boolean @default(false) // Selbstsignierte Zertifikate erlauben\n\n isActive Boolean @default(true)\n isDefault Boolean @default(false) // Standard-Provider\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== STRESSFREI-WECHSELN EMAIL ADDRESSES ====================\n\nmodel StressfreiEmail {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n email String // Die Weiterleitungs-E-Mail-Adresse\n platform String? // Für welche Plattform (z.B. \"Freenet\", \"Klarmobil\")\n notes String? @db.Text // Optionale Notizen\n isActive Boolean @default(true)\n isProvisioned Boolean @default(false) // Wurde bei Provider angelegt?\n provisionedAt DateTime? // Wann wurde provisioniert?\n provisionError String? @db.Text // Fehlermeldung falls Provisionierung fehlschlug\n\n // Mailbox-Zugangsdaten (für IMAP/SMTP-Zugang)\n hasMailbox Boolean @default(false) // Hat echte Mailbox (nicht nur Weiterleitung)?\n emailPasswordEncrypted String? // Verschlüsseltes Mailbox-Passwort (AES-256-GCM)\n\n contracts Contract[] // Verträge die diese E-Mail als Benutzername verwenden\n cachedEmails CachedEmail[] // Gecachte E-Mails aus dieser Mailbox\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CACHED EMAILS (E-Mail-Client) ====================\n\nenum EmailFolder {\n INBOX\n SENT\n}\n\nmodel CachedEmail {\n id Int @id @default(autoincrement())\n stressfreiEmailId Int\n stressfreiEmail StressfreiEmail @relation(fields: [stressfreiEmailId], references: [id], onDelete: Cascade)\n\n // Ordner (Posteingang oder Gesendet)\n folder EmailFolder @default(INBOX)\n\n // IMAP-Identifikation\n messageId String // RFC 5322 Message-ID\n uid Int // IMAP UID (für Synchronisierung, bei SENT = 0)\n\n // E-Mail-Metadaten\n subject String?\n fromAddress String\n fromName String?\n toAddresses String @db.Text // JSON Array\n ccAddresses String? @db.Text // JSON Array\n receivedAt DateTime\n\n // Inhalt\n textBody String? @db.LongText\n htmlBody String? @db.LongText\n hasAttachments Boolean @default(false)\n attachmentNames String? @db.Text // JSON Array\n\n // Vertragszuordnung\n contractId Int?\n contract Contract? @relation(fields: [contractId], references: [id], onDelete: SetNull)\n assignedAt DateTime?\n assignedBy Int? // User ID der die Zuordnung gemacht hat\n isAutoAssigned Boolean @default(false) // true = automatisch beim Senden aus Vertrag\n\n // Flags\n isRead Boolean @default(false)\n isStarred Boolean @default(false)\n\n // Papierkorb\n isDeleted Boolean @default(false) // Im Papierkorb?\n deletedAt DateTime? // Wann gelöscht?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([stressfreiEmailId, messageId, folder]) // Folder hinzugefügt: gleiche MessageID kann in INBOX und SENT existieren\n @@index([contractId])\n @@index([stressfreiEmailId, folder, receivedAt])\n @@index([stressfreiEmailId, isDeleted]) // Für Papierkorb-Abfragen\n}\n\n// ==================== METERS (Energy) ====================\n\nenum MeterType {\n ELECTRICITY\n GAS\n}\n\nmodel Meter {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n meterNumber String\n type MeterType\n location String?\n isActive Boolean @default(true)\n readings MeterReading[]\n energyDetails EnergyContractDetails[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel MeterReading {\n id Int @id @default(autoincrement())\n meterId Int\n meter Meter @relation(fields: [meterId], references: [id], onDelete: Cascade)\n readingDate DateTime\n value Float\n unit String @default(\"kWh\")\n notes String?\n createdAt DateTime @default(now())\n}\n\n// ==================== SALES PLATFORMS ====================\n\nmodel SalesPlatform {\n id Int @id @default(autoincrement())\n name String @unique\n contactInfo String? @db.Text\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CANCELLATION PERIODS ====================\n\nmodel CancellationPeriod {\n id Int @id @default(autoincrement())\n code String @unique // z.B. \"14T\", \"1M\", \"3M\", \"12M\", \"1J\"\n description String // z.B. \"14 Tage\", \"1 Monat\", \"3 Monate\"\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CONTRACT DURATIONS ====================\n\nmodel ContractDuration {\n id Int @id @default(autoincrement())\n code String @unique // z.B. \"12M\", \"24M\", \"1J\", \"2J\"\n description String // z.B. \"12 Monate\", \"24 Monate\", \"1 Jahr\"\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== PROVIDERS (Anbieter) ====================\n\nmodel Provider {\n id Int @id @default(autoincrement())\n name String @unique // Anbietername\n portalUrl String? // Kundenkontourl (Login-Seite)\n usernameFieldName String? // Benutzernamefeld (z.B. \"email\", \"username\")\n passwordFieldName String? // Kennwortfeld (z.B. \"password\", \"pwd\")\n isActive Boolean @default(true)\n tariffs Tariff[]\n contracts Contract[]\n previousContracts Contract[] @relation(\"PreviousProvider\") // Verträge wo dieser Provider Altanbieter ist\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== TARIFFS (Tarife) ====================\n\nmodel Tariff {\n id Int @id @default(autoincrement())\n providerId Int\n provider Provider @relation(fields: [providerId], references: [id], onDelete: Cascade)\n name String // Tarifname\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([providerId, name]) // Eindeutiger Tarif pro Anbieter\n}\n\n// ==================== CONTRACT CATEGORIES ====================\n\nmodel ContractCategory {\n id Int @id @default(autoincrement())\n code String @unique // Technischer Code (z.B. ELECTRICITY, GAS)\n name String // Anzeigename (z.B. Strom, Gas)\n icon String? // Icon-Name für UI (z.B. \"Zap\", \"Flame\")\n color String? // Farbe für UI (z.B. \"#FFC107\")\n sortOrder Int @default(0)\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CONTRACTS ====================\n\n// Legacy Enum - wird durch ContractCategory ersetzt\nenum ContractType {\n ELECTRICITY\n GAS\n DSL\n CABLE\n FIBER\n MOBILE\n TV\n CAR_INSURANCE\n}\n\nenum ContractStatus {\n DRAFT\n PENDING\n ACTIVE\n CANCELLED\n EXPIRED\n DEACTIVATED\n}\n\nmodel Contract {\n id Int @id @default(autoincrement())\n contractNumber String @unique\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n type ContractType\n status ContractStatus @default(DRAFT)\n\n // Neue konfigurierbare Kategorie (ersetzt langfristig das type-Enum)\n contractCategoryId Int?\n contractCategory ContractCategory? @relation(fields: [contractCategoryId], references: [id])\n\n // Lieferadresse\n addressId Int?\n address Address? @relation(\"DeliveryAddress\", fields: [addressId], references: [id])\n\n // Rechnungsadresse (falls leer, wird Lieferadresse verwendet)\n billingAddressId Int?\n billingAddress Address? @relation(\"BillingAddress\", fields: [billingAddressId], references: [id])\n\n bankCardId Int?\n bankCard BankCard? @relation(fields: [bankCardId], references: [id])\n\n identityDocumentId Int?\n identityDocument IdentityDocument? @relation(fields: [identityDocumentId], references: [id])\n\n salesPlatformId Int?\n salesPlatform SalesPlatform? @relation(fields: [salesPlatformId], references: [id])\n\n cancellationPeriodId Int?\n cancellationPeriod CancellationPeriod? @relation(fields: [cancellationPeriodId], references: [id])\n\n contractDurationId Int?\n contractDuration ContractDuration? @relation(fields: [contractDurationId], references: [id])\n\n previousContractId Int? @unique\n previousContract Contract? @relation(\"ContractHistory\", fields: [previousContractId], references: [id])\n followUpContract Contract? @relation(\"ContractHistory\")\n\n // Altanbieter-Daten (nur wenn kein Vorgängervertrag existiert)\n previousProviderId Int?\n previousProvider Provider? @relation(\"PreviousProvider\", fields: [previousProviderId], references: [id])\n previousCustomerNumber String? // Kundennummer beim Altanbieter\n previousContractNumber String? // Vertragsnummer beim Altanbieter\n\n // Anbieter & Tarif (neue Verknüpfung)\n providerId Int?\n provider Provider? @relation(fields: [providerId], references: [id])\n tariffId Int?\n tariff Tariff? @relation(fields: [tariffId], references: [id])\n\n // Legacy-Felder (für Abwärtskompatibilität)\n providerName String?\n tariffName String?\n customerNumberAtProvider String?\n contractNumberAtProvider String? // Vertragsnummer beim Anbieter\n priceFirst12Months String? // Preis erste 12 Monate\n priceFrom13Months String? // Preis ab 13. Monat\n priceAfter24Months String? // Preis nach 24 Monaten\n\n startDate DateTime?\n endDate DateTime? // Wird aus startDate + contractDuration berechnet\n commission Float?\n\n // Kündigungsdokumente\n cancellationLetterPath String? // Kündigungsschreiben PDF\n cancellationConfirmationPath String? // Kündigungsbestätigung PDF\n cancellationLetterOptionsPath String? // Kündigungsschreiben Optionen PDF\n cancellationConfirmationOptionsPath String? // Kündigungsbestätigung Optionen PDF\n\n // Kündigungsdaten\n cancellationConfirmationDate DateTime? // Kündigungsbestätigungsdatum\n cancellationConfirmationOptionsDate DateTime? // Kündigungsbestätigungsoptionendatum\n wasSpecialCancellation Boolean @default(false) // Wurde sondergekündigt?\n\n portalUsername String?\n portalPasswordEncrypted String?\n\n // Stressfrei-Wechseln E-Mail als Benutzername (Alternative zu portalUsername)\n stressfreiEmailId Int?\n stressfreiEmail StressfreiEmail? @relation(fields: [stressfreiEmailId], references: [id])\n\n // Snooze: Vertrag zurückstellen bis Datum (für Cockpit)\n nextReviewDate DateTime? // Erneute Prüfung am\n\n notes String? @db.Text\n\n energyDetails EnergyContractDetails?\n internetDetails InternetContractDetails?\n mobileDetails MobileContractDetails?\n tvDetails TvContractDetails?\n carInsuranceDetails CarInsuranceDetails?\n\n tasks ContractTask[]\n assignedEmails CachedEmail[] // Zugeordnete E-Mails aus dem E-Mail-Client\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CONTRACT TASKS ====================\n\nenum ContractTaskStatus {\n OPEN\n COMPLETED\n}\n\nmodel ContractTask {\n id Int @id @default(autoincrement())\n contractId Int\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n title String\n description String? @db.Text\n status ContractTaskStatus @default(OPEN)\n visibleInPortal Boolean @default(false)\n createdBy String? // Name des Erstellers\n completedAt DateTime?\n subtasks ContractTaskSubtask[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel ContractTaskSubtask {\n id Int @id @default(autoincrement())\n taskId Int\n task ContractTask @relation(fields: [taskId], references: [id], onDelete: Cascade)\n title String\n status ContractTaskStatus @default(OPEN)\n createdBy String?\n completedAt DateTime?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== ENERGY CONTRACT DETAILS ====================\n\nenum InvoiceType {\n INTERIM // Zwischenrechnung\n FINAL // Schlussrechnung\n NOT_AVAILABLE // Rechnung nicht mehr zu bekommen\n}\n\nmodel EnergyContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n meterId Int?\n meter Meter? @relation(fields: [meterId], references: [id])\n maloId String? // Marktlokations-ID\n annualConsumption Float? // kWh für Strom, m³ für Gas\n annualConsumptionKwh Float? // kWh für Gas (zusätzlich zu m³)\n basePrice Float? // €/Monat\n unitPrice Float? // €/kWh (Arbeitspreis)\n bonus Float?\n previousProviderName String?\n previousCustomerNumber String?\n invoices Invoice[] // Rechnungen\n}\n\nmodel Invoice {\n id Int @id @default(autoincrement())\n energyContractDetailsId Int\n energyContractDetails EnergyContractDetails @relation(fields: [energyContractDetailsId], references: [id], onDelete: Cascade)\n invoiceDate DateTime\n invoiceType InvoiceType\n documentPath String? // Pflicht, außer bei NOT_AVAILABLE\n notes String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([energyContractDetailsId])\n}\n\n// ==================== INTERNET CONTRACT DETAILS ====================\n\nmodel InternetContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n downloadSpeed Int?\n uploadSpeed Int?\n routerModel String?\n routerSerialNumber String?\n installationDate DateTime?\n // Internet-Zugangsdaten\n internetUsername String?\n internetPasswordEncrypted String? // Verschlüsselt gespeichert\n // Glasfaser-spezifisch\n homeId String?\n // Vodafone DSL/Kabel spezifisch\n activationCode String?\n phoneNumbers PhoneNumber[]\n}\n\nmodel PhoneNumber {\n id Int @id @default(autoincrement())\n internetContractDetailsId Int\n internetDetails InternetContractDetails @relation(fields: [internetContractDetailsId], references: [id], onDelete: Cascade)\n phoneNumber String\n isMain Boolean @default(false)\n // SIP-Zugangsdaten\n sipUsername String?\n sipPasswordEncrypted String? // Verschlüsselt gespeichert\n sipServer String?\n}\n\n// ==================== MOBILE CONTRACT DETAILS ====================\n\nmodel MobileContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n requiresMultisim Boolean @default(false) // Multisim erforderlich?\n dataVolume Float?\n includedMinutes Int?\n includedSMS Int?\n deviceModel String?\n deviceImei String?\n simCards SimCard[]\n // Legacy-Felder (für Abwärtskompatibilität, werden durch simCards ersetzt)\n phoneNumber String?\n simCardNumber String?\n}\n\nmodel SimCard {\n id Int @id @default(autoincrement())\n mobileDetailsId Int\n mobileDetails MobileContractDetails @relation(fields: [mobileDetailsId], references: [id], onDelete: Cascade)\n phoneNumber String? // Rufnummer\n simCardNumber String? // SIM-Kartennummer\n pin String? // PIN (verschlüsselt gespeichert)\n puk String? // PUK (verschlüsselt gespeichert)\n isMultisim Boolean @default(false) // Ist dies eine Multisim-Karte?\n isMain Boolean @default(false) // Ist dies die Hauptkarte?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== TV CONTRACT DETAILS ====================\n\nmodel TvContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n receiverModel String?\n smartcardNumber String?\n package String?\n}\n\n// ==================== CAR INSURANCE DETAILS ====================\n\nenum InsuranceType {\n LIABILITY\n PARTIAL\n FULL\n}\n\nmodel CarInsuranceDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n licensePlate String?\n hsn String?\n tsn String?\n vin String?\n vehicleType String?\n firstRegistration DateTime?\n noClaimsClass String?\n insuranceType InsuranceType @default(LIABILITY)\n deductiblePartial Float?\n deductibleFull Float?\n policyNumber String?\n previousInsurer String?\n}\n", - "inlineSchemaHash": "84f145c389db874d411b7a5b7ac16b3b2e77ebb74a71d4e93eaaeffdc67da9ae", + "inlineSchema": "generator client {\n provider = \"prisma-client-js\"\n}\n\ndatasource db {\n provider = \"mysql\"\n url = env(\"DATABASE_URL\")\n}\n\n// ==================== APP SETTINGS ====================\n\nmodel AppSetting {\n id Int @id @default(autoincrement())\n key String @unique\n value String @db.Text\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== USERS & AUTH ====================\n\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n password String\n firstName String\n lastName String\n isActive Boolean @default(true)\n tokenInvalidatedAt DateTime? // Zeitpunkt ab dem alle Tokens ungültig sind (für Zwangslogout bei Rechteänderung)\n customerId Int? @unique\n customer Customer? @relation(fields: [customerId], references: [id])\n roles UserRole[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel Role {\n id Int @id @default(autoincrement())\n name String @unique\n description String?\n permissions RolePermission[]\n users UserRole[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel Permission {\n id Int @id @default(autoincrement())\n resource String\n action String\n roles RolePermission[]\n\n @@unique([resource, action])\n}\n\nmodel RolePermission {\n roleId Int\n permissionId Int\n role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)\n permission Permission @relation(fields: [permissionId], references: [id], onDelete: Cascade)\n\n @@id([roleId, permissionId])\n}\n\nmodel UserRole {\n userId Int\n roleId Int\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)\n\n @@id([userId, roleId])\n}\n\n// ==================== CUSTOMERS ====================\n\nenum CustomerType {\n PRIVATE\n BUSINESS\n}\n\nmodel Customer {\n id Int @id @default(autoincrement())\n customerNumber String @unique\n type CustomerType @default(PRIVATE)\n salutation String?\n firstName String\n lastName String\n companyName String?\n foundingDate DateTime? // Gründungsdatum (für Firmen)\n birthDate DateTime?\n birthPlace String?\n email String?\n phone String?\n mobile String?\n taxNumber String?\n businessRegistrationPath String? // PDF-Pfad zur Gewerbeanmeldung\n commercialRegisterPath String? // PDF-Pfad zum Handelsregisterauszug\n commercialRegisterNumber String? // Handelsregisternummer (Text)\n privacyPolicyPath String? // PDF-Pfad zur Datenschutzerklärung (für alle Kunden)\n notes String? @db.Text\n\n // ===== Portal-Zugangsdaten =====\n portalEnabled Boolean @default(false) // Portal aktiviert?\n portalEmail String? @unique // Portal-Login E-Mail\n portalPasswordHash String? // Gehashtes Passwort (für Login)\n portalPasswordEncrypted String? // Verschlüsseltes Passwort (für Anzeige)\n portalLastLogin DateTime? // Letzte Anmeldung\n\n user User?\n addresses Address[]\n bankCards BankCard[]\n identityDocuments IdentityDocument[]\n meters Meter[]\n stressfreiEmails StressfreiEmail[]\n contracts Contract[]\n\n // Vertreter-Beziehungen (Kunde kann für andere Kunden handeln)\n representingFor CustomerRepresentative[] @relation(\"RepresentativeCustomer\")\n representedBy CustomerRepresentative[] @relation(\"RepresentedCustomer\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CUSTOMER REPRESENTATIVES ====================\n// Vertretungsbeziehung: Ein Kunde kann die Verträge eines anderen Kunden einsehen\n// z.B. Sohn (representativeId) kann Verträge der Mutter (customerId) sehen\n\nmodel CustomerRepresentative {\n id Int @id @default(autoincrement())\n customerId Int // Der Kunde, dessen Verträge eingesehen werden (z.B. Mutter)\n customer Customer @relation(\"RepresentedCustomer\", fields: [customerId], references: [id], onDelete: Cascade)\n representativeId Int // Der Kunde, der einsehen darf (z.B. Sohn)\n representative Customer @relation(\"RepresentativeCustomer\", fields: [representativeId], references: [id], onDelete: Cascade)\n notes String? // Notizen zur Vertretung\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([customerId, representativeId]) // Keine doppelten Einträge\n}\n\n// ==================== ADDRESSES ====================\n\nenum AddressType {\n DELIVERY_RESIDENCE\n BILLING\n}\n\nmodel Address {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n type AddressType @default(DELIVERY_RESIDENCE)\n street String\n houseNumber String\n postalCode String\n city String\n country String @default(\"Deutschland\")\n isDefault Boolean @default(false)\n contractsAsDelivery Contract[] @relation(\"DeliveryAddress\")\n contractsAsBilling Contract[] @relation(\"BillingAddress\")\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== BANK CARDS ====================\n\nmodel BankCard {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n accountHolder String\n iban String\n bic String?\n bankName String?\n expiryDate DateTime?\n documentPath String? // Pfad zur hochgeladenen PDF\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== IDENTITY DOCUMENTS ====================\n\nenum DocumentType {\n ID_CARD\n PASSPORT\n DRIVERS_LICENSE\n OTHER\n}\n\nmodel IdentityDocument {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n type DocumentType @default(ID_CARD)\n documentNumber String\n issuingAuthority String?\n issueDate DateTime?\n expiryDate DateTime?\n documentPath String? // Pfad zur hochgeladenen PDF\n isActive Boolean @default(true)\n // Führerschein-spezifische Felder\n licenseClasses String? // z.B. \"B, BE, AM, L\" - kommasepariert\n licenseIssueDate DateTime? // Datum des Führerscheinerwerbs (Klasse B)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== EMAIL PROVIDER CONFIG (Plesk, cPanel etc.) ====================\n\nenum EmailProviderType {\n PLESK\n CPANEL\n DIRECTADMIN\n}\n\n// Verschlüsselungstyp für E-Mail-Verbindungen\nenum MailEncryption {\n SSL // Implicit SSL/TLS (Ports 465/993) - Verschlüsselung von Anfang an\n STARTTLS // STARTTLS (Ports 587/143) - Startet unverschlüsselt, dann Upgrade\n NONE // Keine Verschlüsselung (Ports 25/143)\n}\n\nmodel EmailProviderConfig {\n id Int @id @default(autoincrement())\n name String @unique // z.B. \"Plesk Hauptserver\"\n type EmailProviderType\n apiUrl String // API-URL (z.B. https://server.de:8443)\n apiKey String? // API-Key (verschlüsselt)\n username String? // Benutzername für API\n passwordEncrypted String? // Passwort (verschlüsselt)\n domain String // Domain für E-Mails (z.B. stressfrei-wechseln.de)\n defaultForwardEmail String? // Standard-Weiterleitungsadresse (unsere eigene)\n\n // IMAP/SMTP-Server für E-Mail-Client (optional, default: mail.{domain})\n imapServer String? // z.B. \"mail.stressfrei-wechseln.de\"\n imapPort Int? @default(993)\n smtpServer String?\n smtpPort Int? @default(465)\n\n // Verschlüsselungs-Einstellungen\n imapEncryption MailEncryption @default(SSL) // SSL, STARTTLS oder NONE\n smtpEncryption MailEncryption @default(SSL) // SSL, STARTTLS oder NONE\n allowSelfSignedCerts Boolean @default(false) // Selbstsignierte Zertifikate erlauben\n\n isActive Boolean @default(true)\n isDefault Boolean @default(false) // Standard-Provider\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== STRESSFREI-WECHSELN EMAIL ADDRESSES ====================\n\nmodel StressfreiEmail {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n email String // Die Weiterleitungs-E-Mail-Adresse\n platform String? // Für welche Plattform (z.B. \"Freenet\", \"Klarmobil\")\n notes String? @db.Text // Optionale Notizen\n isActive Boolean @default(true)\n isProvisioned Boolean @default(false) // Wurde bei Provider angelegt?\n provisionedAt DateTime? // Wann wurde provisioniert?\n provisionError String? @db.Text // Fehlermeldung falls Provisionierung fehlschlug\n\n // Mailbox-Zugangsdaten (für IMAP/SMTP-Zugang)\n hasMailbox Boolean @default(false) // Hat echte Mailbox (nicht nur Weiterleitung)?\n emailPasswordEncrypted String? // Verschlüsseltes Mailbox-Passwort (AES-256-GCM)\n\n contracts Contract[] // Verträge die diese E-Mail als Benutzername verwenden\n cachedEmails CachedEmail[] // Gecachte E-Mails aus dieser Mailbox\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CACHED EMAILS (E-Mail-Client) ====================\n\nenum EmailFolder {\n INBOX\n SENT\n}\n\nmodel CachedEmail {\n id Int @id @default(autoincrement())\n stressfreiEmailId Int\n stressfreiEmail StressfreiEmail @relation(fields: [stressfreiEmailId], references: [id], onDelete: Cascade)\n\n // Ordner (Posteingang oder Gesendet)\n folder EmailFolder @default(INBOX)\n\n // IMAP-Identifikation\n messageId String // RFC 5322 Message-ID\n uid Int // IMAP UID (für Synchronisierung, bei SENT = 0)\n\n // E-Mail-Metadaten\n subject String?\n fromAddress String\n fromName String?\n toAddresses String @db.Text // JSON Array\n ccAddresses String? @db.Text // JSON Array\n receivedAt DateTime\n\n // Inhalt\n textBody String? @db.LongText\n htmlBody String? @db.LongText\n hasAttachments Boolean @default(false)\n attachmentNames String? @db.Text // JSON Array\n\n // Vertragszuordnung\n contractId Int?\n contract Contract? @relation(fields: [contractId], references: [id], onDelete: SetNull)\n assignedAt DateTime?\n assignedBy Int? // User ID der die Zuordnung gemacht hat\n isAutoAssigned Boolean @default(false) // true = automatisch beim Senden aus Vertrag\n\n // Flags\n isRead Boolean @default(false)\n isStarred Boolean @default(false)\n\n // Papierkorb\n isDeleted Boolean @default(false) // Im Papierkorb?\n deletedAt DateTime? // Wann gelöscht?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([stressfreiEmailId, messageId, folder]) // Folder hinzugefügt: gleiche MessageID kann in INBOX und SENT existieren\n @@index([contractId])\n @@index([stressfreiEmailId, folder, receivedAt])\n @@index([stressfreiEmailId, isDeleted]) // Für Papierkorb-Abfragen\n}\n\n// ==================== METERS (Energy) ====================\n\nenum MeterType {\n ELECTRICITY\n GAS\n}\n\nmodel Meter {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n meterNumber String\n type MeterType\n location String?\n isActive Boolean @default(true)\n readings MeterReading[]\n energyDetails EnergyContractDetails[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel MeterReading {\n id Int @id @default(autoincrement())\n meterId Int\n meter Meter @relation(fields: [meterId], references: [id], onDelete: Cascade)\n readingDate DateTime\n value Float\n unit String @default(\"kWh\")\n notes String?\n createdAt DateTime @default(now())\n}\n\n// ==================== SALES PLATFORMS ====================\n\nmodel SalesPlatform {\n id Int @id @default(autoincrement())\n name String @unique\n contactInfo String? @db.Text\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CANCELLATION PERIODS ====================\n\nmodel CancellationPeriod {\n id Int @id @default(autoincrement())\n code String @unique // z.B. \"14T\", \"1M\", \"3M\", \"12M\", \"1J\"\n description String // z.B. \"14 Tage\", \"1 Monat\", \"3 Monate\"\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CONTRACT DURATIONS ====================\n\nmodel ContractDuration {\n id Int @id @default(autoincrement())\n code String @unique // z.B. \"12M\", \"24M\", \"1J\", \"2J\"\n description String // z.B. \"12 Monate\", \"24 Monate\", \"1 Jahr\"\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== PROVIDERS (Anbieter) ====================\n\nmodel Provider {\n id Int @id @default(autoincrement())\n name String @unique // Anbietername\n portalUrl String? // Kundenkontourl (Login-Seite)\n usernameFieldName String? // Benutzernamefeld (z.B. \"email\", \"username\")\n passwordFieldName String? // Kennwortfeld (z.B. \"password\", \"pwd\")\n isActive Boolean @default(true)\n tariffs Tariff[]\n contracts Contract[]\n previousContracts Contract[] @relation(\"PreviousProvider\") // Verträge wo dieser Provider Altanbieter ist\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== TARIFFS (Tarife) ====================\n\nmodel Tariff {\n id Int @id @default(autoincrement())\n providerId Int\n provider Provider @relation(fields: [providerId], references: [id], onDelete: Cascade)\n name String // Tarifname\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([providerId, name]) // Eindeutiger Tarif pro Anbieter\n}\n\n// ==================== CONTRACT CATEGORIES ====================\n\nmodel ContractCategory {\n id Int @id @default(autoincrement())\n code String @unique // Technischer Code (z.B. ELECTRICITY, GAS)\n name String // Anzeigename (z.B. Strom, Gas)\n icon String? // Icon-Name für UI (z.B. \"Zap\", \"Flame\")\n color String? // Farbe für UI (z.B. \"#FFC107\")\n sortOrder Int @default(0)\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CONTRACTS ====================\n\n// Legacy Enum - wird durch ContractCategory ersetzt\nenum ContractType {\n ELECTRICITY\n GAS\n DSL\n CABLE\n FIBER\n MOBILE\n TV\n CAR_INSURANCE\n}\n\nenum ContractStatus {\n DRAFT\n PENDING\n ACTIVE\n CANCELLED\n EXPIRED\n DEACTIVATED\n}\n\nmodel Contract {\n id Int @id @default(autoincrement())\n contractNumber String @unique\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n type ContractType\n status ContractStatus @default(DRAFT)\n\n // Neue konfigurierbare Kategorie (ersetzt langfristig das type-Enum)\n contractCategoryId Int?\n contractCategory ContractCategory? @relation(fields: [contractCategoryId], references: [id])\n\n // Lieferadresse\n addressId Int?\n address Address? @relation(\"DeliveryAddress\", fields: [addressId], references: [id])\n\n // Rechnungsadresse (falls leer, wird Lieferadresse verwendet)\n billingAddressId Int?\n billingAddress Address? @relation(\"BillingAddress\", fields: [billingAddressId], references: [id])\n\n bankCardId Int?\n bankCard BankCard? @relation(fields: [bankCardId], references: [id])\n\n identityDocumentId Int?\n identityDocument IdentityDocument? @relation(fields: [identityDocumentId], references: [id])\n\n salesPlatformId Int?\n salesPlatform SalesPlatform? @relation(fields: [salesPlatformId], references: [id])\n\n cancellationPeriodId Int?\n cancellationPeriod CancellationPeriod? @relation(fields: [cancellationPeriodId], references: [id])\n\n contractDurationId Int?\n contractDuration ContractDuration? @relation(fields: [contractDurationId], references: [id])\n\n previousContractId Int? @unique\n previousContract Contract? @relation(\"ContractHistory\", fields: [previousContractId], references: [id])\n followUpContract Contract? @relation(\"ContractHistory\")\n\n // Altanbieter-Daten (nur wenn kein Vorgängervertrag existiert)\n previousProviderId Int?\n previousProvider Provider? @relation(\"PreviousProvider\", fields: [previousProviderId], references: [id])\n previousCustomerNumber String? // Kundennummer beim Altanbieter\n previousContractNumber String? // Vertragsnummer beim Altanbieter\n\n // Anbieter & Tarif (neue Verknüpfung)\n providerId Int?\n provider Provider? @relation(fields: [providerId], references: [id])\n tariffId Int?\n tariff Tariff? @relation(fields: [tariffId], references: [id])\n\n // Legacy-Felder (für Abwärtskompatibilität)\n providerName String?\n tariffName String?\n customerNumberAtProvider String?\n contractNumberAtProvider String? // Vertragsnummer beim Anbieter\n priceFirst12Months String? // Preis erste 12 Monate\n priceFrom13Months String? // Preis ab 13. Monat\n priceAfter24Months String? // Preis nach 24 Monaten\n\n startDate DateTime?\n endDate DateTime? // Wird aus startDate + contractDuration berechnet\n commission Float?\n\n // Kündigungsdokumente\n cancellationLetterPath String? // Kündigungsschreiben PDF\n cancellationConfirmationPath String? // Kündigungsbestätigung PDF\n cancellationLetterOptionsPath String? // Kündigungsschreiben Optionen PDF\n cancellationConfirmationOptionsPath String? // Kündigungsbestätigung Optionen PDF\n\n // Kündigungsdaten\n cancellationConfirmationDate DateTime? // Kündigungsbestätigungsdatum\n cancellationConfirmationOptionsDate DateTime? // Kündigungsbestätigungsoptionendatum\n wasSpecialCancellation Boolean @default(false) // Wurde sondergekündigt?\n\n portalUsername String?\n portalPasswordEncrypted String?\n\n // Stressfrei-Wechseln E-Mail als Benutzername (Alternative zu portalUsername)\n stressfreiEmailId Int?\n stressfreiEmail StressfreiEmail? @relation(fields: [stressfreiEmailId], references: [id])\n\n // Snooze: Vertrag zurückstellen bis Datum (für Cockpit)\n nextReviewDate DateTime? // Erneute Prüfung am\n\n notes String? @db.Text\n\n energyDetails EnergyContractDetails?\n internetDetails InternetContractDetails?\n mobileDetails MobileContractDetails?\n tvDetails TvContractDetails?\n carInsuranceDetails CarInsuranceDetails?\n\n tasks ContractTask[]\n assignedEmails CachedEmail[] // Zugeordnete E-Mails aus dem E-Mail-Client\n historyEntries ContractHistoryEntry[]\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CONTRACT HISTORY ====================\n\nmodel ContractHistoryEntry {\n id Int @id @default(autoincrement())\n contractId Int\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n title String // Kurzbeschreibung (z.B. \"Folgevertrag erstellt\", \"kWh auf 18000 erhöht\")\n description String? @db.Text // Längere Beschreibung (optional)\n isAutomatic Boolean @default(false) // true = automatisch erstellt, false = manuell\n createdBy String // E-Mail des Erstellers\n createdAt DateTime @default(now())\n}\n\n// ==================== CONTRACT TASKS ====================\n\nenum ContractTaskStatus {\n OPEN\n COMPLETED\n}\n\nmodel ContractTask {\n id Int @id @default(autoincrement())\n contractId Int\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n title String\n description String? @db.Text\n status ContractTaskStatus @default(OPEN)\n visibleInPortal Boolean @default(false)\n createdBy String? // Name des Erstellers\n completedAt DateTime?\n subtasks ContractTaskSubtask[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel ContractTaskSubtask {\n id Int @id @default(autoincrement())\n taskId Int\n task ContractTask @relation(fields: [taskId], references: [id], onDelete: Cascade)\n title String\n status ContractTaskStatus @default(OPEN)\n createdBy String?\n completedAt DateTime?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== ENERGY CONTRACT DETAILS ====================\n\nenum InvoiceType {\n INTERIM // Zwischenrechnung\n FINAL // Schlussrechnung\n NOT_AVAILABLE // Rechnung nicht mehr zu bekommen\n}\n\nmodel EnergyContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n meterId Int?\n meter Meter? @relation(fields: [meterId], references: [id])\n maloId String? // Marktlokations-ID\n annualConsumption Float? // kWh für Strom, m³ für Gas\n annualConsumptionKwh Float? // kWh für Gas (zusätzlich zu m³)\n basePrice Float? // €/Monat\n unitPrice Float? // €/kWh (Arbeitspreis)\n bonus Float?\n previousProviderName String?\n previousCustomerNumber String?\n invoices Invoice[] // Rechnungen\n}\n\nmodel Invoice {\n id Int @id @default(autoincrement())\n energyContractDetailsId Int\n energyContractDetails EnergyContractDetails @relation(fields: [energyContractDetailsId], references: [id], onDelete: Cascade)\n invoiceDate DateTime\n invoiceType InvoiceType\n documentPath String? // Pflicht, außer bei NOT_AVAILABLE\n notes String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([energyContractDetailsId])\n}\n\n// ==================== INTERNET CONTRACT DETAILS ====================\n\nmodel InternetContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n downloadSpeed Int?\n uploadSpeed Int?\n routerModel String?\n routerSerialNumber String?\n installationDate DateTime?\n // Internet-Zugangsdaten\n internetUsername String?\n internetPasswordEncrypted String? // Verschlüsselt gespeichert\n // Glasfaser-spezifisch\n homeId String?\n // Vodafone DSL/Kabel spezifisch\n activationCode String?\n phoneNumbers PhoneNumber[]\n}\n\nmodel PhoneNumber {\n id Int @id @default(autoincrement())\n internetContractDetailsId Int\n internetDetails InternetContractDetails @relation(fields: [internetContractDetailsId], references: [id], onDelete: Cascade)\n phoneNumber String\n isMain Boolean @default(false)\n // SIP-Zugangsdaten\n sipUsername String?\n sipPasswordEncrypted String? // Verschlüsselt gespeichert\n sipServer String?\n}\n\n// ==================== MOBILE CONTRACT DETAILS ====================\n\nmodel MobileContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n requiresMultisim Boolean @default(false) // Multisim erforderlich?\n dataVolume Float?\n includedMinutes Int?\n includedSMS Int?\n deviceModel String?\n deviceImei String?\n simCards SimCard[]\n // Legacy-Felder (für Abwärtskompatibilität, werden durch simCards ersetzt)\n phoneNumber String?\n simCardNumber String?\n}\n\nmodel SimCard {\n id Int @id @default(autoincrement())\n mobileDetailsId Int\n mobileDetails MobileContractDetails @relation(fields: [mobileDetailsId], references: [id], onDelete: Cascade)\n phoneNumber String? // Rufnummer\n simCardNumber String? // SIM-Kartennummer\n pin String? // PIN (verschlüsselt gespeichert)\n puk String? // PUK (verschlüsselt gespeichert)\n isMultisim Boolean @default(false) // Ist dies eine Multisim-Karte?\n isMain Boolean @default(false) // Ist dies die Hauptkarte?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== TV CONTRACT DETAILS ====================\n\nmodel TvContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n receiverModel String?\n smartcardNumber String?\n package String?\n}\n\n// ==================== CAR INSURANCE DETAILS ====================\n\nenum InsuranceType {\n LIABILITY\n PARTIAL\n FULL\n}\n\nmodel CarInsuranceDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n licensePlate String?\n hsn String?\n tsn String?\n vin String?\n vehicleType String?\n firstRegistration DateTime?\n noClaimsClass String?\n insuranceType InsuranceType @default(LIABILITY)\n deductiblePartial Float?\n deductibleFull Float?\n policyNumber String?\n previousInsurer String?\n}\n", + "inlineSchemaHash": "78e1ffc1151c8ed5044757206fc5cc6883ede2dea13cc396805b105375e30f1c", "copyEngine": true } config.dirname = '/' -config.runtimeDataModel = JSON.parse("{\"models\":{\"AppSetting\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"key\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"User\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"password\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"firstName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"lastName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tokenInvalidatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToUser\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"roles\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"UserRole\",\"relationName\":\"UserToUserRole\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Role\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"permissions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"RolePermission\",\"relationName\":\"RoleToRolePermission\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"users\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"UserRole\",\"relationName\":\"RoleToUserRole\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Permission\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"resource\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"action\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"roles\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"RolePermission\",\"relationName\":\"PermissionToRolePermission\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[[\"resource\",\"action\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"resource\",\"action\"]}],\"isGenerated\":false},\"RolePermission\":{\"dbName\":null,\"fields\":[{\"name\":\"roleId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"permissionId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Role\",\"relationName\":\"RoleToRolePermission\",\"relationFromFields\":[\"roleId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"permission\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Permission\",\"relationName\":\"PermissionToRolePermission\",\"relationFromFields\":[\"permissionId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":{\"name\":null,\"fields\":[\"roleId\",\"permissionId\"]},\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"UserRole\":{\"dbName\":null,\"fields\":[{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"roleId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"UserToUserRole\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Role\",\"relationName\":\"RoleToUserRole\",\"relationFromFields\":[\"roleId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":{\"name\":null,\"fields\":[\"userId\",\"roleId\"]},\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Customer\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"CustomerType\",\"default\":\"PRIVATE\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"salutation\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"firstName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"lastName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"companyName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"foundingDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"birthDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"birthPlace\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phone\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobile\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"taxNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"businessRegistrationPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"commercialRegisterPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"commercialRegisterNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"privacyPolicyPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalEnabled\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalEmail\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalPasswordHash\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalLastLogin\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"CustomerToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"addresses\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Address\",\"relationName\":\"AddressToCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankCards\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"BankCard\",\"relationName\":\"BankCardToCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"identityDocuments\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"IdentityDocument\",\"relationName\":\"CustomerToIdentityDocument\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meters\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Meter\",\"relationName\":\"CustomerToMeter\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"StressfreiEmail\",\"relationName\":\"CustomerToStressfreiEmail\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representingFor\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CustomerRepresentative\",\"relationName\":\"RepresentativeCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representedBy\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CustomerRepresentative\",\"relationName\":\"RepresentedCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CustomerRepresentative\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"RepresentedCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representativeId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representative\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"RepresentativeCustomer\",\"relationFromFields\":[\"representativeId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"customerId\",\"representativeId\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"customerId\",\"representativeId\"]}],\"isGenerated\":false},\"Address\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"AddressToCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"AddressType\",\"default\":\"DELIVERY_RESIDENCE\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"street\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"houseNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"postalCode\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"city\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"country\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"Deutschland\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isDefault\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractsAsDelivery\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"DeliveryAddress\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractsAsBilling\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"BillingAddress\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"BankCard\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"BankCardToCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"accountHolder\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"iban\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bic\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"expiryDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"BankCardToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"IdentityDocument\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToIdentityDocument\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DocumentType\",\"default\":\"ID_CARD\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"issuingAuthority\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"issueDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"expiryDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"licenseClasses\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"licenseIssueDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToIdentityDocument\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EmailProviderConfig\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EmailProviderType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"apiUrl\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"apiKey\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"username\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"passwordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"domain\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"defaultForwardEmail\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"imapServer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"imapPort\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":993,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smtpServer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smtpPort\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":465,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"imapEncryption\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"MailEncryption\",\"default\":\"SSL\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smtpEncryption\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"MailEncryption\",\"default\":\"SSL\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"allowSelfSignedCerts\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isDefault\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"StressfreiEmail\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToStressfreiEmail\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"platform\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isProvisioned\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provisionedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provisionError\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hasMailbox\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"emailPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToStressfreiEmail\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cachedEmails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CachedEmail\",\"relationName\":\"CachedEmailToStressfreiEmail\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CachedEmail\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmailId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmail\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"StressfreiEmail\",\"relationName\":\"CachedEmailToStressfreiEmail\",\"relationFromFields\":[\"stressfreiEmailId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"folder\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"EmailFolder\",\"default\":\"INBOX\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"messageId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"uid\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"subject\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"fromAddress\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"fromName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"toAddresses\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ccAddresses\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"receivedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"textBody\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"htmlBody\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hasAttachments\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"attachmentNames\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"CachedEmailToContract\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"SetNull\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"assignedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"assignedBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isAutoAssigned\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isRead\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isStarred\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isDeleted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"stressfreiEmailId\",\"messageId\",\"folder\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"stressfreiEmailId\",\"messageId\",\"folder\"]}],\"isGenerated\":false},\"Meter\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToMeter\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meterNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MeterType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"location\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"readings\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MeterReading\",\"relationName\":\"MeterToMeterReading\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyDetails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EnergyContractDetails\",\"relationName\":\"EnergyContractDetailsToMeter\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"MeterReading\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meterId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meter\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Meter\",\"relationName\":\"MeterToMeterReading\",\"relationFromFields\":[\"meterId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"readingDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unit\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"kWh\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"SalesPlatform\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contactInfo\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToSalesPlatform\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CancellationPeriod\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"CancellationPeriodToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractDuration\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractDuration\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Provider\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalUrl\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"usernameFieldName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"passwordFieldName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariffs\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Tariff\",\"relationName\":\"ProviderToTariff\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToProvider\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"PreviousProvider\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Tariff\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"providerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provider\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Provider\",\"relationName\":\"ProviderToTariff\",\"relationFromFields\":[\"providerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToTariff\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"providerId\",\"name\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"providerId\",\"name\"]}],\"isGenerated\":false},\"ContractCategory\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"icon\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"color\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sortOrder\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":0,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractCategory\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Contract\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"ContractToCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"ContractStatus\",\"default\":\"DRAFT\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractCategoryId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractCategory\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractCategory\",\"relationName\":\"ContractToContractCategory\",\"relationFromFields\":[\"contractCategoryId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"addressId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"address\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Address\",\"relationName\":\"DeliveryAddress\",\"relationFromFields\":[\"addressId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"billingAddressId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"billingAddress\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Address\",\"relationName\":\"BillingAddress\",\"relationFromFields\":[\"billingAddressId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankCardId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankCard\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"BankCard\",\"relationName\":\"BankCardToContract\",\"relationFromFields\":[\"bankCardId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"identityDocumentId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"identityDocument\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"IdentityDocument\",\"relationName\":\"ContractToIdentityDocument\",\"relationFromFields\":[\"identityDocumentId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"salesPlatformId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"salesPlatform\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"SalesPlatform\",\"relationName\":\"ContractToSalesPlatform\",\"relationFromFields\":[\"salesPlatformId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationPeriodId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationPeriod\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CancellationPeriod\",\"relationName\":\"CancellationPeriodToContract\",\"relationFromFields\":[\"cancellationPeriodId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractDurationId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractDuration\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractDuration\",\"relationName\":\"ContractToContractDuration\",\"relationFromFields\":[\"contractDurationId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractHistory\",\"relationFromFields\":[\"previousContractId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"followUpContract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractHistory\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousProviderId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousProvider\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Provider\",\"relationName\":\"PreviousProvider\",\"relationFromFields\":[\"previousProviderId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousCustomerNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContractNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"providerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provider\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Provider\",\"relationName\":\"ContractToProvider\",\"relationFromFields\":[\"providerId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariffId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariff\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Tariff\",\"relationName\":\"ContractToTariff\",\"relationFromFields\":[\"tariffId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"providerName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariffName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerNumberAtProvider\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractNumberAtProvider\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceFirst12Months\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceFrom13Months\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceAfter24Months\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"startDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"endDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"commission\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationLetterPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationLetterOptionsPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationOptionsPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationOptionsDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"wasSpecialCancellation\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalUsername\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmailId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmail\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"StressfreiEmail\",\"relationName\":\"ContractToStressfreiEmail\",\"relationFromFields\":[\"stressfreiEmailId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"nextReviewDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EnergyContractDetails\",\"relationName\":\"ContractToEnergyContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"InternetContractDetails\",\"relationName\":\"ContractToInternetContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobileDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MobileContractDetails\",\"relationName\":\"ContractToMobileContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tvDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"TvContractDetails\",\"relationName\":\"ContractToTvContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"carInsuranceDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CarInsuranceDetails\",\"relationName\":\"CarInsuranceDetailsToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tasks\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractTask\",\"relationName\":\"ContractToContractTask\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"assignedEmails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CachedEmail\",\"relationName\":\"CachedEmailToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractTask\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractTask\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"title\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"ContractTaskStatus\",\"default\":\"OPEN\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"visibleInPortal\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"completedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"subtasks\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractTaskSubtask\",\"relationName\":\"ContractTaskToContractTaskSubtask\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractTaskSubtask\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"taskId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"task\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractTask\",\"relationName\":\"ContractTaskToContractTaskSubtask\",\"relationFromFields\":[\"taskId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"title\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"ContractTaskStatus\",\"default\":\"OPEN\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"completedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EnergyContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToEnergyContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meterId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meter\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Meter\",\"relationName\":\"EnergyContractDetailsToMeter\",\"relationFromFields\":[\"meterId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"maloId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"annualConsumption\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"annualConsumptionKwh\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"basePrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unitPrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bonus\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousProviderName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousCustomerNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"invoices\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Invoice\",\"relationName\":\"EnergyContractDetailsToInvoice\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Invoice\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyContractDetailsId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyContractDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EnergyContractDetails\",\"relationName\":\"EnergyContractDetailsToInvoice\",\"relationFromFields\":[\"energyContractDetailsId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"invoiceDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"invoiceType\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"InvoiceType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"InternetContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToInternetContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"downloadSpeed\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"uploadSpeed\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"routerModel\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"routerSerialNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"installationDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetUsername\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"homeId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"activationCode\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumbers\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PhoneNumber\",\"relationName\":\"InternetContractDetailsToPhoneNumber\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"PhoneNumber\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetContractDetailsId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"InternetContractDetails\",\"relationName\":\"InternetContractDetailsToPhoneNumber\",\"relationFromFields\":[\"internetContractDetailsId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isMain\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sipUsername\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sipPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sipServer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"MobileContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToMobileContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"requiresMultisim\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"dataVolume\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"includedMinutes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"includedSMS\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deviceModel\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deviceImei\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"simCards\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"SimCard\",\"relationName\":\"MobileContractDetailsToSimCard\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"simCardNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"SimCard\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobileDetailsId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobileDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MobileContractDetails\",\"relationName\":\"MobileContractDetailsToSimCard\",\"relationFromFields\":[\"mobileDetailsId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"simCardNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"pin\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"puk\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isMultisim\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isMain\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"TvContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToTvContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"receiverModel\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smartcardNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"package\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CarInsuranceDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"CarInsuranceDetailsToContract\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"licensePlate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hsn\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tsn\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vin\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vehicleType\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"firstRegistration\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"noClaimsClass\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"insuranceType\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"InsuranceType\",\"default\":\"LIABILITY\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deductiblePartial\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deductibleFull\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"policyNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousInsurer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false}},\"enums\":{\"CustomerType\":{\"values\":[{\"name\":\"PRIVATE\",\"dbName\":null},{\"name\":\"BUSINESS\",\"dbName\":null}],\"dbName\":null},\"AddressType\":{\"values\":[{\"name\":\"DELIVERY_RESIDENCE\",\"dbName\":null},{\"name\":\"BILLING\",\"dbName\":null}],\"dbName\":null},\"DocumentType\":{\"values\":[{\"name\":\"ID_CARD\",\"dbName\":null},{\"name\":\"PASSPORT\",\"dbName\":null},{\"name\":\"DRIVERS_LICENSE\",\"dbName\":null},{\"name\":\"OTHER\",\"dbName\":null}],\"dbName\":null},\"EmailProviderType\":{\"values\":[{\"name\":\"PLESK\",\"dbName\":null},{\"name\":\"CPANEL\",\"dbName\":null},{\"name\":\"DIRECTADMIN\",\"dbName\":null}],\"dbName\":null},\"MailEncryption\":{\"values\":[{\"name\":\"SSL\",\"dbName\":null},{\"name\":\"STARTTLS\",\"dbName\":null},{\"name\":\"NONE\",\"dbName\":null}],\"dbName\":null},\"EmailFolder\":{\"values\":[{\"name\":\"INBOX\",\"dbName\":null},{\"name\":\"SENT\",\"dbName\":null}],\"dbName\":null},\"MeterType\":{\"values\":[{\"name\":\"ELECTRICITY\",\"dbName\":null},{\"name\":\"GAS\",\"dbName\":null}],\"dbName\":null},\"ContractType\":{\"values\":[{\"name\":\"ELECTRICITY\",\"dbName\":null},{\"name\":\"GAS\",\"dbName\":null},{\"name\":\"DSL\",\"dbName\":null},{\"name\":\"CABLE\",\"dbName\":null},{\"name\":\"FIBER\",\"dbName\":null},{\"name\":\"MOBILE\",\"dbName\":null},{\"name\":\"TV\",\"dbName\":null},{\"name\":\"CAR_INSURANCE\",\"dbName\":null}],\"dbName\":null},\"ContractStatus\":{\"values\":[{\"name\":\"DRAFT\",\"dbName\":null},{\"name\":\"PENDING\",\"dbName\":null},{\"name\":\"ACTIVE\",\"dbName\":null},{\"name\":\"CANCELLED\",\"dbName\":null},{\"name\":\"EXPIRED\",\"dbName\":null},{\"name\":\"DEACTIVATED\",\"dbName\":null}],\"dbName\":null},\"ContractTaskStatus\":{\"values\":[{\"name\":\"OPEN\",\"dbName\":null},{\"name\":\"COMPLETED\",\"dbName\":null}],\"dbName\":null},\"InvoiceType\":{\"values\":[{\"name\":\"INTERIM\",\"dbName\":null},{\"name\":\"FINAL\",\"dbName\":null},{\"name\":\"NOT_AVAILABLE\",\"dbName\":null}],\"dbName\":null},\"InsuranceType\":{\"values\":[{\"name\":\"LIABILITY\",\"dbName\":null},{\"name\":\"PARTIAL\",\"dbName\":null},{\"name\":\"FULL\",\"dbName\":null}],\"dbName\":null}},\"types\":{}}") +config.runtimeDataModel = JSON.parse("{\"models\":{\"AppSetting\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"key\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"User\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"password\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"firstName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"lastName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tokenInvalidatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToUser\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"roles\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"UserRole\",\"relationName\":\"UserToUserRole\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Role\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"permissions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"RolePermission\",\"relationName\":\"RoleToRolePermission\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"users\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"UserRole\",\"relationName\":\"RoleToUserRole\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Permission\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"resource\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"action\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"roles\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"RolePermission\",\"relationName\":\"PermissionToRolePermission\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[[\"resource\",\"action\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"resource\",\"action\"]}],\"isGenerated\":false},\"RolePermission\":{\"dbName\":null,\"fields\":[{\"name\":\"roleId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"permissionId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Role\",\"relationName\":\"RoleToRolePermission\",\"relationFromFields\":[\"roleId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"permission\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Permission\",\"relationName\":\"PermissionToRolePermission\",\"relationFromFields\":[\"permissionId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":{\"name\":null,\"fields\":[\"roleId\",\"permissionId\"]},\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"UserRole\":{\"dbName\":null,\"fields\":[{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"roleId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"UserToUserRole\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Role\",\"relationName\":\"RoleToUserRole\",\"relationFromFields\":[\"roleId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":{\"name\":null,\"fields\":[\"userId\",\"roleId\"]},\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Customer\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"CustomerType\",\"default\":\"PRIVATE\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"salutation\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"firstName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"lastName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"companyName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"foundingDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"birthDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"birthPlace\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phone\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobile\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"taxNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"businessRegistrationPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"commercialRegisterPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"commercialRegisterNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"privacyPolicyPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalEnabled\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalEmail\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalPasswordHash\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalLastLogin\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"CustomerToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"addresses\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Address\",\"relationName\":\"AddressToCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankCards\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"BankCard\",\"relationName\":\"BankCardToCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"identityDocuments\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"IdentityDocument\",\"relationName\":\"CustomerToIdentityDocument\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meters\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Meter\",\"relationName\":\"CustomerToMeter\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"StressfreiEmail\",\"relationName\":\"CustomerToStressfreiEmail\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representingFor\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CustomerRepresentative\",\"relationName\":\"RepresentativeCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representedBy\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CustomerRepresentative\",\"relationName\":\"RepresentedCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CustomerRepresentative\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"RepresentedCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representativeId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representative\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"RepresentativeCustomer\",\"relationFromFields\":[\"representativeId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"customerId\",\"representativeId\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"customerId\",\"representativeId\"]}],\"isGenerated\":false},\"Address\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"AddressToCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"AddressType\",\"default\":\"DELIVERY_RESIDENCE\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"street\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"houseNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"postalCode\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"city\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"country\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"Deutschland\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isDefault\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractsAsDelivery\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"DeliveryAddress\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractsAsBilling\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"BillingAddress\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"BankCard\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"BankCardToCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"accountHolder\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"iban\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bic\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"expiryDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"BankCardToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"IdentityDocument\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToIdentityDocument\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DocumentType\",\"default\":\"ID_CARD\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"issuingAuthority\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"issueDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"expiryDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"licenseClasses\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"licenseIssueDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToIdentityDocument\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EmailProviderConfig\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EmailProviderType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"apiUrl\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"apiKey\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"username\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"passwordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"domain\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"defaultForwardEmail\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"imapServer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"imapPort\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":993,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smtpServer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smtpPort\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":465,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"imapEncryption\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"MailEncryption\",\"default\":\"SSL\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smtpEncryption\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"MailEncryption\",\"default\":\"SSL\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"allowSelfSignedCerts\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isDefault\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"StressfreiEmail\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToStressfreiEmail\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"platform\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isProvisioned\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provisionedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provisionError\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hasMailbox\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"emailPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToStressfreiEmail\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cachedEmails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CachedEmail\",\"relationName\":\"CachedEmailToStressfreiEmail\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CachedEmail\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmailId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmail\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"StressfreiEmail\",\"relationName\":\"CachedEmailToStressfreiEmail\",\"relationFromFields\":[\"stressfreiEmailId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"folder\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"EmailFolder\",\"default\":\"INBOX\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"messageId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"uid\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"subject\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"fromAddress\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"fromName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"toAddresses\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ccAddresses\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"receivedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"textBody\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"htmlBody\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hasAttachments\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"attachmentNames\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"CachedEmailToContract\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"SetNull\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"assignedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"assignedBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isAutoAssigned\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isRead\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isStarred\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isDeleted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"stressfreiEmailId\",\"messageId\",\"folder\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"stressfreiEmailId\",\"messageId\",\"folder\"]}],\"isGenerated\":false},\"Meter\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToMeter\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meterNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MeterType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"location\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"readings\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MeterReading\",\"relationName\":\"MeterToMeterReading\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyDetails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EnergyContractDetails\",\"relationName\":\"EnergyContractDetailsToMeter\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"MeterReading\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meterId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meter\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Meter\",\"relationName\":\"MeterToMeterReading\",\"relationFromFields\":[\"meterId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"readingDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unit\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"kWh\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"SalesPlatform\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contactInfo\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToSalesPlatform\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CancellationPeriod\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"CancellationPeriodToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractDuration\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractDuration\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Provider\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalUrl\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"usernameFieldName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"passwordFieldName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariffs\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Tariff\",\"relationName\":\"ProviderToTariff\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToProvider\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"PreviousProvider\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Tariff\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"providerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provider\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Provider\",\"relationName\":\"ProviderToTariff\",\"relationFromFields\":[\"providerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToTariff\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"providerId\",\"name\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"providerId\",\"name\"]}],\"isGenerated\":false},\"ContractCategory\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"icon\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"color\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sortOrder\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":0,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractCategory\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Contract\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"ContractToCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"ContractStatus\",\"default\":\"DRAFT\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractCategoryId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractCategory\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractCategory\",\"relationName\":\"ContractToContractCategory\",\"relationFromFields\":[\"contractCategoryId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"addressId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"address\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Address\",\"relationName\":\"DeliveryAddress\",\"relationFromFields\":[\"addressId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"billingAddressId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"billingAddress\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Address\",\"relationName\":\"BillingAddress\",\"relationFromFields\":[\"billingAddressId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankCardId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankCard\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"BankCard\",\"relationName\":\"BankCardToContract\",\"relationFromFields\":[\"bankCardId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"identityDocumentId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"identityDocument\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"IdentityDocument\",\"relationName\":\"ContractToIdentityDocument\",\"relationFromFields\":[\"identityDocumentId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"salesPlatformId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"salesPlatform\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"SalesPlatform\",\"relationName\":\"ContractToSalesPlatform\",\"relationFromFields\":[\"salesPlatformId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationPeriodId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationPeriod\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CancellationPeriod\",\"relationName\":\"CancellationPeriodToContract\",\"relationFromFields\":[\"cancellationPeriodId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractDurationId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractDuration\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractDuration\",\"relationName\":\"ContractToContractDuration\",\"relationFromFields\":[\"contractDurationId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractHistory\",\"relationFromFields\":[\"previousContractId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"followUpContract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractHistory\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousProviderId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousProvider\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Provider\",\"relationName\":\"PreviousProvider\",\"relationFromFields\":[\"previousProviderId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousCustomerNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContractNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"providerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provider\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Provider\",\"relationName\":\"ContractToProvider\",\"relationFromFields\":[\"providerId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariffId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariff\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Tariff\",\"relationName\":\"ContractToTariff\",\"relationFromFields\":[\"tariffId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"providerName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariffName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerNumberAtProvider\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractNumberAtProvider\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceFirst12Months\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceFrom13Months\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceAfter24Months\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"startDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"endDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"commission\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationLetterPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationLetterOptionsPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationOptionsPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationOptionsDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"wasSpecialCancellation\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalUsername\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmailId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmail\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"StressfreiEmail\",\"relationName\":\"ContractToStressfreiEmail\",\"relationFromFields\":[\"stressfreiEmailId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"nextReviewDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EnergyContractDetails\",\"relationName\":\"ContractToEnergyContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"InternetContractDetails\",\"relationName\":\"ContractToInternetContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobileDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MobileContractDetails\",\"relationName\":\"ContractToMobileContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tvDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"TvContractDetails\",\"relationName\":\"ContractToTvContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"carInsuranceDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CarInsuranceDetails\",\"relationName\":\"CarInsuranceDetailsToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tasks\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractTask\",\"relationName\":\"ContractToContractTask\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"assignedEmails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CachedEmail\",\"relationName\":\"CachedEmailToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"historyEntries\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractHistoryEntry\",\"relationName\":\"ContractToContractHistoryEntry\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractHistoryEntry\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractHistoryEntry\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"title\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isAutomatic\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractTask\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractTask\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"title\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"ContractTaskStatus\",\"default\":\"OPEN\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"visibleInPortal\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"completedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"subtasks\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractTaskSubtask\",\"relationName\":\"ContractTaskToContractTaskSubtask\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractTaskSubtask\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"taskId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"task\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractTask\",\"relationName\":\"ContractTaskToContractTaskSubtask\",\"relationFromFields\":[\"taskId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"title\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"ContractTaskStatus\",\"default\":\"OPEN\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"completedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EnergyContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToEnergyContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meterId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meter\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Meter\",\"relationName\":\"EnergyContractDetailsToMeter\",\"relationFromFields\":[\"meterId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"maloId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"annualConsumption\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"annualConsumptionKwh\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"basePrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unitPrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bonus\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousProviderName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousCustomerNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"invoices\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Invoice\",\"relationName\":\"EnergyContractDetailsToInvoice\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Invoice\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyContractDetailsId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyContractDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EnergyContractDetails\",\"relationName\":\"EnergyContractDetailsToInvoice\",\"relationFromFields\":[\"energyContractDetailsId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"invoiceDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"invoiceType\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"InvoiceType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"InternetContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToInternetContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"downloadSpeed\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"uploadSpeed\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"routerModel\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"routerSerialNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"installationDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetUsername\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"homeId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"activationCode\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumbers\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PhoneNumber\",\"relationName\":\"InternetContractDetailsToPhoneNumber\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"PhoneNumber\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetContractDetailsId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"InternetContractDetails\",\"relationName\":\"InternetContractDetailsToPhoneNumber\",\"relationFromFields\":[\"internetContractDetailsId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isMain\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sipUsername\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sipPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sipServer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"MobileContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToMobileContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"requiresMultisim\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"dataVolume\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"includedMinutes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"includedSMS\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deviceModel\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deviceImei\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"simCards\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"SimCard\",\"relationName\":\"MobileContractDetailsToSimCard\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"simCardNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"SimCard\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobileDetailsId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobileDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MobileContractDetails\",\"relationName\":\"MobileContractDetailsToSimCard\",\"relationFromFields\":[\"mobileDetailsId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"simCardNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"pin\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"puk\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isMultisim\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isMain\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"TvContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToTvContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"receiverModel\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smartcardNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"package\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CarInsuranceDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"CarInsuranceDetailsToContract\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"licensePlate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hsn\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tsn\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vin\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vehicleType\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"firstRegistration\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"noClaimsClass\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"insuranceType\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"InsuranceType\",\"default\":\"LIABILITY\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deductiblePartial\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deductibleFull\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"policyNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousInsurer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false}},\"enums\":{\"CustomerType\":{\"values\":[{\"name\":\"PRIVATE\",\"dbName\":null},{\"name\":\"BUSINESS\",\"dbName\":null}],\"dbName\":null},\"AddressType\":{\"values\":[{\"name\":\"DELIVERY_RESIDENCE\",\"dbName\":null},{\"name\":\"BILLING\",\"dbName\":null}],\"dbName\":null},\"DocumentType\":{\"values\":[{\"name\":\"ID_CARD\",\"dbName\":null},{\"name\":\"PASSPORT\",\"dbName\":null},{\"name\":\"DRIVERS_LICENSE\",\"dbName\":null},{\"name\":\"OTHER\",\"dbName\":null}],\"dbName\":null},\"EmailProviderType\":{\"values\":[{\"name\":\"PLESK\",\"dbName\":null},{\"name\":\"CPANEL\",\"dbName\":null},{\"name\":\"DIRECTADMIN\",\"dbName\":null}],\"dbName\":null},\"MailEncryption\":{\"values\":[{\"name\":\"SSL\",\"dbName\":null},{\"name\":\"STARTTLS\",\"dbName\":null},{\"name\":\"NONE\",\"dbName\":null}],\"dbName\":null},\"EmailFolder\":{\"values\":[{\"name\":\"INBOX\",\"dbName\":null},{\"name\":\"SENT\",\"dbName\":null}],\"dbName\":null},\"MeterType\":{\"values\":[{\"name\":\"ELECTRICITY\",\"dbName\":null},{\"name\":\"GAS\",\"dbName\":null}],\"dbName\":null},\"ContractType\":{\"values\":[{\"name\":\"ELECTRICITY\",\"dbName\":null},{\"name\":\"GAS\",\"dbName\":null},{\"name\":\"DSL\",\"dbName\":null},{\"name\":\"CABLE\",\"dbName\":null},{\"name\":\"FIBER\",\"dbName\":null},{\"name\":\"MOBILE\",\"dbName\":null},{\"name\":\"TV\",\"dbName\":null},{\"name\":\"CAR_INSURANCE\",\"dbName\":null}],\"dbName\":null},\"ContractStatus\":{\"values\":[{\"name\":\"DRAFT\",\"dbName\":null},{\"name\":\"PENDING\",\"dbName\":null},{\"name\":\"ACTIVE\",\"dbName\":null},{\"name\":\"CANCELLED\",\"dbName\":null},{\"name\":\"EXPIRED\",\"dbName\":null},{\"name\":\"DEACTIVATED\",\"dbName\":null}],\"dbName\":null},\"ContractTaskStatus\":{\"values\":[{\"name\":\"OPEN\",\"dbName\":null},{\"name\":\"COMPLETED\",\"dbName\":null}],\"dbName\":null},\"InvoiceType\":{\"values\":[{\"name\":\"INTERIM\",\"dbName\":null},{\"name\":\"FINAL\",\"dbName\":null},{\"name\":\"NOT_AVAILABLE\",\"dbName\":null}],\"dbName\":null},\"InsuranceType\":{\"values\":[{\"name\":\"LIABILITY\",\"dbName\":null},{\"name\":\"PARTIAL\",\"dbName\":null},{\"name\":\"FULL\",\"dbName\":null}],\"dbName\":null}},\"types\":{}}") defineDmmfProperty(exports.Prisma, config.runtimeDataModel) config.engineWasm = undefined diff --git a/backend/node_modules/.prisma/client/index-browser.js b/backend/node_modules/.prisma/client/index-browser.js index ffc29f95..5dc32177 100644 --- a/backend/node_modules/.prisma/client/index-browser.js +++ b/backend/node_modules/.prisma/client/index-browser.js @@ -443,6 +443,16 @@ exports.Prisma.ContractScalarFieldEnum = { updatedAt: 'updatedAt' }; +exports.Prisma.ContractHistoryEntryScalarFieldEnum = { + id: 'id', + contractId: 'contractId', + title: 'title', + description: 'description', + isAutomatic: 'isAutomatic', + createdBy: 'createdBy', + createdAt: 'createdAt' +}; + exports.Prisma.ContractTaskScalarFieldEnum = { id: 'id', contractId: 'contractId', @@ -676,6 +686,7 @@ exports.Prisma.ModelName = { Tariff: 'Tariff', ContractCategory: 'ContractCategory', Contract: 'Contract', + ContractHistoryEntry: 'ContractHistoryEntry', ContractTask: 'ContractTask', ContractTaskSubtask: 'ContractTaskSubtask', EnergyContractDetails: 'EnergyContractDetails', diff --git a/backend/node_modules/.prisma/client/index.d.ts b/backend/node_modules/.prisma/client/index.d.ts index fd966023..aceb7673 100644 --- a/backend/node_modules/.prisma/client/index.d.ts +++ b/backend/node_modules/.prisma/client/index.d.ts @@ -128,6 +128,11 @@ export type ContractCategory = $Result.DefaultSelection +/** + * Model ContractHistoryEntry + * + */ +export type ContractHistoryEntry = $Result.DefaultSelection /** * Model ContractTask * @@ -697,6 +702,16 @@ export class PrismaClient< */ get contract(): Prisma.ContractDelegate; + /** + * `prisma.contractHistoryEntry`: Exposes CRUD operations for the **ContractHistoryEntry** model. + * Example usage: + * ```ts + * // Fetch zero or more ContractHistoryEntries + * const contractHistoryEntries = await prisma.contractHistoryEntry.findMany() + * ``` + */ + get contractHistoryEntry(): Prisma.ContractHistoryEntryDelegate; + /** * `prisma.contractTask`: Exposes CRUD operations for the **ContractTask** model. * Example usage: @@ -1260,6 +1275,7 @@ export namespace Prisma { Tariff: 'Tariff', ContractCategory: 'ContractCategory', Contract: 'Contract', + ContractHistoryEntry: 'ContractHistoryEntry', ContractTask: 'ContractTask', ContractTaskSubtask: 'ContractTaskSubtask', EnergyContractDetails: 'EnergyContractDetails', @@ -1285,7 +1301,7 @@ export namespace Prisma { export type TypeMap = { meta: { - modelProps: "appSetting" | "user" | "role" | "permission" | "rolePermission" | "userRole" | "customer" | "customerRepresentative" | "address" | "bankCard" | "identityDocument" | "emailProviderConfig" | "stressfreiEmail" | "cachedEmail" | "meter" | "meterReading" | "salesPlatform" | "cancellationPeriod" | "contractDuration" | "provider" | "tariff" | "contractCategory" | "contract" | "contractTask" | "contractTaskSubtask" | "energyContractDetails" | "invoice" | "internetContractDetails" | "phoneNumber" | "mobileContractDetails" | "simCard" | "tvContractDetails" | "carInsuranceDetails" + modelProps: "appSetting" | "user" | "role" | "permission" | "rolePermission" | "userRole" | "customer" | "customerRepresentative" | "address" | "bankCard" | "identityDocument" | "emailProviderConfig" | "stressfreiEmail" | "cachedEmail" | "meter" | "meterReading" | "salesPlatform" | "cancellationPeriod" | "contractDuration" | "provider" | "tariff" | "contractCategory" | "contract" | "contractHistoryEntry" | "contractTask" | "contractTaskSubtask" | "energyContractDetails" | "invoice" | "internetContractDetails" | "phoneNumber" | "mobileContractDetails" | "simCard" | "tvContractDetails" | "carInsuranceDetails" txIsolationLevel: Prisma.TransactionIsolationLevel } model: { @@ -2807,6 +2823,72 @@ export namespace Prisma { } } } + ContractHistoryEntry: { + payload: Prisma.$ContractHistoryEntryPayload + fields: Prisma.ContractHistoryEntryFieldRefs + operations: { + findUnique: { + args: Prisma.ContractHistoryEntryFindUniqueArgs + result: $Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.ContractHistoryEntryFindUniqueOrThrowArgs + result: $Utils.PayloadToResult + } + findFirst: { + args: Prisma.ContractHistoryEntryFindFirstArgs + result: $Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.ContractHistoryEntryFindFirstOrThrowArgs + result: $Utils.PayloadToResult + } + findMany: { + args: Prisma.ContractHistoryEntryFindManyArgs + result: $Utils.PayloadToResult[] + } + create: { + args: Prisma.ContractHistoryEntryCreateArgs + result: $Utils.PayloadToResult + } + createMany: { + args: Prisma.ContractHistoryEntryCreateManyArgs + result: BatchPayload + } + delete: { + args: Prisma.ContractHistoryEntryDeleteArgs + result: $Utils.PayloadToResult + } + update: { + args: Prisma.ContractHistoryEntryUpdateArgs + result: $Utils.PayloadToResult + } + deleteMany: { + args: Prisma.ContractHistoryEntryDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.ContractHistoryEntryUpdateManyArgs + result: BatchPayload + } + upsert: { + args: Prisma.ContractHistoryEntryUpsertArgs + result: $Utils.PayloadToResult + } + aggregate: { + args: Prisma.ContractHistoryEntryAggregateArgs + result: $Utils.Optional + } + groupBy: { + args: Prisma.ContractHistoryEntryGroupByArgs + result: $Utils.Optional[] + } + count: { + args: Prisma.ContractHistoryEntryCountArgs + result: $Utils.Optional | number + } + } + } ContractTask: { payload: Prisma.$ContractTaskPayload fields: Prisma.ContractTaskFieldRefs @@ -4212,11 +4294,13 @@ export namespace Prisma { export type ContractCountOutputType = { tasks: number assignedEmails: number + historyEntries: number } export type ContractCountOutputTypeSelect = { tasks?: boolean | ContractCountOutputTypeCountTasksArgs assignedEmails?: boolean | ContractCountOutputTypeCountAssignedEmailsArgs + historyEntries?: boolean | ContractCountOutputTypeCountHistoryEntriesArgs } // Custom InputTypes @@ -4244,6 +4328,13 @@ export namespace Prisma { where?: CachedEmailWhereInput } + /** + * ContractCountOutputType without action + */ + export type ContractCountOutputTypeCountHistoryEntriesArgs = { + where?: ContractHistoryEntryWhereInput + } + /** * Count Type ContractTaskCountOutputType @@ -26853,6 +26944,7 @@ export namespace Prisma { carInsuranceDetails?: boolean | Contract$carInsuranceDetailsArgs tasks?: boolean | Contract$tasksArgs assignedEmails?: boolean | Contract$assignedEmailsArgs + historyEntries?: boolean | Contract$historyEntriesArgs _count?: boolean | ContractCountOutputTypeDefaultArgs }, ExtArgs["result"]["contract"]> @@ -26926,6 +27018,7 @@ export namespace Prisma { carInsuranceDetails?: boolean | Contract$carInsuranceDetailsArgs tasks?: boolean | Contract$tasksArgs assignedEmails?: boolean | Contract$assignedEmailsArgs + historyEntries?: boolean | Contract$historyEntriesArgs _count?: boolean | ContractCountOutputTypeDefaultArgs } @@ -26954,6 +27047,7 @@ export namespace Prisma { carInsuranceDetails: Prisma.$CarInsuranceDetailsPayload | null tasks: Prisma.$ContractTaskPayload[] assignedEmails: Prisma.$CachedEmailPayload[] + historyEntries: Prisma.$ContractHistoryEntryPayload[] } scalars: $Extensions.GetPayloadResult<{ id: number @@ -27361,6 +27455,7 @@ export namespace Prisma { carInsuranceDetails = {}>(args?: Subset>): Prisma__CarInsuranceDetailsClient<$Result.GetResult, T, "findUniqueOrThrow"> | null, null, ExtArgs> tasks = {}>(args?: Subset>): Prisma.PrismaPromise<$Result.GetResult, T, "findMany"> | Null> assignedEmails = {}>(args?: Subset>): Prisma.PrismaPromise<$Result.GetResult, T, "findMany"> | Null> + historyEntries = {}>(args?: Subset>): Prisma.PrismaPromise<$Result.GetResult, T, "findMany"> | Null> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -28056,6 +28151,26 @@ export namespace Prisma { distinct?: CachedEmailScalarFieldEnum | CachedEmailScalarFieldEnum[] } + /** + * Contract.historyEntries + */ + export type Contract$historyEntriesArgs = { + /** + * Select specific fields to fetch from the ContractHistoryEntry + */ + select?: ContractHistoryEntrySelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: ContractHistoryEntryInclude | null + where?: ContractHistoryEntryWhereInput + orderBy?: ContractHistoryEntryOrderByWithRelationInput | ContractHistoryEntryOrderByWithRelationInput[] + cursor?: ContractHistoryEntryWhereUniqueInput + take?: number + skip?: number + distinct?: ContractHistoryEntryScalarFieldEnum | ContractHistoryEntryScalarFieldEnum[] + } + /** * Contract without action */ @@ -28071,6 +28186,945 @@ export namespace Prisma { } + /** + * Model ContractHistoryEntry + */ + + export type AggregateContractHistoryEntry = { + _count: ContractHistoryEntryCountAggregateOutputType | null + _avg: ContractHistoryEntryAvgAggregateOutputType | null + _sum: ContractHistoryEntrySumAggregateOutputType | null + _min: ContractHistoryEntryMinAggregateOutputType | null + _max: ContractHistoryEntryMaxAggregateOutputType | null + } + + export type ContractHistoryEntryAvgAggregateOutputType = { + id: number | null + contractId: number | null + } + + export type ContractHistoryEntrySumAggregateOutputType = { + id: number | null + contractId: number | null + } + + export type ContractHistoryEntryMinAggregateOutputType = { + id: number | null + contractId: number | null + title: string | null + description: string | null + isAutomatic: boolean | null + createdBy: string | null + createdAt: Date | null + } + + export type ContractHistoryEntryMaxAggregateOutputType = { + id: number | null + contractId: number | null + title: string | null + description: string | null + isAutomatic: boolean | null + createdBy: string | null + createdAt: Date | null + } + + export type ContractHistoryEntryCountAggregateOutputType = { + id: number + contractId: number + title: number + description: number + isAutomatic: number + createdBy: number + createdAt: number + _all: number + } + + + export type ContractHistoryEntryAvgAggregateInputType = { + id?: true + contractId?: true + } + + export type ContractHistoryEntrySumAggregateInputType = { + id?: true + contractId?: true + } + + export type ContractHistoryEntryMinAggregateInputType = { + id?: true + contractId?: true + title?: true + description?: true + isAutomatic?: true + createdBy?: true + createdAt?: true + } + + export type ContractHistoryEntryMaxAggregateInputType = { + id?: true + contractId?: true + title?: true + description?: true + isAutomatic?: true + createdBy?: true + createdAt?: true + } + + export type ContractHistoryEntryCountAggregateInputType = { + id?: true + contractId?: true + title?: true + description?: true + isAutomatic?: true + createdBy?: true + createdAt?: true + _all?: true + } + + export type ContractHistoryEntryAggregateArgs = { + /** + * Filter which ContractHistoryEntry to aggregate. + */ + where?: ContractHistoryEntryWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of ContractHistoryEntries to fetch. + */ + orderBy?: ContractHistoryEntryOrderByWithRelationInput | ContractHistoryEntryOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: ContractHistoryEntryWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` ContractHistoryEntries from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` ContractHistoryEntries. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned ContractHistoryEntries + **/ + _count?: true | ContractHistoryEntryCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: ContractHistoryEntryAvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: ContractHistoryEntrySumAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: ContractHistoryEntryMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: ContractHistoryEntryMaxAggregateInputType + } + + export type GetContractHistoryEntryAggregateType = { + [P in keyof T & keyof AggregateContractHistoryEntry]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : GetScalarType + : GetScalarType + } + + + + + export type ContractHistoryEntryGroupByArgs = { + where?: ContractHistoryEntryWhereInput + orderBy?: ContractHistoryEntryOrderByWithAggregationInput | ContractHistoryEntryOrderByWithAggregationInput[] + by: ContractHistoryEntryScalarFieldEnum[] | ContractHistoryEntryScalarFieldEnum + having?: ContractHistoryEntryScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: ContractHistoryEntryCountAggregateInputType | true + _avg?: ContractHistoryEntryAvgAggregateInputType + _sum?: ContractHistoryEntrySumAggregateInputType + _min?: ContractHistoryEntryMinAggregateInputType + _max?: ContractHistoryEntryMaxAggregateInputType + } + + export type ContractHistoryEntryGroupByOutputType = { + id: number + contractId: number + title: string + description: string | null + isAutomatic: boolean + createdBy: string + createdAt: Date + _count: ContractHistoryEntryCountAggregateOutputType | null + _avg: ContractHistoryEntryAvgAggregateOutputType | null + _sum: ContractHistoryEntrySumAggregateOutputType | null + _min: ContractHistoryEntryMinAggregateOutputType | null + _max: ContractHistoryEntryMaxAggregateOutputType | null + } + + type GetContractHistoryEntryGroupByPayload = Prisma.PrismaPromise< + Array< + PickEnumerable & + { + [P in ((keyof T) & (keyof ContractHistoryEntryGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : GetScalarType + : GetScalarType + } + > + > + + + export type ContractHistoryEntrySelect = $Extensions.GetSelect<{ + id?: boolean + contractId?: boolean + title?: boolean + description?: boolean + isAutomatic?: boolean + createdBy?: boolean + createdAt?: boolean + contract?: boolean | ContractDefaultArgs + }, ExtArgs["result"]["contractHistoryEntry"]> + + + export type ContractHistoryEntrySelectScalar = { + id?: boolean + contractId?: boolean + title?: boolean + description?: boolean + isAutomatic?: boolean + createdBy?: boolean + createdAt?: boolean + } + + export type ContractHistoryEntryInclude = { + contract?: boolean | ContractDefaultArgs + } + + export type $ContractHistoryEntryPayload = { + name: "ContractHistoryEntry" + objects: { + contract: Prisma.$ContractPayload + } + scalars: $Extensions.GetPayloadResult<{ + id: number + contractId: number + title: string + description: string | null + isAutomatic: boolean + createdBy: string + createdAt: Date + }, ExtArgs["result"]["contractHistoryEntry"]> + composites: {} + } + + type ContractHistoryEntryGetPayload = $Result.GetResult + + type ContractHistoryEntryCountArgs = + Omit & { + select?: ContractHistoryEntryCountAggregateInputType | true + } + + export interface ContractHistoryEntryDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['ContractHistoryEntry'], meta: { name: 'ContractHistoryEntry' } } + /** + * Find zero or one ContractHistoryEntry that matches the filter. + * @param {ContractHistoryEntryFindUniqueArgs} args - Arguments to find a ContractHistoryEntry + * @example + * // Get one ContractHistoryEntry + * const contractHistoryEntry = await prisma.contractHistoryEntry.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: SelectSubset>): Prisma__ContractHistoryEntryClient<$Result.GetResult, T, "findUnique"> | null, null, ExtArgs> + + /** + * Find one ContractHistoryEntry that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {ContractHistoryEntryFindUniqueOrThrowArgs} args - Arguments to find a ContractHistoryEntry + * @example + * // Get one ContractHistoryEntry + * const contractHistoryEntry = await prisma.contractHistoryEntry.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: SelectSubset>): Prisma__ContractHistoryEntryClient<$Result.GetResult, T, "findUniqueOrThrow">, never, ExtArgs> + + /** + * Find the first ContractHistoryEntry that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractHistoryEntryFindFirstArgs} args - Arguments to find a ContractHistoryEntry + * @example + * // Get one ContractHistoryEntry + * const contractHistoryEntry = await prisma.contractHistoryEntry.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: SelectSubset>): Prisma__ContractHistoryEntryClient<$Result.GetResult, T, "findFirst"> | null, null, ExtArgs> + + /** + * Find the first ContractHistoryEntry that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractHistoryEntryFindFirstOrThrowArgs} args - Arguments to find a ContractHistoryEntry + * @example + * // Get one ContractHistoryEntry + * const contractHistoryEntry = await prisma.contractHistoryEntry.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: SelectSubset>): Prisma__ContractHistoryEntryClient<$Result.GetResult, T, "findFirstOrThrow">, never, ExtArgs> + + /** + * Find zero or more ContractHistoryEntries that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractHistoryEntryFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all ContractHistoryEntries + * const contractHistoryEntries = await prisma.contractHistoryEntry.findMany() + * + * // Get first 10 ContractHistoryEntries + * const contractHistoryEntries = await prisma.contractHistoryEntry.findMany({ take: 10 }) + * + * // Only select the `id` + * const contractHistoryEntryWithIdOnly = await prisma.contractHistoryEntry.findMany({ select: { id: true } }) + * + */ + findMany(args?: SelectSubset>): Prisma.PrismaPromise<$Result.GetResult, T, "findMany">> + + /** + * Create a ContractHistoryEntry. + * @param {ContractHistoryEntryCreateArgs} args - Arguments to create a ContractHistoryEntry. + * @example + * // Create one ContractHistoryEntry + * const ContractHistoryEntry = await prisma.contractHistoryEntry.create({ + * data: { + * // ... data to create a ContractHistoryEntry + * } + * }) + * + */ + create(args: SelectSubset>): Prisma__ContractHistoryEntryClient<$Result.GetResult, T, "create">, never, ExtArgs> + + /** + * Create many ContractHistoryEntries. + * @param {ContractHistoryEntryCreateManyArgs} args - Arguments to create many ContractHistoryEntries. + * @example + * // Create many ContractHistoryEntries + * const contractHistoryEntry = await prisma.contractHistoryEntry.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: SelectSubset>): Prisma.PrismaPromise + + /** + * Delete a ContractHistoryEntry. + * @param {ContractHistoryEntryDeleteArgs} args - Arguments to delete one ContractHistoryEntry. + * @example + * // Delete one ContractHistoryEntry + * const ContractHistoryEntry = await prisma.contractHistoryEntry.delete({ + * where: { + * // ... filter to delete one ContractHistoryEntry + * } + * }) + * + */ + delete(args: SelectSubset>): Prisma__ContractHistoryEntryClient<$Result.GetResult, T, "delete">, never, ExtArgs> + + /** + * Update one ContractHistoryEntry. + * @param {ContractHistoryEntryUpdateArgs} args - Arguments to update one ContractHistoryEntry. + * @example + * // Update one ContractHistoryEntry + * const contractHistoryEntry = await prisma.contractHistoryEntry.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: SelectSubset>): Prisma__ContractHistoryEntryClient<$Result.GetResult, T, "update">, never, ExtArgs> + + /** + * Delete zero or more ContractHistoryEntries. + * @param {ContractHistoryEntryDeleteManyArgs} args - Arguments to filter ContractHistoryEntries to delete. + * @example + * // Delete a few ContractHistoryEntries + * const { count } = await prisma.contractHistoryEntry.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more ContractHistoryEntries. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractHistoryEntryUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many ContractHistoryEntries + * const contractHistoryEntry = await prisma.contractHistoryEntry.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: SelectSubset>): Prisma.PrismaPromise + + /** + * Create or update one ContractHistoryEntry. + * @param {ContractHistoryEntryUpsertArgs} args - Arguments to update or create a ContractHistoryEntry. + * @example + * // Update or create a ContractHistoryEntry + * const contractHistoryEntry = await prisma.contractHistoryEntry.upsert({ + * create: { + * // ... data to create a ContractHistoryEntry + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the ContractHistoryEntry we want to update + * } + * }) + */ + upsert(args: SelectSubset>): Prisma__ContractHistoryEntryClient<$Result.GetResult, T, "upsert">, never, ExtArgs> + + + /** + * Count the number of ContractHistoryEntries. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractHistoryEntryCountArgs} args - Arguments to filter ContractHistoryEntries to count. + * @example + * // Count the number of ContractHistoryEntries + * const count = await prisma.contractHistoryEntry.count({ + * where: { + * // ... the filter for the ContractHistoryEntries we want to count + * } + * }) + **/ + count( + args?: Subset, + ): Prisma.PrismaPromise< + T extends $Utils.Record<'select', any> + ? T['select'] extends true + ? number + : GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a ContractHistoryEntry. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractHistoryEntryAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Subset): Prisma.PrismaPromise> + + /** + * Group by ContractHistoryEntry. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ContractHistoryEntryGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends ContractHistoryEntryGroupByArgs, + HasSelectOrTake extends Or< + Extends<'skip', Keys>, + Extends<'take', Keys> + >, + OrderByArg extends True extends HasSelectOrTake + ? { orderBy: ContractHistoryEntryGroupByArgs['orderBy'] } + : { orderBy?: ContractHistoryEntryGroupByArgs['orderBy'] }, + OrderFields extends ExcludeUnderscoreKeys>>, + ByFields extends MaybeTupleToUnion, + ByValid extends Has, + HavingFields extends GetHavingFields, + HavingValid extends Has, + ByEmpty extends T['by'] extends never[] ? True : False, + InputErrors extends ByEmpty extends True + ? `Error: "by" must not be empty.` + : HavingValid extends False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Keys + ? 'orderBy' extends Keys + ? ByValid extends True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Keys + ? 'orderBy' extends Keys + ? ByValid extends True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: SubsetIntersection & InputErrors): {} extends InputErrors ? GetContractHistoryEntryGroupByPayload : Prisma.PrismaPromise + /** + * Fields of the ContractHistoryEntry model + */ + readonly fields: ContractHistoryEntryFieldRefs; + } + + /** + * The delegate class that acts as a "Promise-like" for ContractHistoryEntry. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ + export interface Prisma__ContractHistoryEntryClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + contract = {}>(args?: Subset>): Prisma__ContractClient<$Result.GetResult, T, "findUniqueOrThrow"> | Null, Null, ExtArgs> + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): $Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): $Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): $Utils.JsPromise + } + + + + + /** + * Fields of the ContractHistoryEntry model + */ + interface ContractHistoryEntryFieldRefs { + readonly id: FieldRef<"ContractHistoryEntry", 'Int'> + readonly contractId: FieldRef<"ContractHistoryEntry", 'Int'> + readonly title: FieldRef<"ContractHistoryEntry", 'String'> + readonly description: FieldRef<"ContractHistoryEntry", 'String'> + readonly isAutomatic: FieldRef<"ContractHistoryEntry", 'Boolean'> + readonly createdBy: FieldRef<"ContractHistoryEntry", 'String'> + readonly createdAt: FieldRef<"ContractHistoryEntry", 'DateTime'> + } + + + // Custom InputTypes + /** + * ContractHistoryEntry findUnique + */ + export type ContractHistoryEntryFindUniqueArgs = { + /** + * Select specific fields to fetch from the ContractHistoryEntry + */ + select?: ContractHistoryEntrySelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: ContractHistoryEntryInclude | null + /** + * Filter, which ContractHistoryEntry to fetch. + */ + where: ContractHistoryEntryWhereUniqueInput + } + + /** + * ContractHistoryEntry findUniqueOrThrow + */ + export type ContractHistoryEntryFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the ContractHistoryEntry + */ + select?: ContractHistoryEntrySelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: ContractHistoryEntryInclude | null + /** + * Filter, which ContractHistoryEntry to fetch. + */ + where: ContractHistoryEntryWhereUniqueInput + } + + /** + * ContractHistoryEntry findFirst + */ + export type ContractHistoryEntryFindFirstArgs = { + /** + * Select specific fields to fetch from the ContractHistoryEntry + */ + select?: ContractHistoryEntrySelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: ContractHistoryEntryInclude | null + /** + * Filter, which ContractHistoryEntry to fetch. + */ + where?: ContractHistoryEntryWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of ContractHistoryEntries to fetch. + */ + orderBy?: ContractHistoryEntryOrderByWithRelationInput | ContractHistoryEntryOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for ContractHistoryEntries. + */ + cursor?: ContractHistoryEntryWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` ContractHistoryEntries from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` ContractHistoryEntries. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of ContractHistoryEntries. + */ + distinct?: ContractHistoryEntryScalarFieldEnum | ContractHistoryEntryScalarFieldEnum[] + } + + /** + * ContractHistoryEntry findFirstOrThrow + */ + export type ContractHistoryEntryFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the ContractHistoryEntry + */ + select?: ContractHistoryEntrySelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: ContractHistoryEntryInclude | null + /** + * Filter, which ContractHistoryEntry to fetch. + */ + where?: ContractHistoryEntryWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of ContractHistoryEntries to fetch. + */ + orderBy?: ContractHistoryEntryOrderByWithRelationInput | ContractHistoryEntryOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for ContractHistoryEntries. + */ + cursor?: ContractHistoryEntryWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` ContractHistoryEntries from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` ContractHistoryEntries. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of ContractHistoryEntries. + */ + distinct?: ContractHistoryEntryScalarFieldEnum | ContractHistoryEntryScalarFieldEnum[] + } + + /** + * ContractHistoryEntry findMany + */ + export type ContractHistoryEntryFindManyArgs = { + /** + * Select specific fields to fetch from the ContractHistoryEntry + */ + select?: ContractHistoryEntrySelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: ContractHistoryEntryInclude | null + /** + * Filter, which ContractHistoryEntries to fetch. + */ + where?: ContractHistoryEntryWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of ContractHistoryEntries to fetch. + */ + orderBy?: ContractHistoryEntryOrderByWithRelationInput | ContractHistoryEntryOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing ContractHistoryEntries. + */ + cursor?: ContractHistoryEntryWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` ContractHistoryEntries from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` ContractHistoryEntries. + */ + skip?: number + distinct?: ContractHistoryEntryScalarFieldEnum | ContractHistoryEntryScalarFieldEnum[] + } + + /** + * ContractHistoryEntry create + */ + export type ContractHistoryEntryCreateArgs = { + /** + * Select specific fields to fetch from the ContractHistoryEntry + */ + select?: ContractHistoryEntrySelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: ContractHistoryEntryInclude | null + /** + * The data needed to create a ContractHistoryEntry. + */ + data: XOR + } + + /** + * ContractHistoryEntry createMany + */ + export type ContractHistoryEntryCreateManyArgs = { + /** + * The data used to create many ContractHistoryEntries. + */ + data: ContractHistoryEntryCreateManyInput | ContractHistoryEntryCreateManyInput[] + skipDuplicates?: boolean + } + + /** + * ContractHistoryEntry update + */ + export type ContractHistoryEntryUpdateArgs = { + /** + * Select specific fields to fetch from the ContractHistoryEntry + */ + select?: ContractHistoryEntrySelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: ContractHistoryEntryInclude | null + /** + * The data needed to update a ContractHistoryEntry. + */ + data: XOR + /** + * Choose, which ContractHistoryEntry to update. + */ + where: ContractHistoryEntryWhereUniqueInput + } + + /** + * ContractHistoryEntry updateMany + */ + export type ContractHistoryEntryUpdateManyArgs = { + /** + * The data used to update ContractHistoryEntries. + */ + data: XOR + /** + * Filter which ContractHistoryEntries to update + */ + where?: ContractHistoryEntryWhereInput + } + + /** + * ContractHistoryEntry upsert + */ + export type ContractHistoryEntryUpsertArgs = { + /** + * Select specific fields to fetch from the ContractHistoryEntry + */ + select?: ContractHistoryEntrySelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: ContractHistoryEntryInclude | null + /** + * The filter to search for the ContractHistoryEntry to update in case it exists. + */ + where: ContractHistoryEntryWhereUniqueInput + /** + * In case the ContractHistoryEntry found by the `where` argument doesn't exist, create a new ContractHistoryEntry with this data. + */ + create: XOR + /** + * In case the ContractHistoryEntry was found with the provided `where` argument, update it with this data. + */ + update: XOR + } + + /** + * ContractHistoryEntry delete + */ + export type ContractHistoryEntryDeleteArgs = { + /** + * Select specific fields to fetch from the ContractHistoryEntry + */ + select?: ContractHistoryEntrySelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: ContractHistoryEntryInclude | null + /** + * Filter which ContractHistoryEntry to delete. + */ + where: ContractHistoryEntryWhereUniqueInput + } + + /** + * ContractHistoryEntry deleteMany + */ + export type ContractHistoryEntryDeleteManyArgs = { + /** + * Filter which ContractHistoryEntries to delete + */ + where?: ContractHistoryEntryWhereInput + } + + /** + * ContractHistoryEntry without action + */ + export type ContractHistoryEntryDefaultArgs = { + /** + * Select specific fields to fetch from the ContractHistoryEntry + */ + select?: ContractHistoryEntrySelect | null + /** + * Choose, which related nodes to fetch as well + */ + include?: ContractHistoryEntryInclude | null + } + + /** * Model ContractTask */ @@ -38304,6 +39358,19 @@ export namespace Prisma { export type ContractScalarFieldEnum = (typeof ContractScalarFieldEnum)[keyof typeof ContractScalarFieldEnum] + export const ContractHistoryEntryScalarFieldEnum: { + id: 'id', + contractId: 'contractId', + title: 'title', + description: 'description', + isAutomatic: 'isAutomatic', + createdBy: 'createdBy', + createdAt: 'createdAt' + }; + + export type ContractHistoryEntryScalarFieldEnum = (typeof ContractHistoryEntryScalarFieldEnum)[keyof typeof ContractHistoryEntryScalarFieldEnum] + + export const ContractTaskScalarFieldEnum: { id: 'id', contractId: 'contractId', @@ -40494,6 +41561,7 @@ export namespace Prisma { carInsuranceDetails?: XOR | null tasks?: ContractTaskListRelationFilter assignedEmails?: CachedEmailListRelationFilter + historyEntries?: ContractHistoryEntryListRelationFilter } export type ContractOrderByWithRelationInput = { @@ -40562,6 +41630,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsOrderByWithRelationInput tasks?: ContractTaskOrderByRelationAggregateInput assignedEmails?: CachedEmailOrderByRelationAggregateInput + historyEntries?: ContractHistoryEntryOrderByRelationAggregateInput } export type ContractWhereUniqueInput = Prisma.AtLeast<{ @@ -40633,6 +41702,7 @@ export namespace Prisma { carInsuranceDetails?: XOR | null tasks?: ContractTaskListRelationFilter assignedEmails?: CachedEmailListRelationFilter + historyEntries?: ContractHistoryEntryListRelationFilter }, "id" | "contractNumber" | "previousContractId"> export type ContractOrderByWithAggregationInput = { @@ -40735,6 +41805,73 @@ export namespace Prisma { updatedAt?: DateTimeWithAggregatesFilter<"Contract"> | Date | string } + export type ContractHistoryEntryWhereInput = { + AND?: ContractHistoryEntryWhereInput | ContractHistoryEntryWhereInput[] + OR?: ContractHistoryEntryWhereInput[] + NOT?: ContractHistoryEntryWhereInput | ContractHistoryEntryWhereInput[] + id?: IntFilter<"ContractHistoryEntry"> | number + contractId?: IntFilter<"ContractHistoryEntry"> | number + title?: StringFilter<"ContractHistoryEntry"> | string + description?: StringNullableFilter<"ContractHistoryEntry"> | string | null + isAutomatic?: BoolFilter<"ContractHistoryEntry"> | boolean + createdBy?: StringFilter<"ContractHistoryEntry"> | string + createdAt?: DateTimeFilter<"ContractHistoryEntry"> | Date | string + contract?: XOR + } + + export type ContractHistoryEntryOrderByWithRelationInput = { + id?: SortOrder + contractId?: SortOrder + title?: SortOrder + description?: SortOrderInput | SortOrder + isAutomatic?: SortOrder + createdBy?: SortOrder + createdAt?: SortOrder + contract?: ContractOrderByWithRelationInput + } + + export type ContractHistoryEntryWhereUniqueInput = Prisma.AtLeast<{ + id?: number + AND?: ContractHistoryEntryWhereInput | ContractHistoryEntryWhereInput[] + OR?: ContractHistoryEntryWhereInput[] + NOT?: ContractHistoryEntryWhereInput | ContractHistoryEntryWhereInput[] + contractId?: IntFilter<"ContractHistoryEntry"> | number + title?: StringFilter<"ContractHistoryEntry"> | string + description?: StringNullableFilter<"ContractHistoryEntry"> | string | null + isAutomatic?: BoolFilter<"ContractHistoryEntry"> | boolean + createdBy?: StringFilter<"ContractHistoryEntry"> | string + createdAt?: DateTimeFilter<"ContractHistoryEntry"> | Date | string + contract?: XOR + }, "id"> + + export type ContractHistoryEntryOrderByWithAggregationInput = { + id?: SortOrder + contractId?: SortOrder + title?: SortOrder + description?: SortOrderInput | SortOrder + isAutomatic?: SortOrder + createdBy?: SortOrder + createdAt?: SortOrder + _count?: ContractHistoryEntryCountOrderByAggregateInput + _avg?: ContractHistoryEntryAvgOrderByAggregateInput + _max?: ContractHistoryEntryMaxOrderByAggregateInput + _min?: ContractHistoryEntryMinOrderByAggregateInput + _sum?: ContractHistoryEntrySumOrderByAggregateInput + } + + export type ContractHistoryEntryScalarWhereWithAggregatesInput = { + AND?: ContractHistoryEntryScalarWhereWithAggregatesInput | ContractHistoryEntryScalarWhereWithAggregatesInput[] + OR?: ContractHistoryEntryScalarWhereWithAggregatesInput[] + NOT?: ContractHistoryEntryScalarWhereWithAggregatesInput | ContractHistoryEntryScalarWhereWithAggregatesInput[] + id?: IntWithAggregatesFilter<"ContractHistoryEntry"> | number + contractId?: IntWithAggregatesFilter<"ContractHistoryEntry"> | number + title?: StringWithAggregatesFilter<"ContractHistoryEntry"> | string + description?: StringNullableWithAggregatesFilter<"ContractHistoryEntry"> | string | null + isAutomatic?: BoolWithAggregatesFilter<"ContractHistoryEntry"> | boolean + createdBy?: StringWithAggregatesFilter<"ContractHistoryEntry"> | string + createdAt?: DateTimeWithAggregatesFilter<"ContractHistoryEntry"> | Date | string + } + export type ContractTaskWhereInput = { AND?: ContractTaskWhereInput | ContractTaskWhereInput[] OR?: ContractTaskWhereInput[] @@ -43558,6 +44695,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateInput = { @@ -43612,6 +44750,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractUpdateInput = { @@ -43665,6 +44804,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateInput = { @@ -43719,6 +44859,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractCreateManyInput = { @@ -43844,6 +44985,72 @@ export namespace Prisma { updatedAt?: DateTimeFieldUpdateOperationsInput | Date | string } + export type ContractHistoryEntryCreateInput = { + title: string + description?: string | null + isAutomatic?: boolean + createdBy: string + createdAt?: Date | string + contract: ContractCreateNestedOneWithoutHistoryEntriesInput + } + + export type ContractHistoryEntryUncheckedCreateInput = { + id?: number + contractId: number + title: string + description?: string | null + isAutomatic?: boolean + createdBy: string + createdAt?: Date | string + } + + export type ContractHistoryEntryUpdateInput = { + title?: StringFieldUpdateOperationsInput | string + description?: NullableStringFieldUpdateOperationsInput | string | null + isAutomatic?: BoolFieldUpdateOperationsInput | boolean + createdBy?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + contract?: ContractUpdateOneRequiredWithoutHistoryEntriesNestedInput + } + + export type ContractHistoryEntryUncheckedUpdateInput = { + id?: IntFieldUpdateOperationsInput | number + contractId?: IntFieldUpdateOperationsInput | number + title?: StringFieldUpdateOperationsInput | string + description?: NullableStringFieldUpdateOperationsInput | string | null + isAutomatic?: BoolFieldUpdateOperationsInput | boolean + createdBy?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + + export type ContractHistoryEntryCreateManyInput = { + id?: number + contractId: number + title: string + description?: string | null + isAutomatic?: boolean + createdBy: string + createdAt?: Date | string + } + + export type ContractHistoryEntryUpdateManyMutationInput = { + title?: StringFieldUpdateOperationsInput | string + description?: NullableStringFieldUpdateOperationsInput | string | null + isAutomatic?: BoolFieldUpdateOperationsInput | boolean + createdBy?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + + export type ContractHistoryEntryUncheckedUpdateManyInput = { + id?: IntFieldUpdateOperationsInput | number + contractId?: IntFieldUpdateOperationsInput | number + title?: StringFieldUpdateOperationsInput | string + description?: NullableStringFieldUpdateOperationsInput | string | null + isAutomatic?: BoolFieldUpdateOperationsInput | boolean + createdBy?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + export type ContractTaskCreateInput = { title: string description?: string | null @@ -46375,10 +47582,20 @@ export namespace Prisma { none?: ContractTaskWhereInput } + export type ContractHistoryEntryListRelationFilter = { + every?: ContractHistoryEntryWhereInput + some?: ContractHistoryEntryWhereInput + none?: ContractHistoryEntryWhereInput + } + export type ContractTaskOrderByRelationAggregateInput = { _count?: SortOrder } + export type ContractHistoryEntryOrderByRelationAggregateInput = { + _count?: SortOrder + } + export type ContractCountOrderByAggregateInput = { id?: SortOrder contractNumber?: SortOrder @@ -46591,6 +47808,51 @@ export namespace Prisma { _max?: NestedFloatNullableFilter<$PrismaModel> } + export type ContractRelationFilter = { + is?: ContractWhereInput + isNot?: ContractWhereInput + } + + export type ContractHistoryEntryCountOrderByAggregateInput = { + id?: SortOrder + contractId?: SortOrder + title?: SortOrder + description?: SortOrder + isAutomatic?: SortOrder + createdBy?: SortOrder + createdAt?: SortOrder + } + + export type ContractHistoryEntryAvgOrderByAggregateInput = { + id?: SortOrder + contractId?: SortOrder + } + + export type ContractHistoryEntryMaxOrderByAggregateInput = { + id?: SortOrder + contractId?: SortOrder + title?: SortOrder + description?: SortOrder + isAutomatic?: SortOrder + createdBy?: SortOrder + createdAt?: SortOrder + } + + export type ContractHistoryEntryMinOrderByAggregateInput = { + id?: SortOrder + contractId?: SortOrder + title?: SortOrder + description?: SortOrder + isAutomatic?: SortOrder + createdBy?: SortOrder + createdAt?: SortOrder + } + + export type ContractHistoryEntrySumOrderByAggregateInput = { + id?: SortOrder + contractId?: SortOrder + } + export type EnumContractTaskStatusFilter<$PrismaModel = never> = { equals?: $Enums.ContractTaskStatus | EnumContractTaskStatusFieldRefInput<$PrismaModel> in?: $Enums.ContractTaskStatus[] @@ -46598,11 +47860,6 @@ export namespace Prisma { not?: NestedEnumContractTaskStatusFilter<$PrismaModel> | $Enums.ContractTaskStatus } - export type ContractRelationFilter = { - is?: ContractWhereInput - isNot?: ContractWhereInput - } - export type ContractTaskSubtaskListRelationFilter = { every?: ContractTaskSubtaskWhereInput some?: ContractTaskSubtaskWhereInput @@ -48852,6 +50109,13 @@ export namespace Prisma { connect?: CachedEmailWhereUniqueInput | CachedEmailWhereUniqueInput[] } + export type ContractHistoryEntryCreateNestedManyWithoutContractInput = { + create?: XOR | ContractHistoryEntryCreateWithoutContractInput[] | ContractHistoryEntryUncheckedCreateWithoutContractInput[] + connectOrCreate?: ContractHistoryEntryCreateOrConnectWithoutContractInput | ContractHistoryEntryCreateOrConnectWithoutContractInput[] + createMany?: ContractHistoryEntryCreateManyContractInputEnvelope + connect?: ContractHistoryEntryWhereUniqueInput | ContractHistoryEntryWhereUniqueInput[] + } + export type ContractUncheckedCreateNestedOneWithoutPreviousContractInput = { create?: XOR connectOrCreate?: ContractCreateOrConnectWithoutPreviousContractInput @@ -48902,6 +50166,13 @@ export namespace Prisma { connect?: CachedEmailWhereUniqueInput | CachedEmailWhereUniqueInput[] } + export type ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput = { + create?: XOR | ContractHistoryEntryCreateWithoutContractInput[] | ContractHistoryEntryUncheckedCreateWithoutContractInput[] + connectOrCreate?: ContractHistoryEntryCreateOrConnectWithoutContractInput | ContractHistoryEntryCreateOrConnectWithoutContractInput[] + createMany?: ContractHistoryEntryCreateManyContractInputEnvelope + connect?: ContractHistoryEntryWhereUniqueInput | ContractHistoryEntryWhereUniqueInput[] + } + export type EnumContractTypeFieldUpdateOperationsInput = { set?: $Enums.ContractType } @@ -49144,6 +50415,20 @@ export namespace Prisma { deleteMany?: CachedEmailScalarWhereInput | CachedEmailScalarWhereInput[] } + export type ContractHistoryEntryUpdateManyWithoutContractNestedInput = { + create?: XOR | ContractHistoryEntryCreateWithoutContractInput[] | ContractHistoryEntryUncheckedCreateWithoutContractInput[] + connectOrCreate?: ContractHistoryEntryCreateOrConnectWithoutContractInput | ContractHistoryEntryCreateOrConnectWithoutContractInput[] + upsert?: ContractHistoryEntryUpsertWithWhereUniqueWithoutContractInput | ContractHistoryEntryUpsertWithWhereUniqueWithoutContractInput[] + createMany?: ContractHistoryEntryCreateManyContractInputEnvelope + set?: ContractHistoryEntryWhereUniqueInput | ContractHistoryEntryWhereUniqueInput[] + disconnect?: ContractHistoryEntryWhereUniqueInput | ContractHistoryEntryWhereUniqueInput[] + delete?: ContractHistoryEntryWhereUniqueInput | ContractHistoryEntryWhereUniqueInput[] + connect?: ContractHistoryEntryWhereUniqueInput | ContractHistoryEntryWhereUniqueInput[] + update?: ContractHistoryEntryUpdateWithWhereUniqueWithoutContractInput | ContractHistoryEntryUpdateWithWhereUniqueWithoutContractInput[] + updateMany?: ContractHistoryEntryUpdateManyWithWhereWithoutContractInput | ContractHistoryEntryUpdateManyWithWhereWithoutContractInput[] + deleteMany?: ContractHistoryEntryScalarWhereInput | ContractHistoryEntryScalarWhereInput[] + } + export type ContractUncheckedUpdateOneWithoutPreviousContractNestedInput = { create?: XOR connectOrCreate?: ContractCreateOrConnectWithoutPreviousContractInput @@ -49232,6 +50517,34 @@ export namespace Prisma { deleteMany?: CachedEmailScalarWhereInput | CachedEmailScalarWhereInput[] } + export type ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput = { + create?: XOR | ContractHistoryEntryCreateWithoutContractInput[] | ContractHistoryEntryUncheckedCreateWithoutContractInput[] + connectOrCreate?: ContractHistoryEntryCreateOrConnectWithoutContractInput | ContractHistoryEntryCreateOrConnectWithoutContractInput[] + upsert?: ContractHistoryEntryUpsertWithWhereUniqueWithoutContractInput | ContractHistoryEntryUpsertWithWhereUniqueWithoutContractInput[] + createMany?: ContractHistoryEntryCreateManyContractInputEnvelope + set?: ContractHistoryEntryWhereUniqueInput | ContractHistoryEntryWhereUniqueInput[] + disconnect?: ContractHistoryEntryWhereUniqueInput | ContractHistoryEntryWhereUniqueInput[] + delete?: ContractHistoryEntryWhereUniqueInput | ContractHistoryEntryWhereUniqueInput[] + connect?: ContractHistoryEntryWhereUniqueInput | ContractHistoryEntryWhereUniqueInput[] + update?: ContractHistoryEntryUpdateWithWhereUniqueWithoutContractInput | ContractHistoryEntryUpdateWithWhereUniqueWithoutContractInput[] + updateMany?: ContractHistoryEntryUpdateManyWithWhereWithoutContractInput | ContractHistoryEntryUpdateManyWithWhereWithoutContractInput[] + deleteMany?: ContractHistoryEntryScalarWhereInput | ContractHistoryEntryScalarWhereInput[] + } + + export type ContractCreateNestedOneWithoutHistoryEntriesInput = { + create?: XOR + connectOrCreate?: ContractCreateOrConnectWithoutHistoryEntriesInput + connect?: ContractWhereUniqueInput + } + + export type ContractUpdateOneRequiredWithoutHistoryEntriesNestedInput = { + create?: XOR + connectOrCreate?: ContractCreateOrConnectWithoutHistoryEntriesInput + upsert?: ContractUpsertWithoutHistoryEntriesInput + connect?: ContractWhereUniqueInput + update?: XOR, ContractUncheckedUpdateWithoutHistoryEntriesInput> + } + export type ContractCreateNestedOneWithoutTasksInput = { create?: XOR connectOrCreate?: ContractCreateOrConnectWithoutTasksInput @@ -50796,6 +52109,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutCustomerInput = { @@ -50849,6 +52163,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutCustomerInput = { @@ -51679,6 +52994,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutAddressInput = { @@ -51732,6 +53048,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutAddressInput = { @@ -51794,6 +53111,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutBillingAddressInput = { @@ -51847,6 +53165,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutBillingAddressInput = { @@ -52103,6 +53422,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutBankCardInput = { @@ -52156,6 +53476,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutBankCardInput = { @@ -52396,6 +53717,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutIdentityDocumentInput = { @@ -52449,6 +53771,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutIdentityDocumentInput = { @@ -52689,6 +54012,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutStressfreiEmailInput = { @@ -52742,6 +54066,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutStressfreiEmailInput = { @@ -53052,6 +54377,7 @@ export namespace Prisma { tvDetails?: TvContractDetailsCreateNestedOneWithoutContractInput carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutAssignedEmailsInput = { @@ -53105,6 +54431,7 @@ export namespace Prisma { tvDetails?: TvContractDetailsUncheckedCreateNestedOneWithoutContractInput carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutAssignedEmailsInput = { @@ -53217,6 +54544,7 @@ export namespace Prisma { tvDetails?: TvContractDetailsUpdateOneWithoutContractNestedInput carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutAssignedEmailsInput = { @@ -53270,6 +54598,7 @@ export namespace Prisma { tvDetails?: TvContractDetailsUncheckedUpdateOneWithoutContractNestedInput carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type CustomerCreateWithoutMetersInput = { @@ -53672,6 +55001,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutSalesPlatformInput = { @@ -53725,6 +55055,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutSalesPlatformInput = { @@ -53803,6 +55134,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutCancellationPeriodInput = { @@ -53856,6 +55188,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutCancellationPeriodInput = { @@ -53934,6 +55267,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutContractDurationInput = { @@ -53987,6 +55321,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutContractDurationInput = { @@ -54092,6 +55427,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutProviderInput = { @@ -54145,6 +55481,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutProviderInput = { @@ -54207,6 +55544,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutPreviousProviderInput = { @@ -54260,6 +55598,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutPreviousProviderInput = { @@ -54412,6 +55751,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutTariffInput = { @@ -54465,6 +55805,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutTariffInput = { @@ -54579,6 +55920,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutContractCategoryInput = { @@ -54632,6 +55974,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutContractCategoryInput = { @@ -55018,6 +56361,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutFollowUpContractInput = { @@ -55071,6 +56415,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutFollowUpContractInput = { @@ -55128,6 +56473,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutPreviousContractInput = { @@ -55181,6 +56527,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutPreviousContractInput = { @@ -55554,6 +56901,33 @@ export namespace Prisma { skipDuplicates?: boolean } + export type ContractHistoryEntryCreateWithoutContractInput = { + title: string + description?: string | null + isAutomatic?: boolean + createdBy: string + createdAt?: Date | string + } + + export type ContractHistoryEntryUncheckedCreateWithoutContractInput = { + id?: number + title: string + description?: string | null + isAutomatic?: boolean + createdBy: string + createdAt?: Date | string + } + + export type ContractHistoryEntryCreateOrConnectWithoutContractInput = { + where: ContractHistoryEntryWhereUniqueInput + create: XOR + } + + export type ContractHistoryEntryCreateManyContractInputEnvelope = { + data: ContractHistoryEntryCreateManyContractInput | ContractHistoryEntryCreateManyContractInput[] + skipDuplicates?: boolean + } + export type CustomerUpsertWithoutContractsInput = { update: XOR create: XOR @@ -55977,6 +57351,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutFollowUpContractInput = { @@ -56030,6 +57405,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUpsertWithoutPreviousContractInput = { @@ -56093,6 +57469,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutPreviousContractInput = { @@ -56146,6 +57523,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ProviderUpsertWithoutPreviousContractsInput = { @@ -56518,6 +57896,265 @@ export namespace Prisma { data: XOR } + export type ContractHistoryEntryUpsertWithWhereUniqueWithoutContractInput = { + where: ContractHistoryEntryWhereUniqueInput + update: XOR + create: XOR + } + + export type ContractHistoryEntryUpdateWithWhereUniqueWithoutContractInput = { + where: ContractHistoryEntryWhereUniqueInput + data: XOR + } + + export type ContractHistoryEntryUpdateManyWithWhereWithoutContractInput = { + where: ContractHistoryEntryScalarWhereInput + data: XOR + } + + export type ContractHistoryEntryScalarWhereInput = { + AND?: ContractHistoryEntryScalarWhereInput | ContractHistoryEntryScalarWhereInput[] + OR?: ContractHistoryEntryScalarWhereInput[] + NOT?: ContractHistoryEntryScalarWhereInput | ContractHistoryEntryScalarWhereInput[] + id?: IntFilter<"ContractHistoryEntry"> | number + contractId?: IntFilter<"ContractHistoryEntry"> | number + title?: StringFilter<"ContractHistoryEntry"> | string + description?: StringNullableFilter<"ContractHistoryEntry"> | string | null + isAutomatic?: BoolFilter<"ContractHistoryEntry"> | boolean + createdBy?: StringFilter<"ContractHistoryEntry"> | string + createdAt?: DateTimeFilter<"ContractHistoryEntry"> | Date | string + } + + export type ContractCreateWithoutHistoryEntriesInput = { + contractNumber: string + type: $Enums.ContractType + status?: $Enums.ContractStatus + previousCustomerNumber?: string | null + previousContractNumber?: string | null + providerName?: string | null + tariffName?: string | null + customerNumberAtProvider?: string | null + contractNumberAtProvider?: string | null + priceFirst12Months?: string | null + priceFrom13Months?: string | null + priceAfter24Months?: string | null + startDate?: Date | string | null + endDate?: Date | string | null + commission?: number | null + cancellationLetterPath?: string | null + cancellationConfirmationPath?: string | null + cancellationLetterOptionsPath?: string | null + cancellationConfirmationOptionsPath?: string | null + cancellationConfirmationDate?: Date | string | null + cancellationConfirmationOptionsDate?: Date | string | null + wasSpecialCancellation?: boolean + portalUsername?: string | null + portalPasswordEncrypted?: string | null + nextReviewDate?: Date | string | null + notes?: string | null + createdAt?: Date | string + updatedAt?: Date | string + customer: CustomerCreateNestedOneWithoutContractsInput + contractCategory?: ContractCategoryCreateNestedOneWithoutContractsInput + address?: AddressCreateNestedOneWithoutContractsAsDeliveryInput + billingAddress?: AddressCreateNestedOneWithoutContractsAsBillingInput + bankCard?: BankCardCreateNestedOneWithoutContractsInput + identityDocument?: IdentityDocumentCreateNestedOneWithoutContractsInput + salesPlatform?: SalesPlatformCreateNestedOneWithoutContractsInput + cancellationPeriod?: CancellationPeriodCreateNestedOneWithoutContractsInput + contractDuration?: ContractDurationCreateNestedOneWithoutContractsInput + previousContract?: ContractCreateNestedOneWithoutFollowUpContractInput + followUpContract?: ContractCreateNestedOneWithoutPreviousContractInput + previousProvider?: ProviderCreateNestedOneWithoutPreviousContractsInput + provider?: ProviderCreateNestedOneWithoutContractsInput + tariff?: TariffCreateNestedOneWithoutContractsInput + stressfreiEmail?: StressfreiEmailCreateNestedOneWithoutContractsInput + energyDetails?: EnergyContractDetailsCreateNestedOneWithoutContractInput + internetDetails?: InternetContractDetailsCreateNestedOneWithoutContractInput + mobileDetails?: MobileContractDetailsCreateNestedOneWithoutContractInput + tvDetails?: TvContractDetailsCreateNestedOneWithoutContractInput + carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput + tasks?: ContractTaskCreateNestedManyWithoutContractInput + assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + } + + export type ContractUncheckedCreateWithoutHistoryEntriesInput = { + id?: number + contractNumber: string + customerId: number + type: $Enums.ContractType + status?: $Enums.ContractStatus + contractCategoryId?: number | null + addressId?: number | null + billingAddressId?: number | null + bankCardId?: number | null + identityDocumentId?: number | null + salesPlatformId?: number | null + cancellationPeriodId?: number | null + contractDurationId?: number | null + previousContractId?: number | null + previousProviderId?: number | null + previousCustomerNumber?: string | null + previousContractNumber?: string | null + providerId?: number | null + tariffId?: number | null + providerName?: string | null + tariffName?: string | null + customerNumberAtProvider?: string | null + contractNumberAtProvider?: string | null + priceFirst12Months?: string | null + priceFrom13Months?: string | null + priceAfter24Months?: string | null + startDate?: Date | string | null + endDate?: Date | string | null + commission?: number | null + cancellationLetterPath?: string | null + cancellationConfirmationPath?: string | null + cancellationLetterOptionsPath?: string | null + cancellationConfirmationOptionsPath?: string | null + cancellationConfirmationDate?: Date | string | null + cancellationConfirmationOptionsDate?: Date | string | null + wasSpecialCancellation?: boolean + portalUsername?: string | null + portalPasswordEncrypted?: string | null + stressfreiEmailId?: number | null + nextReviewDate?: Date | string | null + notes?: string | null + createdAt?: Date | string + updatedAt?: Date | string + followUpContract?: ContractUncheckedCreateNestedOneWithoutPreviousContractInput + energyDetails?: EnergyContractDetailsUncheckedCreateNestedOneWithoutContractInput + internetDetails?: InternetContractDetailsUncheckedCreateNestedOneWithoutContractInput + mobileDetails?: MobileContractDetailsUncheckedCreateNestedOneWithoutContractInput + tvDetails?: TvContractDetailsUncheckedCreateNestedOneWithoutContractInput + carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput + tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput + assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + } + + export type ContractCreateOrConnectWithoutHistoryEntriesInput = { + where: ContractWhereUniqueInput + create: XOR + } + + export type ContractUpsertWithoutHistoryEntriesInput = { + update: XOR + create: XOR + where?: ContractWhereInput + } + + export type ContractUpdateToOneWithWhereWithoutHistoryEntriesInput = { + where?: ContractWhereInput + data: XOR + } + + export type ContractUpdateWithoutHistoryEntriesInput = { + contractNumber?: StringFieldUpdateOperationsInput | string + type?: EnumContractTypeFieldUpdateOperationsInput | $Enums.ContractType + status?: EnumContractStatusFieldUpdateOperationsInput | $Enums.ContractStatus + previousCustomerNumber?: NullableStringFieldUpdateOperationsInput | string | null + previousContractNumber?: NullableStringFieldUpdateOperationsInput | string | null + providerName?: NullableStringFieldUpdateOperationsInput | string | null + tariffName?: NullableStringFieldUpdateOperationsInput | string | null + customerNumberAtProvider?: NullableStringFieldUpdateOperationsInput | string | null + contractNumberAtProvider?: NullableStringFieldUpdateOperationsInput | string | null + priceFirst12Months?: NullableStringFieldUpdateOperationsInput | string | null + priceFrom13Months?: NullableStringFieldUpdateOperationsInput | string | null + priceAfter24Months?: NullableStringFieldUpdateOperationsInput | string | null + startDate?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + endDate?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + commission?: NullableFloatFieldUpdateOperationsInput | number | null + cancellationLetterPath?: NullableStringFieldUpdateOperationsInput | string | null + cancellationConfirmationPath?: NullableStringFieldUpdateOperationsInput | string | null + cancellationLetterOptionsPath?: NullableStringFieldUpdateOperationsInput | string | null + cancellationConfirmationOptionsPath?: NullableStringFieldUpdateOperationsInput | string | null + cancellationConfirmationDate?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + cancellationConfirmationOptionsDate?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + wasSpecialCancellation?: BoolFieldUpdateOperationsInput | boolean + portalUsername?: NullableStringFieldUpdateOperationsInput | string | null + portalPasswordEncrypted?: NullableStringFieldUpdateOperationsInput | string | null + nextReviewDate?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + notes?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: DateTimeFieldUpdateOperationsInput | Date | string + customer?: CustomerUpdateOneRequiredWithoutContractsNestedInput + contractCategory?: ContractCategoryUpdateOneWithoutContractsNestedInput + address?: AddressUpdateOneWithoutContractsAsDeliveryNestedInput + billingAddress?: AddressUpdateOneWithoutContractsAsBillingNestedInput + bankCard?: BankCardUpdateOneWithoutContractsNestedInput + identityDocument?: IdentityDocumentUpdateOneWithoutContractsNestedInput + salesPlatform?: SalesPlatformUpdateOneWithoutContractsNestedInput + cancellationPeriod?: CancellationPeriodUpdateOneWithoutContractsNestedInput + contractDuration?: ContractDurationUpdateOneWithoutContractsNestedInput + previousContract?: ContractUpdateOneWithoutFollowUpContractNestedInput + followUpContract?: ContractUpdateOneWithoutPreviousContractNestedInput + previousProvider?: ProviderUpdateOneWithoutPreviousContractsNestedInput + provider?: ProviderUpdateOneWithoutContractsNestedInput + tariff?: TariffUpdateOneWithoutContractsNestedInput + stressfreiEmail?: StressfreiEmailUpdateOneWithoutContractsNestedInput + energyDetails?: EnergyContractDetailsUpdateOneWithoutContractNestedInput + internetDetails?: InternetContractDetailsUpdateOneWithoutContractNestedInput + mobileDetails?: MobileContractDetailsUpdateOneWithoutContractNestedInput + tvDetails?: TvContractDetailsUpdateOneWithoutContractNestedInput + carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput + tasks?: ContractTaskUpdateManyWithoutContractNestedInput + assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + } + + export type ContractUncheckedUpdateWithoutHistoryEntriesInput = { + id?: IntFieldUpdateOperationsInput | number + contractNumber?: StringFieldUpdateOperationsInput | string + customerId?: IntFieldUpdateOperationsInput | number + type?: EnumContractTypeFieldUpdateOperationsInput | $Enums.ContractType + status?: EnumContractStatusFieldUpdateOperationsInput | $Enums.ContractStatus + contractCategoryId?: NullableIntFieldUpdateOperationsInput | number | null + addressId?: NullableIntFieldUpdateOperationsInput | number | null + billingAddressId?: NullableIntFieldUpdateOperationsInput | number | null + bankCardId?: NullableIntFieldUpdateOperationsInput | number | null + identityDocumentId?: NullableIntFieldUpdateOperationsInput | number | null + salesPlatformId?: NullableIntFieldUpdateOperationsInput | number | null + cancellationPeriodId?: NullableIntFieldUpdateOperationsInput | number | null + contractDurationId?: NullableIntFieldUpdateOperationsInput | number | null + previousContractId?: NullableIntFieldUpdateOperationsInput | number | null + previousProviderId?: NullableIntFieldUpdateOperationsInput | number | null + previousCustomerNumber?: NullableStringFieldUpdateOperationsInput | string | null + previousContractNumber?: NullableStringFieldUpdateOperationsInput | string | null + providerId?: NullableIntFieldUpdateOperationsInput | number | null + tariffId?: NullableIntFieldUpdateOperationsInput | number | null + providerName?: NullableStringFieldUpdateOperationsInput | string | null + tariffName?: NullableStringFieldUpdateOperationsInput | string | null + customerNumberAtProvider?: NullableStringFieldUpdateOperationsInput | string | null + contractNumberAtProvider?: NullableStringFieldUpdateOperationsInput | string | null + priceFirst12Months?: NullableStringFieldUpdateOperationsInput | string | null + priceFrom13Months?: NullableStringFieldUpdateOperationsInput | string | null + priceAfter24Months?: NullableStringFieldUpdateOperationsInput | string | null + startDate?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + endDate?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + commission?: NullableFloatFieldUpdateOperationsInput | number | null + cancellationLetterPath?: NullableStringFieldUpdateOperationsInput | string | null + cancellationConfirmationPath?: NullableStringFieldUpdateOperationsInput | string | null + cancellationLetterOptionsPath?: NullableStringFieldUpdateOperationsInput | string | null + cancellationConfirmationOptionsPath?: NullableStringFieldUpdateOperationsInput | string | null + cancellationConfirmationDate?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + cancellationConfirmationOptionsDate?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + wasSpecialCancellation?: BoolFieldUpdateOperationsInput | boolean + portalUsername?: NullableStringFieldUpdateOperationsInput | string | null + portalPasswordEncrypted?: NullableStringFieldUpdateOperationsInput | string | null + stressfreiEmailId?: NullableIntFieldUpdateOperationsInput | number | null + nextReviewDate?: NullableDateTimeFieldUpdateOperationsInput | Date | string | null + notes?: NullableStringFieldUpdateOperationsInput | string | null + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: DateTimeFieldUpdateOperationsInput | Date | string + followUpContract?: ContractUncheckedUpdateOneWithoutPreviousContractNestedInput + energyDetails?: EnergyContractDetailsUncheckedUpdateOneWithoutContractNestedInput + internetDetails?: InternetContractDetailsUncheckedUpdateOneWithoutContractNestedInput + mobileDetails?: MobileContractDetailsUncheckedUpdateOneWithoutContractNestedInput + tvDetails?: TvContractDetailsUncheckedUpdateOneWithoutContractNestedInput + carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput + tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput + assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + } + export type ContractCreateWithoutTasksInput = { contractNumber: string type: $Enums.ContractType @@ -56568,6 +58205,7 @@ export namespace Prisma { tvDetails?: TvContractDetailsCreateNestedOneWithoutContractInput carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutTasksInput = { @@ -56621,6 +58259,7 @@ export namespace Prisma { tvDetails?: TvContractDetailsUncheckedCreateNestedOneWithoutContractInput carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutTasksInput = { @@ -56718,6 +58357,7 @@ export namespace Prisma { tvDetails?: TvContractDetailsUpdateOneWithoutContractNestedInput carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutTasksInput = { @@ -56771,6 +58411,7 @@ export namespace Prisma { tvDetails?: TvContractDetailsUncheckedUpdateOneWithoutContractNestedInput carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractTaskSubtaskUpsertWithWhereUniqueWithoutTaskInput = { @@ -56919,6 +58560,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutEnergyDetailsInput = { @@ -56972,6 +58614,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutEnergyDetailsInput = { @@ -57097,6 +58740,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutEnergyDetailsInput = { @@ -57150,6 +58794,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type MeterUpsertWithoutEnergyDetailsInput = { @@ -57336,6 +58981,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutInternetDetailsInput = { @@ -57389,6 +59035,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutInternetDetailsInput = { @@ -57484,6 +59131,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutInternetDetailsInput = { @@ -57537,6 +59185,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type PhoneNumberUpsertWithWhereUniqueWithoutInternetDetailsInput = { @@ -57688,6 +59337,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutMobileDetailsInput = { @@ -57741,6 +59391,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutMobileDetailsInput = { @@ -57842,6 +59493,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutMobileDetailsInput = { @@ -57895,6 +59547,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type SimCardUpsertWithWhereUniqueWithoutMobileDetailsInput = { @@ -58045,6 +59698,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutTvDetailsInput = { @@ -58098,6 +59752,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutTvDetailsInput = { @@ -58166,6 +59821,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutTvDetailsInput = { @@ -58219,6 +59875,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractCreateWithoutCarInsuranceDetailsInput = { @@ -58271,6 +59928,7 @@ export namespace Prisma { tvDetails?: TvContractDetailsCreateNestedOneWithoutContractInput tasks?: ContractTaskCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryCreateNestedManyWithoutContractInput } export type ContractUncheckedCreateWithoutCarInsuranceDetailsInput = { @@ -58324,6 +59982,7 @@ export namespace Prisma { tvDetails?: TvContractDetailsUncheckedCreateNestedOneWithoutContractInput tasks?: ContractTaskUncheckedCreateNestedManyWithoutContractInput assignedEmails?: CachedEmailUncheckedCreateNestedManyWithoutContractInput + historyEntries?: ContractHistoryEntryUncheckedCreateNestedManyWithoutContractInput } export type ContractCreateOrConnectWithoutCarInsuranceDetailsInput = { @@ -58392,6 +60051,7 @@ export namespace Prisma { tvDetails?: TvContractDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutCarInsuranceDetailsInput = { @@ -58445,6 +60105,7 @@ export namespace Prisma { tvDetails?: TvContractDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type UserRoleCreateManyUserInput = { @@ -58899,6 +60560,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutCustomerInput = { @@ -58952,6 +60614,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateManyWithoutCustomerInput = { @@ -59191,6 +60854,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutAddressInput = { @@ -59244,6 +60908,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateManyWithoutAddressInput = { @@ -59341,6 +61006,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutBillingAddressInput = { @@ -59394,6 +61060,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateManyWithoutBillingAddressInput = { @@ -59536,6 +61203,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutBankCardInput = { @@ -59589,6 +61257,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateManyWithoutBankCardInput = { @@ -59731,6 +61400,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutIdentityDocumentInput = { @@ -59784,6 +61454,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateManyWithoutIdentityDocumentInput = { @@ -59953,6 +61624,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutStressfreiEmailInput = { @@ -60006,6 +61678,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateManyWithoutStressfreiEmailInput = { @@ -60316,6 +61989,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutSalesPlatformInput = { @@ -60369,6 +62043,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateManyWithoutSalesPlatformInput = { @@ -60511,6 +62186,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutCancellationPeriodInput = { @@ -60564,6 +62240,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateManyWithoutCancellationPeriodInput = { @@ -60706,6 +62383,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutContractDurationInput = { @@ -60759,6 +62437,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateManyWithoutContractDurationInput = { @@ -60979,6 +62658,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutProviderInput = { @@ -61032,6 +62712,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateManyWithoutProviderInput = { @@ -61129,6 +62810,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutPreviousProviderInput = { @@ -61182,6 +62864,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateManyWithoutPreviousProviderInput = { @@ -61324,6 +63007,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutTariffInput = { @@ -61377,6 +63061,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateManyWithoutTariffInput = { @@ -61519,6 +63204,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUpdateOneWithoutContractNestedInput tasks?: ContractTaskUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateWithoutContractCategoryInput = { @@ -61572,6 +63258,7 @@ export namespace Prisma { carInsuranceDetails?: CarInsuranceDetailsUncheckedUpdateOneWithoutContractNestedInput tasks?: ContractTaskUncheckedUpdateManyWithoutContractNestedInput assignedEmails?: CachedEmailUncheckedUpdateManyWithoutContractNestedInput + historyEntries?: ContractHistoryEntryUncheckedUpdateManyWithoutContractNestedInput } export type ContractUncheckedUpdateManyWithoutContractCategoryInput = { @@ -61658,6 +63345,15 @@ export namespace Prisma { updatedAt?: Date | string } + export type ContractHistoryEntryCreateManyContractInput = { + id?: number + title: string + description?: string | null + isAutomatic?: boolean + createdBy: string + createdAt?: Date | string + } + export type ContractTaskUpdateWithoutContractInput = { title?: StringFieldUpdateOperationsInput | string description?: NullableStringFieldUpdateOperationsInput | string | null @@ -61775,6 +63471,32 @@ export namespace Prisma { updatedAt?: DateTimeFieldUpdateOperationsInput | Date | string } + export type ContractHistoryEntryUpdateWithoutContractInput = { + title?: StringFieldUpdateOperationsInput | string + description?: NullableStringFieldUpdateOperationsInput | string | null + isAutomatic?: BoolFieldUpdateOperationsInput | boolean + createdBy?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + + export type ContractHistoryEntryUncheckedUpdateWithoutContractInput = { + id?: IntFieldUpdateOperationsInput | number + title?: StringFieldUpdateOperationsInput | string + description?: NullableStringFieldUpdateOperationsInput | string | null + isAutomatic?: BoolFieldUpdateOperationsInput | boolean + createdBy?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + + export type ContractHistoryEntryUncheckedUpdateManyWithoutContractInput = { + id?: IntFieldUpdateOperationsInput | number + title?: StringFieldUpdateOperationsInput | string + description?: NullableStringFieldUpdateOperationsInput | string | null + isAutomatic?: BoolFieldUpdateOperationsInput | boolean + createdBy?: StringFieldUpdateOperationsInput | string + createdAt?: DateTimeFieldUpdateOperationsInput | Date | string + } + export type ContractTaskSubtaskCreateManyTaskInput = { id?: number title: string @@ -62112,6 +63834,10 @@ export namespace Prisma { * @deprecated Use ContractDefaultArgs instead */ export type ContractArgs = ContractDefaultArgs + /** + * @deprecated Use ContractHistoryEntryDefaultArgs instead + */ + export type ContractHistoryEntryArgs = ContractHistoryEntryDefaultArgs /** * @deprecated Use ContractTaskDefaultArgs instead */ diff --git a/backend/node_modules/.prisma/client/index.js b/backend/node_modules/.prisma/client/index.js index aadf7225..72111583 100644 --- a/backend/node_modules/.prisma/client/index.js +++ b/backend/node_modules/.prisma/client/index.js @@ -412,6 +412,16 @@ exports.Prisma.ContractScalarFieldEnum = { updatedAt: 'updatedAt' }; +exports.Prisma.ContractHistoryEntryScalarFieldEnum = { + id: 'id', + contractId: 'contractId', + title: 'title', + description: 'description', + isAutomatic: 'isAutomatic', + createdBy: 'createdBy', + createdAt: 'createdAt' +}; + exports.Prisma.ContractTaskScalarFieldEnum = { id: 'id', contractId: 'contractId', @@ -645,6 +655,7 @@ exports.Prisma.ModelName = { Tariff: 'Tariff', ContractCategory: 'ContractCategory', Contract: 'Contract', + ContractHistoryEntry: 'ContractHistoryEntry', ContractTask: 'ContractTask', ContractTaskSubtask: 'ContractTaskSubtask', EnergyContractDetails: 'EnergyContractDetails', @@ -702,8 +713,8 @@ const config = { } } }, - "inlineSchema": "generator client {\n provider = \"prisma-client-js\"\n}\n\ndatasource db {\n provider = \"mysql\"\n url = env(\"DATABASE_URL\")\n}\n\n// ==================== APP SETTINGS ====================\n\nmodel AppSetting {\n id Int @id @default(autoincrement())\n key String @unique\n value String @db.Text\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== USERS & AUTH ====================\n\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n password String\n firstName String\n lastName String\n isActive Boolean @default(true)\n tokenInvalidatedAt DateTime? // Zeitpunkt ab dem alle Tokens ungültig sind (für Zwangslogout bei Rechteänderung)\n customerId Int? @unique\n customer Customer? @relation(fields: [customerId], references: [id])\n roles UserRole[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel Role {\n id Int @id @default(autoincrement())\n name String @unique\n description String?\n permissions RolePermission[]\n users UserRole[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel Permission {\n id Int @id @default(autoincrement())\n resource String\n action String\n roles RolePermission[]\n\n @@unique([resource, action])\n}\n\nmodel RolePermission {\n roleId Int\n permissionId Int\n role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)\n permission Permission @relation(fields: [permissionId], references: [id], onDelete: Cascade)\n\n @@id([roleId, permissionId])\n}\n\nmodel UserRole {\n userId Int\n roleId Int\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)\n\n @@id([userId, roleId])\n}\n\n// ==================== CUSTOMERS ====================\n\nenum CustomerType {\n PRIVATE\n BUSINESS\n}\n\nmodel Customer {\n id Int @id @default(autoincrement())\n customerNumber String @unique\n type CustomerType @default(PRIVATE)\n salutation String?\n firstName String\n lastName String\n companyName String?\n foundingDate DateTime? // Gründungsdatum (für Firmen)\n birthDate DateTime?\n birthPlace String?\n email String?\n phone String?\n mobile String?\n taxNumber String?\n businessRegistrationPath String? // PDF-Pfad zur Gewerbeanmeldung\n commercialRegisterPath String? // PDF-Pfad zum Handelsregisterauszug\n commercialRegisterNumber String? // Handelsregisternummer (Text)\n privacyPolicyPath String? // PDF-Pfad zur Datenschutzerklärung (für alle Kunden)\n notes String? @db.Text\n\n // ===== Portal-Zugangsdaten =====\n portalEnabled Boolean @default(false) // Portal aktiviert?\n portalEmail String? @unique // Portal-Login E-Mail\n portalPasswordHash String? // Gehashtes Passwort (für Login)\n portalPasswordEncrypted String? // Verschlüsseltes Passwort (für Anzeige)\n portalLastLogin DateTime? // Letzte Anmeldung\n\n user User?\n addresses Address[]\n bankCards BankCard[]\n identityDocuments IdentityDocument[]\n meters Meter[]\n stressfreiEmails StressfreiEmail[]\n contracts Contract[]\n\n // Vertreter-Beziehungen (Kunde kann für andere Kunden handeln)\n representingFor CustomerRepresentative[] @relation(\"RepresentativeCustomer\")\n representedBy CustomerRepresentative[] @relation(\"RepresentedCustomer\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CUSTOMER REPRESENTATIVES ====================\n// Vertretungsbeziehung: Ein Kunde kann die Verträge eines anderen Kunden einsehen\n// z.B. Sohn (representativeId) kann Verträge der Mutter (customerId) sehen\n\nmodel CustomerRepresentative {\n id Int @id @default(autoincrement())\n customerId Int // Der Kunde, dessen Verträge eingesehen werden (z.B. Mutter)\n customer Customer @relation(\"RepresentedCustomer\", fields: [customerId], references: [id], onDelete: Cascade)\n representativeId Int // Der Kunde, der einsehen darf (z.B. Sohn)\n representative Customer @relation(\"RepresentativeCustomer\", fields: [representativeId], references: [id], onDelete: Cascade)\n notes String? // Notizen zur Vertretung\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([customerId, representativeId]) // Keine doppelten Einträge\n}\n\n// ==================== ADDRESSES ====================\n\nenum AddressType {\n DELIVERY_RESIDENCE\n BILLING\n}\n\nmodel Address {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n type AddressType @default(DELIVERY_RESIDENCE)\n street String\n houseNumber String\n postalCode String\n city String\n country String @default(\"Deutschland\")\n isDefault Boolean @default(false)\n contractsAsDelivery Contract[] @relation(\"DeliveryAddress\")\n contractsAsBilling Contract[] @relation(\"BillingAddress\")\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== BANK CARDS ====================\n\nmodel BankCard {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n accountHolder String\n iban String\n bic String?\n bankName String?\n expiryDate DateTime?\n documentPath String? // Pfad zur hochgeladenen PDF\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== IDENTITY DOCUMENTS ====================\n\nenum DocumentType {\n ID_CARD\n PASSPORT\n DRIVERS_LICENSE\n OTHER\n}\n\nmodel IdentityDocument {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n type DocumentType @default(ID_CARD)\n documentNumber String\n issuingAuthority String?\n issueDate DateTime?\n expiryDate DateTime?\n documentPath String? // Pfad zur hochgeladenen PDF\n isActive Boolean @default(true)\n // Führerschein-spezifische Felder\n licenseClasses String? // z.B. \"B, BE, AM, L\" - kommasepariert\n licenseIssueDate DateTime? // Datum des Führerscheinerwerbs (Klasse B)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== EMAIL PROVIDER CONFIG (Plesk, cPanel etc.) ====================\n\nenum EmailProviderType {\n PLESK\n CPANEL\n DIRECTADMIN\n}\n\n// Verschlüsselungstyp für E-Mail-Verbindungen\nenum MailEncryption {\n SSL // Implicit SSL/TLS (Ports 465/993) - Verschlüsselung von Anfang an\n STARTTLS // STARTTLS (Ports 587/143) - Startet unverschlüsselt, dann Upgrade\n NONE // Keine Verschlüsselung (Ports 25/143)\n}\n\nmodel EmailProviderConfig {\n id Int @id @default(autoincrement())\n name String @unique // z.B. \"Plesk Hauptserver\"\n type EmailProviderType\n apiUrl String // API-URL (z.B. https://server.de:8443)\n apiKey String? // API-Key (verschlüsselt)\n username String? // Benutzername für API\n passwordEncrypted String? // Passwort (verschlüsselt)\n domain String // Domain für E-Mails (z.B. stressfrei-wechseln.de)\n defaultForwardEmail String? // Standard-Weiterleitungsadresse (unsere eigene)\n\n // IMAP/SMTP-Server für E-Mail-Client (optional, default: mail.{domain})\n imapServer String? // z.B. \"mail.stressfrei-wechseln.de\"\n imapPort Int? @default(993)\n smtpServer String?\n smtpPort Int? @default(465)\n\n // Verschlüsselungs-Einstellungen\n imapEncryption MailEncryption @default(SSL) // SSL, STARTTLS oder NONE\n smtpEncryption MailEncryption @default(SSL) // SSL, STARTTLS oder NONE\n allowSelfSignedCerts Boolean @default(false) // Selbstsignierte Zertifikate erlauben\n\n isActive Boolean @default(true)\n isDefault Boolean @default(false) // Standard-Provider\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== STRESSFREI-WECHSELN EMAIL ADDRESSES ====================\n\nmodel StressfreiEmail {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n email String // Die Weiterleitungs-E-Mail-Adresse\n platform String? // Für welche Plattform (z.B. \"Freenet\", \"Klarmobil\")\n notes String? @db.Text // Optionale Notizen\n isActive Boolean @default(true)\n isProvisioned Boolean @default(false) // Wurde bei Provider angelegt?\n provisionedAt DateTime? // Wann wurde provisioniert?\n provisionError String? @db.Text // Fehlermeldung falls Provisionierung fehlschlug\n\n // Mailbox-Zugangsdaten (für IMAP/SMTP-Zugang)\n hasMailbox Boolean @default(false) // Hat echte Mailbox (nicht nur Weiterleitung)?\n emailPasswordEncrypted String? // Verschlüsseltes Mailbox-Passwort (AES-256-GCM)\n\n contracts Contract[] // Verträge die diese E-Mail als Benutzername verwenden\n cachedEmails CachedEmail[] // Gecachte E-Mails aus dieser Mailbox\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CACHED EMAILS (E-Mail-Client) ====================\n\nenum EmailFolder {\n INBOX\n SENT\n}\n\nmodel CachedEmail {\n id Int @id @default(autoincrement())\n stressfreiEmailId Int\n stressfreiEmail StressfreiEmail @relation(fields: [stressfreiEmailId], references: [id], onDelete: Cascade)\n\n // Ordner (Posteingang oder Gesendet)\n folder EmailFolder @default(INBOX)\n\n // IMAP-Identifikation\n messageId String // RFC 5322 Message-ID\n uid Int // IMAP UID (für Synchronisierung, bei SENT = 0)\n\n // E-Mail-Metadaten\n subject String?\n fromAddress String\n fromName String?\n toAddresses String @db.Text // JSON Array\n ccAddresses String? @db.Text // JSON Array\n receivedAt DateTime\n\n // Inhalt\n textBody String? @db.LongText\n htmlBody String? @db.LongText\n hasAttachments Boolean @default(false)\n attachmentNames String? @db.Text // JSON Array\n\n // Vertragszuordnung\n contractId Int?\n contract Contract? @relation(fields: [contractId], references: [id], onDelete: SetNull)\n assignedAt DateTime?\n assignedBy Int? // User ID der die Zuordnung gemacht hat\n isAutoAssigned Boolean @default(false) // true = automatisch beim Senden aus Vertrag\n\n // Flags\n isRead Boolean @default(false)\n isStarred Boolean @default(false)\n\n // Papierkorb\n isDeleted Boolean @default(false) // Im Papierkorb?\n deletedAt DateTime? // Wann gelöscht?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([stressfreiEmailId, messageId, folder]) // Folder hinzugefügt: gleiche MessageID kann in INBOX und SENT existieren\n @@index([contractId])\n @@index([stressfreiEmailId, folder, receivedAt])\n @@index([stressfreiEmailId, isDeleted]) // Für Papierkorb-Abfragen\n}\n\n// ==================== METERS (Energy) ====================\n\nenum MeterType {\n ELECTRICITY\n GAS\n}\n\nmodel Meter {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n meterNumber String\n type MeterType\n location String?\n isActive Boolean @default(true)\n readings MeterReading[]\n energyDetails EnergyContractDetails[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel MeterReading {\n id Int @id @default(autoincrement())\n meterId Int\n meter Meter @relation(fields: [meterId], references: [id], onDelete: Cascade)\n readingDate DateTime\n value Float\n unit String @default(\"kWh\")\n notes String?\n createdAt DateTime @default(now())\n}\n\n// ==================== SALES PLATFORMS ====================\n\nmodel SalesPlatform {\n id Int @id @default(autoincrement())\n name String @unique\n contactInfo String? @db.Text\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CANCELLATION PERIODS ====================\n\nmodel CancellationPeriod {\n id Int @id @default(autoincrement())\n code String @unique // z.B. \"14T\", \"1M\", \"3M\", \"12M\", \"1J\"\n description String // z.B. \"14 Tage\", \"1 Monat\", \"3 Monate\"\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CONTRACT DURATIONS ====================\n\nmodel ContractDuration {\n id Int @id @default(autoincrement())\n code String @unique // z.B. \"12M\", \"24M\", \"1J\", \"2J\"\n description String // z.B. \"12 Monate\", \"24 Monate\", \"1 Jahr\"\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== PROVIDERS (Anbieter) ====================\n\nmodel Provider {\n id Int @id @default(autoincrement())\n name String @unique // Anbietername\n portalUrl String? // Kundenkontourl (Login-Seite)\n usernameFieldName String? // Benutzernamefeld (z.B. \"email\", \"username\")\n passwordFieldName String? // Kennwortfeld (z.B. \"password\", \"pwd\")\n isActive Boolean @default(true)\n tariffs Tariff[]\n contracts Contract[]\n previousContracts Contract[] @relation(\"PreviousProvider\") // Verträge wo dieser Provider Altanbieter ist\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== TARIFFS (Tarife) ====================\n\nmodel Tariff {\n id Int @id @default(autoincrement())\n providerId Int\n provider Provider @relation(fields: [providerId], references: [id], onDelete: Cascade)\n name String // Tarifname\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([providerId, name]) // Eindeutiger Tarif pro Anbieter\n}\n\n// ==================== CONTRACT CATEGORIES ====================\n\nmodel ContractCategory {\n id Int @id @default(autoincrement())\n code String @unique // Technischer Code (z.B. ELECTRICITY, GAS)\n name String // Anzeigename (z.B. Strom, Gas)\n icon String? // Icon-Name für UI (z.B. \"Zap\", \"Flame\")\n color String? // Farbe für UI (z.B. \"#FFC107\")\n sortOrder Int @default(0)\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CONTRACTS ====================\n\n// Legacy Enum - wird durch ContractCategory ersetzt\nenum ContractType {\n ELECTRICITY\n GAS\n DSL\n CABLE\n FIBER\n MOBILE\n TV\n CAR_INSURANCE\n}\n\nenum ContractStatus {\n DRAFT\n PENDING\n ACTIVE\n CANCELLED\n EXPIRED\n DEACTIVATED\n}\n\nmodel Contract {\n id Int @id @default(autoincrement())\n contractNumber String @unique\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n type ContractType\n status ContractStatus @default(DRAFT)\n\n // Neue konfigurierbare Kategorie (ersetzt langfristig das type-Enum)\n contractCategoryId Int?\n contractCategory ContractCategory? @relation(fields: [contractCategoryId], references: [id])\n\n // Lieferadresse\n addressId Int?\n address Address? @relation(\"DeliveryAddress\", fields: [addressId], references: [id])\n\n // Rechnungsadresse (falls leer, wird Lieferadresse verwendet)\n billingAddressId Int?\n billingAddress Address? @relation(\"BillingAddress\", fields: [billingAddressId], references: [id])\n\n bankCardId Int?\n bankCard BankCard? @relation(fields: [bankCardId], references: [id])\n\n identityDocumentId Int?\n identityDocument IdentityDocument? @relation(fields: [identityDocumentId], references: [id])\n\n salesPlatformId Int?\n salesPlatform SalesPlatform? @relation(fields: [salesPlatformId], references: [id])\n\n cancellationPeriodId Int?\n cancellationPeriod CancellationPeriod? @relation(fields: [cancellationPeriodId], references: [id])\n\n contractDurationId Int?\n contractDuration ContractDuration? @relation(fields: [contractDurationId], references: [id])\n\n previousContractId Int? @unique\n previousContract Contract? @relation(\"ContractHistory\", fields: [previousContractId], references: [id])\n followUpContract Contract? @relation(\"ContractHistory\")\n\n // Altanbieter-Daten (nur wenn kein Vorgängervertrag existiert)\n previousProviderId Int?\n previousProvider Provider? @relation(\"PreviousProvider\", fields: [previousProviderId], references: [id])\n previousCustomerNumber String? // Kundennummer beim Altanbieter\n previousContractNumber String? // Vertragsnummer beim Altanbieter\n\n // Anbieter & Tarif (neue Verknüpfung)\n providerId Int?\n provider Provider? @relation(fields: [providerId], references: [id])\n tariffId Int?\n tariff Tariff? @relation(fields: [tariffId], references: [id])\n\n // Legacy-Felder (für Abwärtskompatibilität)\n providerName String?\n tariffName String?\n customerNumberAtProvider String?\n contractNumberAtProvider String? // Vertragsnummer beim Anbieter\n priceFirst12Months String? // Preis erste 12 Monate\n priceFrom13Months String? // Preis ab 13. Monat\n priceAfter24Months String? // Preis nach 24 Monaten\n\n startDate DateTime?\n endDate DateTime? // Wird aus startDate + contractDuration berechnet\n commission Float?\n\n // Kündigungsdokumente\n cancellationLetterPath String? // Kündigungsschreiben PDF\n cancellationConfirmationPath String? // Kündigungsbestätigung PDF\n cancellationLetterOptionsPath String? // Kündigungsschreiben Optionen PDF\n cancellationConfirmationOptionsPath String? // Kündigungsbestätigung Optionen PDF\n\n // Kündigungsdaten\n cancellationConfirmationDate DateTime? // Kündigungsbestätigungsdatum\n cancellationConfirmationOptionsDate DateTime? // Kündigungsbestätigungsoptionendatum\n wasSpecialCancellation Boolean @default(false) // Wurde sondergekündigt?\n\n portalUsername String?\n portalPasswordEncrypted String?\n\n // Stressfrei-Wechseln E-Mail als Benutzername (Alternative zu portalUsername)\n stressfreiEmailId Int?\n stressfreiEmail StressfreiEmail? @relation(fields: [stressfreiEmailId], references: [id])\n\n // Snooze: Vertrag zurückstellen bis Datum (für Cockpit)\n nextReviewDate DateTime? // Erneute Prüfung am\n\n notes String? @db.Text\n\n energyDetails EnergyContractDetails?\n internetDetails InternetContractDetails?\n mobileDetails MobileContractDetails?\n tvDetails TvContractDetails?\n carInsuranceDetails CarInsuranceDetails?\n\n tasks ContractTask[]\n assignedEmails CachedEmail[] // Zugeordnete E-Mails aus dem E-Mail-Client\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CONTRACT TASKS ====================\n\nenum ContractTaskStatus {\n OPEN\n COMPLETED\n}\n\nmodel ContractTask {\n id Int @id @default(autoincrement())\n contractId Int\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n title String\n description String? @db.Text\n status ContractTaskStatus @default(OPEN)\n visibleInPortal Boolean @default(false)\n createdBy String? // Name des Erstellers\n completedAt DateTime?\n subtasks ContractTaskSubtask[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel ContractTaskSubtask {\n id Int @id @default(autoincrement())\n taskId Int\n task ContractTask @relation(fields: [taskId], references: [id], onDelete: Cascade)\n title String\n status ContractTaskStatus @default(OPEN)\n createdBy String?\n completedAt DateTime?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== ENERGY CONTRACT DETAILS ====================\n\nenum InvoiceType {\n INTERIM // Zwischenrechnung\n FINAL // Schlussrechnung\n NOT_AVAILABLE // Rechnung nicht mehr zu bekommen\n}\n\nmodel EnergyContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n meterId Int?\n meter Meter? @relation(fields: [meterId], references: [id])\n maloId String? // Marktlokations-ID\n annualConsumption Float? // kWh für Strom, m³ für Gas\n annualConsumptionKwh Float? // kWh für Gas (zusätzlich zu m³)\n basePrice Float? // €/Monat\n unitPrice Float? // €/kWh (Arbeitspreis)\n bonus Float?\n previousProviderName String?\n previousCustomerNumber String?\n invoices Invoice[] // Rechnungen\n}\n\nmodel Invoice {\n id Int @id @default(autoincrement())\n energyContractDetailsId Int\n energyContractDetails EnergyContractDetails @relation(fields: [energyContractDetailsId], references: [id], onDelete: Cascade)\n invoiceDate DateTime\n invoiceType InvoiceType\n documentPath String? // Pflicht, außer bei NOT_AVAILABLE\n notes String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([energyContractDetailsId])\n}\n\n// ==================== INTERNET CONTRACT DETAILS ====================\n\nmodel InternetContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n downloadSpeed Int?\n uploadSpeed Int?\n routerModel String?\n routerSerialNumber String?\n installationDate DateTime?\n // Internet-Zugangsdaten\n internetUsername String?\n internetPasswordEncrypted String? // Verschlüsselt gespeichert\n // Glasfaser-spezifisch\n homeId String?\n // Vodafone DSL/Kabel spezifisch\n activationCode String?\n phoneNumbers PhoneNumber[]\n}\n\nmodel PhoneNumber {\n id Int @id @default(autoincrement())\n internetContractDetailsId Int\n internetDetails InternetContractDetails @relation(fields: [internetContractDetailsId], references: [id], onDelete: Cascade)\n phoneNumber String\n isMain Boolean @default(false)\n // SIP-Zugangsdaten\n sipUsername String?\n sipPasswordEncrypted String? // Verschlüsselt gespeichert\n sipServer String?\n}\n\n// ==================== MOBILE CONTRACT DETAILS ====================\n\nmodel MobileContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n requiresMultisim Boolean @default(false) // Multisim erforderlich?\n dataVolume Float?\n includedMinutes Int?\n includedSMS Int?\n deviceModel String?\n deviceImei String?\n simCards SimCard[]\n // Legacy-Felder (für Abwärtskompatibilität, werden durch simCards ersetzt)\n phoneNumber String?\n simCardNumber String?\n}\n\nmodel SimCard {\n id Int @id @default(autoincrement())\n mobileDetailsId Int\n mobileDetails MobileContractDetails @relation(fields: [mobileDetailsId], references: [id], onDelete: Cascade)\n phoneNumber String? // Rufnummer\n simCardNumber String? // SIM-Kartennummer\n pin String? // PIN (verschlüsselt gespeichert)\n puk String? // PUK (verschlüsselt gespeichert)\n isMultisim Boolean @default(false) // Ist dies eine Multisim-Karte?\n isMain Boolean @default(false) // Ist dies die Hauptkarte?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== TV CONTRACT DETAILS ====================\n\nmodel TvContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n receiverModel String?\n smartcardNumber String?\n package String?\n}\n\n// ==================== CAR INSURANCE DETAILS ====================\n\nenum InsuranceType {\n LIABILITY\n PARTIAL\n FULL\n}\n\nmodel CarInsuranceDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n licensePlate String?\n hsn String?\n tsn String?\n vin String?\n vehicleType String?\n firstRegistration DateTime?\n noClaimsClass String?\n insuranceType InsuranceType @default(LIABILITY)\n deductiblePartial Float?\n deductibleFull Float?\n policyNumber String?\n previousInsurer String?\n}\n", - "inlineSchemaHash": "84f145c389db874d411b7a5b7ac16b3b2e77ebb74a71d4e93eaaeffdc67da9ae", + "inlineSchema": "generator client {\n provider = \"prisma-client-js\"\n}\n\ndatasource db {\n provider = \"mysql\"\n url = env(\"DATABASE_URL\")\n}\n\n// ==================== APP SETTINGS ====================\n\nmodel AppSetting {\n id Int @id @default(autoincrement())\n key String @unique\n value String @db.Text\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== USERS & AUTH ====================\n\nmodel User {\n id Int @id @default(autoincrement())\n email String @unique\n password String\n firstName String\n lastName String\n isActive Boolean @default(true)\n tokenInvalidatedAt DateTime? // Zeitpunkt ab dem alle Tokens ungültig sind (für Zwangslogout bei Rechteänderung)\n customerId Int? @unique\n customer Customer? @relation(fields: [customerId], references: [id])\n roles UserRole[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel Role {\n id Int @id @default(autoincrement())\n name String @unique\n description String?\n permissions RolePermission[]\n users UserRole[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel Permission {\n id Int @id @default(autoincrement())\n resource String\n action String\n roles RolePermission[]\n\n @@unique([resource, action])\n}\n\nmodel RolePermission {\n roleId Int\n permissionId Int\n role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)\n permission Permission @relation(fields: [permissionId], references: [id], onDelete: Cascade)\n\n @@id([roleId, permissionId])\n}\n\nmodel UserRole {\n userId Int\n roleId Int\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n role Role @relation(fields: [roleId], references: [id], onDelete: Cascade)\n\n @@id([userId, roleId])\n}\n\n// ==================== CUSTOMERS ====================\n\nenum CustomerType {\n PRIVATE\n BUSINESS\n}\n\nmodel Customer {\n id Int @id @default(autoincrement())\n customerNumber String @unique\n type CustomerType @default(PRIVATE)\n salutation String?\n firstName String\n lastName String\n companyName String?\n foundingDate DateTime? // Gründungsdatum (für Firmen)\n birthDate DateTime?\n birthPlace String?\n email String?\n phone String?\n mobile String?\n taxNumber String?\n businessRegistrationPath String? // PDF-Pfad zur Gewerbeanmeldung\n commercialRegisterPath String? // PDF-Pfad zum Handelsregisterauszug\n commercialRegisterNumber String? // Handelsregisternummer (Text)\n privacyPolicyPath String? // PDF-Pfad zur Datenschutzerklärung (für alle Kunden)\n notes String? @db.Text\n\n // ===== Portal-Zugangsdaten =====\n portalEnabled Boolean @default(false) // Portal aktiviert?\n portalEmail String? @unique // Portal-Login E-Mail\n portalPasswordHash String? // Gehashtes Passwort (für Login)\n portalPasswordEncrypted String? // Verschlüsseltes Passwort (für Anzeige)\n portalLastLogin DateTime? // Letzte Anmeldung\n\n user User?\n addresses Address[]\n bankCards BankCard[]\n identityDocuments IdentityDocument[]\n meters Meter[]\n stressfreiEmails StressfreiEmail[]\n contracts Contract[]\n\n // Vertreter-Beziehungen (Kunde kann für andere Kunden handeln)\n representingFor CustomerRepresentative[] @relation(\"RepresentativeCustomer\")\n representedBy CustomerRepresentative[] @relation(\"RepresentedCustomer\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CUSTOMER REPRESENTATIVES ====================\n// Vertretungsbeziehung: Ein Kunde kann die Verträge eines anderen Kunden einsehen\n// z.B. Sohn (representativeId) kann Verträge der Mutter (customerId) sehen\n\nmodel CustomerRepresentative {\n id Int @id @default(autoincrement())\n customerId Int // Der Kunde, dessen Verträge eingesehen werden (z.B. Mutter)\n customer Customer @relation(\"RepresentedCustomer\", fields: [customerId], references: [id], onDelete: Cascade)\n representativeId Int // Der Kunde, der einsehen darf (z.B. Sohn)\n representative Customer @relation(\"RepresentativeCustomer\", fields: [representativeId], references: [id], onDelete: Cascade)\n notes String? // Notizen zur Vertretung\n isActive Boolean @default(true)\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([customerId, representativeId]) // Keine doppelten Einträge\n}\n\n// ==================== ADDRESSES ====================\n\nenum AddressType {\n DELIVERY_RESIDENCE\n BILLING\n}\n\nmodel Address {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n type AddressType @default(DELIVERY_RESIDENCE)\n street String\n houseNumber String\n postalCode String\n city String\n country String @default(\"Deutschland\")\n isDefault Boolean @default(false)\n contractsAsDelivery Contract[] @relation(\"DeliveryAddress\")\n contractsAsBilling Contract[] @relation(\"BillingAddress\")\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== BANK CARDS ====================\n\nmodel BankCard {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n accountHolder String\n iban String\n bic String?\n bankName String?\n expiryDate DateTime?\n documentPath String? // Pfad zur hochgeladenen PDF\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== IDENTITY DOCUMENTS ====================\n\nenum DocumentType {\n ID_CARD\n PASSPORT\n DRIVERS_LICENSE\n OTHER\n}\n\nmodel IdentityDocument {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n type DocumentType @default(ID_CARD)\n documentNumber String\n issuingAuthority String?\n issueDate DateTime?\n expiryDate DateTime?\n documentPath String? // Pfad zur hochgeladenen PDF\n isActive Boolean @default(true)\n // Führerschein-spezifische Felder\n licenseClasses String? // z.B. \"B, BE, AM, L\" - kommasepariert\n licenseIssueDate DateTime? // Datum des Führerscheinerwerbs (Klasse B)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== EMAIL PROVIDER CONFIG (Plesk, cPanel etc.) ====================\n\nenum EmailProviderType {\n PLESK\n CPANEL\n DIRECTADMIN\n}\n\n// Verschlüsselungstyp für E-Mail-Verbindungen\nenum MailEncryption {\n SSL // Implicit SSL/TLS (Ports 465/993) - Verschlüsselung von Anfang an\n STARTTLS // STARTTLS (Ports 587/143) - Startet unverschlüsselt, dann Upgrade\n NONE // Keine Verschlüsselung (Ports 25/143)\n}\n\nmodel EmailProviderConfig {\n id Int @id @default(autoincrement())\n name String @unique // z.B. \"Plesk Hauptserver\"\n type EmailProviderType\n apiUrl String // API-URL (z.B. https://server.de:8443)\n apiKey String? // API-Key (verschlüsselt)\n username String? // Benutzername für API\n passwordEncrypted String? // Passwort (verschlüsselt)\n domain String // Domain für E-Mails (z.B. stressfrei-wechseln.de)\n defaultForwardEmail String? // Standard-Weiterleitungsadresse (unsere eigene)\n\n // IMAP/SMTP-Server für E-Mail-Client (optional, default: mail.{domain})\n imapServer String? // z.B. \"mail.stressfrei-wechseln.de\"\n imapPort Int? @default(993)\n smtpServer String?\n smtpPort Int? @default(465)\n\n // Verschlüsselungs-Einstellungen\n imapEncryption MailEncryption @default(SSL) // SSL, STARTTLS oder NONE\n smtpEncryption MailEncryption @default(SSL) // SSL, STARTTLS oder NONE\n allowSelfSignedCerts Boolean @default(false) // Selbstsignierte Zertifikate erlauben\n\n isActive Boolean @default(true)\n isDefault Boolean @default(false) // Standard-Provider\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== STRESSFREI-WECHSELN EMAIL ADDRESSES ====================\n\nmodel StressfreiEmail {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n email String // Die Weiterleitungs-E-Mail-Adresse\n platform String? // Für welche Plattform (z.B. \"Freenet\", \"Klarmobil\")\n notes String? @db.Text // Optionale Notizen\n isActive Boolean @default(true)\n isProvisioned Boolean @default(false) // Wurde bei Provider angelegt?\n provisionedAt DateTime? // Wann wurde provisioniert?\n provisionError String? @db.Text // Fehlermeldung falls Provisionierung fehlschlug\n\n // Mailbox-Zugangsdaten (für IMAP/SMTP-Zugang)\n hasMailbox Boolean @default(false) // Hat echte Mailbox (nicht nur Weiterleitung)?\n emailPasswordEncrypted String? // Verschlüsseltes Mailbox-Passwort (AES-256-GCM)\n\n contracts Contract[] // Verträge die diese E-Mail als Benutzername verwenden\n cachedEmails CachedEmail[] // Gecachte E-Mails aus dieser Mailbox\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CACHED EMAILS (E-Mail-Client) ====================\n\nenum EmailFolder {\n INBOX\n SENT\n}\n\nmodel CachedEmail {\n id Int @id @default(autoincrement())\n stressfreiEmailId Int\n stressfreiEmail StressfreiEmail @relation(fields: [stressfreiEmailId], references: [id], onDelete: Cascade)\n\n // Ordner (Posteingang oder Gesendet)\n folder EmailFolder @default(INBOX)\n\n // IMAP-Identifikation\n messageId String // RFC 5322 Message-ID\n uid Int // IMAP UID (für Synchronisierung, bei SENT = 0)\n\n // E-Mail-Metadaten\n subject String?\n fromAddress String\n fromName String?\n toAddresses String @db.Text // JSON Array\n ccAddresses String? @db.Text // JSON Array\n receivedAt DateTime\n\n // Inhalt\n textBody String? @db.LongText\n htmlBody String? @db.LongText\n hasAttachments Boolean @default(false)\n attachmentNames String? @db.Text // JSON Array\n\n // Vertragszuordnung\n contractId Int?\n contract Contract? @relation(fields: [contractId], references: [id], onDelete: SetNull)\n assignedAt DateTime?\n assignedBy Int? // User ID der die Zuordnung gemacht hat\n isAutoAssigned Boolean @default(false) // true = automatisch beim Senden aus Vertrag\n\n // Flags\n isRead Boolean @default(false)\n isStarred Boolean @default(false)\n\n // Papierkorb\n isDeleted Boolean @default(false) // Im Papierkorb?\n deletedAt DateTime? // Wann gelöscht?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([stressfreiEmailId, messageId, folder]) // Folder hinzugefügt: gleiche MessageID kann in INBOX und SENT existieren\n @@index([contractId])\n @@index([stressfreiEmailId, folder, receivedAt])\n @@index([stressfreiEmailId, isDeleted]) // Für Papierkorb-Abfragen\n}\n\n// ==================== METERS (Energy) ====================\n\nenum MeterType {\n ELECTRICITY\n GAS\n}\n\nmodel Meter {\n id Int @id @default(autoincrement())\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n meterNumber String\n type MeterType\n location String?\n isActive Boolean @default(true)\n readings MeterReading[]\n energyDetails EnergyContractDetails[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel MeterReading {\n id Int @id @default(autoincrement())\n meterId Int\n meter Meter @relation(fields: [meterId], references: [id], onDelete: Cascade)\n readingDate DateTime\n value Float\n unit String @default(\"kWh\")\n notes String?\n createdAt DateTime @default(now())\n}\n\n// ==================== SALES PLATFORMS ====================\n\nmodel SalesPlatform {\n id Int @id @default(autoincrement())\n name String @unique\n contactInfo String? @db.Text\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CANCELLATION PERIODS ====================\n\nmodel CancellationPeriod {\n id Int @id @default(autoincrement())\n code String @unique // z.B. \"14T\", \"1M\", \"3M\", \"12M\", \"1J\"\n description String // z.B. \"14 Tage\", \"1 Monat\", \"3 Monate\"\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CONTRACT DURATIONS ====================\n\nmodel ContractDuration {\n id Int @id @default(autoincrement())\n code String @unique // z.B. \"12M\", \"24M\", \"1J\", \"2J\"\n description String // z.B. \"12 Monate\", \"24 Monate\", \"1 Jahr\"\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== PROVIDERS (Anbieter) ====================\n\nmodel Provider {\n id Int @id @default(autoincrement())\n name String @unique // Anbietername\n portalUrl String? // Kundenkontourl (Login-Seite)\n usernameFieldName String? // Benutzernamefeld (z.B. \"email\", \"username\")\n passwordFieldName String? // Kennwortfeld (z.B. \"password\", \"pwd\")\n isActive Boolean @default(true)\n tariffs Tariff[]\n contracts Contract[]\n previousContracts Contract[] @relation(\"PreviousProvider\") // Verträge wo dieser Provider Altanbieter ist\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== TARIFFS (Tarife) ====================\n\nmodel Tariff {\n id Int @id @default(autoincrement())\n providerId Int\n provider Provider @relation(fields: [providerId], references: [id], onDelete: Cascade)\n name String // Tarifname\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@unique([providerId, name]) // Eindeutiger Tarif pro Anbieter\n}\n\n// ==================== CONTRACT CATEGORIES ====================\n\nmodel ContractCategory {\n id Int @id @default(autoincrement())\n code String @unique // Technischer Code (z.B. ELECTRICITY, GAS)\n name String // Anzeigename (z.B. Strom, Gas)\n icon String? // Icon-Name für UI (z.B. \"Zap\", \"Flame\")\n color String? // Farbe für UI (z.B. \"#FFC107\")\n sortOrder Int @default(0)\n isActive Boolean @default(true)\n contracts Contract[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CONTRACTS ====================\n\n// Legacy Enum - wird durch ContractCategory ersetzt\nenum ContractType {\n ELECTRICITY\n GAS\n DSL\n CABLE\n FIBER\n MOBILE\n TV\n CAR_INSURANCE\n}\n\nenum ContractStatus {\n DRAFT\n PENDING\n ACTIVE\n CANCELLED\n EXPIRED\n DEACTIVATED\n}\n\nmodel Contract {\n id Int @id @default(autoincrement())\n contractNumber String @unique\n customerId Int\n customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)\n type ContractType\n status ContractStatus @default(DRAFT)\n\n // Neue konfigurierbare Kategorie (ersetzt langfristig das type-Enum)\n contractCategoryId Int?\n contractCategory ContractCategory? @relation(fields: [contractCategoryId], references: [id])\n\n // Lieferadresse\n addressId Int?\n address Address? @relation(\"DeliveryAddress\", fields: [addressId], references: [id])\n\n // Rechnungsadresse (falls leer, wird Lieferadresse verwendet)\n billingAddressId Int?\n billingAddress Address? @relation(\"BillingAddress\", fields: [billingAddressId], references: [id])\n\n bankCardId Int?\n bankCard BankCard? @relation(fields: [bankCardId], references: [id])\n\n identityDocumentId Int?\n identityDocument IdentityDocument? @relation(fields: [identityDocumentId], references: [id])\n\n salesPlatformId Int?\n salesPlatform SalesPlatform? @relation(fields: [salesPlatformId], references: [id])\n\n cancellationPeriodId Int?\n cancellationPeriod CancellationPeriod? @relation(fields: [cancellationPeriodId], references: [id])\n\n contractDurationId Int?\n contractDuration ContractDuration? @relation(fields: [contractDurationId], references: [id])\n\n previousContractId Int? @unique\n previousContract Contract? @relation(\"ContractHistory\", fields: [previousContractId], references: [id])\n followUpContract Contract? @relation(\"ContractHistory\")\n\n // Altanbieter-Daten (nur wenn kein Vorgängervertrag existiert)\n previousProviderId Int?\n previousProvider Provider? @relation(\"PreviousProvider\", fields: [previousProviderId], references: [id])\n previousCustomerNumber String? // Kundennummer beim Altanbieter\n previousContractNumber String? // Vertragsnummer beim Altanbieter\n\n // Anbieter & Tarif (neue Verknüpfung)\n providerId Int?\n provider Provider? @relation(fields: [providerId], references: [id])\n tariffId Int?\n tariff Tariff? @relation(fields: [tariffId], references: [id])\n\n // Legacy-Felder (für Abwärtskompatibilität)\n providerName String?\n tariffName String?\n customerNumberAtProvider String?\n contractNumberAtProvider String? // Vertragsnummer beim Anbieter\n priceFirst12Months String? // Preis erste 12 Monate\n priceFrom13Months String? // Preis ab 13. Monat\n priceAfter24Months String? // Preis nach 24 Monaten\n\n startDate DateTime?\n endDate DateTime? // Wird aus startDate + contractDuration berechnet\n commission Float?\n\n // Kündigungsdokumente\n cancellationLetterPath String? // Kündigungsschreiben PDF\n cancellationConfirmationPath String? // Kündigungsbestätigung PDF\n cancellationLetterOptionsPath String? // Kündigungsschreiben Optionen PDF\n cancellationConfirmationOptionsPath String? // Kündigungsbestätigung Optionen PDF\n\n // Kündigungsdaten\n cancellationConfirmationDate DateTime? // Kündigungsbestätigungsdatum\n cancellationConfirmationOptionsDate DateTime? // Kündigungsbestätigungsoptionendatum\n wasSpecialCancellation Boolean @default(false) // Wurde sondergekündigt?\n\n portalUsername String?\n portalPasswordEncrypted String?\n\n // Stressfrei-Wechseln E-Mail als Benutzername (Alternative zu portalUsername)\n stressfreiEmailId Int?\n stressfreiEmail StressfreiEmail? @relation(fields: [stressfreiEmailId], references: [id])\n\n // Snooze: Vertrag zurückstellen bis Datum (für Cockpit)\n nextReviewDate DateTime? // Erneute Prüfung am\n\n notes String? @db.Text\n\n energyDetails EnergyContractDetails?\n internetDetails InternetContractDetails?\n mobileDetails MobileContractDetails?\n tvDetails TvContractDetails?\n carInsuranceDetails CarInsuranceDetails?\n\n tasks ContractTask[]\n assignedEmails CachedEmail[] // Zugeordnete E-Mails aus dem E-Mail-Client\n historyEntries ContractHistoryEntry[]\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== CONTRACT HISTORY ====================\n\nmodel ContractHistoryEntry {\n id Int @id @default(autoincrement())\n contractId Int\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n title String // Kurzbeschreibung (z.B. \"Folgevertrag erstellt\", \"kWh auf 18000 erhöht\")\n description String? @db.Text // Längere Beschreibung (optional)\n isAutomatic Boolean @default(false) // true = automatisch erstellt, false = manuell\n createdBy String // E-Mail des Erstellers\n createdAt DateTime @default(now())\n}\n\n// ==================== CONTRACT TASKS ====================\n\nenum ContractTaskStatus {\n OPEN\n COMPLETED\n}\n\nmodel ContractTask {\n id Int @id @default(autoincrement())\n contractId Int\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n title String\n description String? @db.Text\n status ContractTaskStatus @default(OPEN)\n visibleInPortal Boolean @default(false)\n createdBy String? // Name des Erstellers\n completedAt DateTime?\n subtasks ContractTaskSubtask[]\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel ContractTaskSubtask {\n id Int @id @default(autoincrement())\n taskId Int\n task ContractTask @relation(fields: [taskId], references: [id], onDelete: Cascade)\n title String\n status ContractTaskStatus @default(OPEN)\n createdBy String?\n completedAt DateTime?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== ENERGY CONTRACT DETAILS ====================\n\nenum InvoiceType {\n INTERIM // Zwischenrechnung\n FINAL // Schlussrechnung\n NOT_AVAILABLE // Rechnung nicht mehr zu bekommen\n}\n\nmodel EnergyContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n meterId Int?\n meter Meter? @relation(fields: [meterId], references: [id])\n maloId String? // Marktlokations-ID\n annualConsumption Float? // kWh für Strom, m³ für Gas\n annualConsumptionKwh Float? // kWh für Gas (zusätzlich zu m³)\n basePrice Float? // €/Monat\n unitPrice Float? // €/kWh (Arbeitspreis)\n bonus Float?\n previousProviderName String?\n previousCustomerNumber String?\n invoices Invoice[] // Rechnungen\n}\n\nmodel Invoice {\n id Int @id @default(autoincrement())\n energyContractDetailsId Int\n energyContractDetails EnergyContractDetails @relation(fields: [energyContractDetailsId], references: [id], onDelete: Cascade)\n invoiceDate DateTime\n invoiceType InvoiceType\n documentPath String? // Pflicht, außer bei NOT_AVAILABLE\n notes String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([energyContractDetailsId])\n}\n\n// ==================== INTERNET CONTRACT DETAILS ====================\n\nmodel InternetContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n downloadSpeed Int?\n uploadSpeed Int?\n routerModel String?\n routerSerialNumber String?\n installationDate DateTime?\n // Internet-Zugangsdaten\n internetUsername String?\n internetPasswordEncrypted String? // Verschlüsselt gespeichert\n // Glasfaser-spezifisch\n homeId String?\n // Vodafone DSL/Kabel spezifisch\n activationCode String?\n phoneNumbers PhoneNumber[]\n}\n\nmodel PhoneNumber {\n id Int @id @default(autoincrement())\n internetContractDetailsId Int\n internetDetails InternetContractDetails @relation(fields: [internetContractDetailsId], references: [id], onDelete: Cascade)\n phoneNumber String\n isMain Boolean @default(false)\n // SIP-Zugangsdaten\n sipUsername String?\n sipPasswordEncrypted String? // Verschlüsselt gespeichert\n sipServer String?\n}\n\n// ==================== MOBILE CONTRACT DETAILS ====================\n\nmodel MobileContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n requiresMultisim Boolean @default(false) // Multisim erforderlich?\n dataVolume Float?\n includedMinutes Int?\n includedSMS Int?\n deviceModel String?\n deviceImei String?\n simCards SimCard[]\n // Legacy-Felder (für Abwärtskompatibilität, werden durch simCards ersetzt)\n phoneNumber String?\n simCardNumber String?\n}\n\nmodel SimCard {\n id Int @id @default(autoincrement())\n mobileDetailsId Int\n mobileDetails MobileContractDetails @relation(fields: [mobileDetailsId], references: [id], onDelete: Cascade)\n phoneNumber String? // Rufnummer\n simCardNumber String? // SIM-Kartennummer\n pin String? // PIN (verschlüsselt gespeichert)\n puk String? // PUK (verschlüsselt gespeichert)\n isMultisim Boolean @default(false) // Ist dies eine Multisim-Karte?\n isMain Boolean @default(false) // Ist dies die Hauptkarte?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\n// ==================== TV CONTRACT DETAILS ====================\n\nmodel TvContractDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n receiverModel String?\n smartcardNumber String?\n package String?\n}\n\n// ==================== CAR INSURANCE DETAILS ====================\n\nenum InsuranceType {\n LIABILITY\n PARTIAL\n FULL\n}\n\nmodel CarInsuranceDetails {\n id Int @id @default(autoincrement())\n contractId Int @unique\n contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade)\n licensePlate String?\n hsn String?\n tsn String?\n vin String?\n vehicleType String?\n firstRegistration DateTime?\n noClaimsClass String?\n insuranceType InsuranceType @default(LIABILITY)\n deductiblePartial Float?\n deductibleFull Float?\n policyNumber String?\n previousInsurer String?\n}\n", + "inlineSchemaHash": "78e1ffc1151c8ed5044757206fc5cc6883ede2dea13cc396805b105375e30f1c", "copyEngine": true } @@ -724,7 +735,7 @@ if (!fs.existsSync(path.join(__dirname, 'schema.prisma'))) { config.isBundled = true } -config.runtimeDataModel = JSON.parse("{\"models\":{\"AppSetting\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"key\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"User\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"password\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"firstName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"lastName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tokenInvalidatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToUser\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"roles\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"UserRole\",\"relationName\":\"UserToUserRole\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Role\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"permissions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"RolePermission\",\"relationName\":\"RoleToRolePermission\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"users\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"UserRole\",\"relationName\":\"RoleToUserRole\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Permission\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"resource\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"action\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"roles\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"RolePermission\",\"relationName\":\"PermissionToRolePermission\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[[\"resource\",\"action\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"resource\",\"action\"]}],\"isGenerated\":false},\"RolePermission\":{\"dbName\":null,\"fields\":[{\"name\":\"roleId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"permissionId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Role\",\"relationName\":\"RoleToRolePermission\",\"relationFromFields\":[\"roleId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"permission\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Permission\",\"relationName\":\"PermissionToRolePermission\",\"relationFromFields\":[\"permissionId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":{\"name\":null,\"fields\":[\"roleId\",\"permissionId\"]},\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"UserRole\":{\"dbName\":null,\"fields\":[{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"roleId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"UserToUserRole\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Role\",\"relationName\":\"RoleToUserRole\",\"relationFromFields\":[\"roleId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":{\"name\":null,\"fields\":[\"userId\",\"roleId\"]},\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Customer\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"CustomerType\",\"default\":\"PRIVATE\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"salutation\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"firstName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"lastName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"companyName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"foundingDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"birthDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"birthPlace\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phone\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobile\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"taxNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"businessRegistrationPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"commercialRegisterPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"commercialRegisterNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"privacyPolicyPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalEnabled\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalEmail\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalPasswordHash\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalLastLogin\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"CustomerToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"addresses\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Address\",\"relationName\":\"AddressToCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankCards\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"BankCard\",\"relationName\":\"BankCardToCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"identityDocuments\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"IdentityDocument\",\"relationName\":\"CustomerToIdentityDocument\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meters\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Meter\",\"relationName\":\"CustomerToMeter\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"StressfreiEmail\",\"relationName\":\"CustomerToStressfreiEmail\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representingFor\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CustomerRepresentative\",\"relationName\":\"RepresentativeCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representedBy\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CustomerRepresentative\",\"relationName\":\"RepresentedCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CustomerRepresentative\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"RepresentedCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representativeId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representative\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"RepresentativeCustomer\",\"relationFromFields\":[\"representativeId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"customerId\",\"representativeId\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"customerId\",\"representativeId\"]}],\"isGenerated\":false},\"Address\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"AddressToCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"AddressType\",\"default\":\"DELIVERY_RESIDENCE\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"street\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"houseNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"postalCode\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"city\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"country\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"Deutschland\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isDefault\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractsAsDelivery\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"DeliveryAddress\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractsAsBilling\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"BillingAddress\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"BankCard\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"BankCardToCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"accountHolder\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"iban\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bic\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"expiryDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"BankCardToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"IdentityDocument\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToIdentityDocument\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DocumentType\",\"default\":\"ID_CARD\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"issuingAuthority\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"issueDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"expiryDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"licenseClasses\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"licenseIssueDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToIdentityDocument\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EmailProviderConfig\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EmailProviderType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"apiUrl\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"apiKey\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"username\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"passwordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"domain\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"defaultForwardEmail\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"imapServer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"imapPort\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":993,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smtpServer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smtpPort\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":465,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"imapEncryption\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"MailEncryption\",\"default\":\"SSL\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smtpEncryption\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"MailEncryption\",\"default\":\"SSL\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"allowSelfSignedCerts\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isDefault\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"StressfreiEmail\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToStressfreiEmail\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"platform\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isProvisioned\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provisionedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provisionError\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hasMailbox\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"emailPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToStressfreiEmail\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cachedEmails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CachedEmail\",\"relationName\":\"CachedEmailToStressfreiEmail\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CachedEmail\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmailId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmail\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"StressfreiEmail\",\"relationName\":\"CachedEmailToStressfreiEmail\",\"relationFromFields\":[\"stressfreiEmailId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"folder\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"EmailFolder\",\"default\":\"INBOX\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"messageId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"uid\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"subject\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"fromAddress\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"fromName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"toAddresses\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ccAddresses\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"receivedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"textBody\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"htmlBody\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hasAttachments\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"attachmentNames\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"CachedEmailToContract\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"SetNull\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"assignedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"assignedBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isAutoAssigned\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isRead\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isStarred\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isDeleted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"stressfreiEmailId\",\"messageId\",\"folder\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"stressfreiEmailId\",\"messageId\",\"folder\"]}],\"isGenerated\":false},\"Meter\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToMeter\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meterNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MeterType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"location\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"readings\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MeterReading\",\"relationName\":\"MeterToMeterReading\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyDetails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EnergyContractDetails\",\"relationName\":\"EnergyContractDetailsToMeter\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"MeterReading\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meterId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meter\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Meter\",\"relationName\":\"MeterToMeterReading\",\"relationFromFields\":[\"meterId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"readingDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unit\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"kWh\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"SalesPlatform\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contactInfo\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToSalesPlatform\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CancellationPeriod\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"CancellationPeriodToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractDuration\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractDuration\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Provider\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalUrl\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"usernameFieldName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"passwordFieldName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariffs\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Tariff\",\"relationName\":\"ProviderToTariff\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToProvider\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"PreviousProvider\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Tariff\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"providerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provider\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Provider\",\"relationName\":\"ProviderToTariff\",\"relationFromFields\":[\"providerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToTariff\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"providerId\",\"name\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"providerId\",\"name\"]}],\"isGenerated\":false},\"ContractCategory\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"icon\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"color\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sortOrder\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":0,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractCategory\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Contract\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"ContractToCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"ContractStatus\",\"default\":\"DRAFT\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractCategoryId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractCategory\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractCategory\",\"relationName\":\"ContractToContractCategory\",\"relationFromFields\":[\"contractCategoryId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"addressId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"address\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Address\",\"relationName\":\"DeliveryAddress\",\"relationFromFields\":[\"addressId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"billingAddressId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"billingAddress\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Address\",\"relationName\":\"BillingAddress\",\"relationFromFields\":[\"billingAddressId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankCardId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankCard\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"BankCard\",\"relationName\":\"BankCardToContract\",\"relationFromFields\":[\"bankCardId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"identityDocumentId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"identityDocument\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"IdentityDocument\",\"relationName\":\"ContractToIdentityDocument\",\"relationFromFields\":[\"identityDocumentId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"salesPlatformId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"salesPlatform\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"SalesPlatform\",\"relationName\":\"ContractToSalesPlatform\",\"relationFromFields\":[\"salesPlatformId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationPeriodId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationPeriod\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CancellationPeriod\",\"relationName\":\"CancellationPeriodToContract\",\"relationFromFields\":[\"cancellationPeriodId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractDurationId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractDuration\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractDuration\",\"relationName\":\"ContractToContractDuration\",\"relationFromFields\":[\"contractDurationId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractHistory\",\"relationFromFields\":[\"previousContractId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"followUpContract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractHistory\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousProviderId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousProvider\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Provider\",\"relationName\":\"PreviousProvider\",\"relationFromFields\":[\"previousProviderId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousCustomerNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContractNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"providerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provider\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Provider\",\"relationName\":\"ContractToProvider\",\"relationFromFields\":[\"providerId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariffId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariff\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Tariff\",\"relationName\":\"ContractToTariff\",\"relationFromFields\":[\"tariffId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"providerName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariffName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerNumberAtProvider\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractNumberAtProvider\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceFirst12Months\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceFrom13Months\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceAfter24Months\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"startDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"endDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"commission\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationLetterPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationLetterOptionsPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationOptionsPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationOptionsDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"wasSpecialCancellation\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalUsername\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmailId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmail\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"StressfreiEmail\",\"relationName\":\"ContractToStressfreiEmail\",\"relationFromFields\":[\"stressfreiEmailId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"nextReviewDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EnergyContractDetails\",\"relationName\":\"ContractToEnergyContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"InternetContractDetails\",\"relationName\":\"ContractToInternetContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobileDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MobileContractDetails\",\"relationName\":\"ContractToMobileContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tvDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"TvContractDetails\",\"relationName\":\"ContractToTvContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"carInsuranceDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CarInsuranceDetails\",\"relationName\":\"CarInsuranceDetailsToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tasks\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractTask\",\"relationName\":\"ContractToContractTask\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"assignedEmails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CachedEmail\",\"relationName\":\"CachedEmailToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractTask\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractTask\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"title\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"ContractTaskStatus\",\"default\":\"OPEN\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"visibleInPortal\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"completedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"subtasks\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractTaskSubtask\",\"relationName\":\"ContractTaskToContractTaskSubtask\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractTaskSubtask\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"taskId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"task\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractTask\",\"relationName\":\"ContractTaskToContractTaskSubtask\",\"relationFromFields\":[\"taskId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"title\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"ContractTaskStatus\",\"default\":\"OPEN\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"completedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EnergyContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToEnergyContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meterId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meter\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Meter\",\"relationName\":\"EnergyContractDetailsToMeter\",\"relationFromFields\":[\"meterId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"maloId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"annualConsumption\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"annualConsumptionKwh\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"basePrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unitPrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bonus\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousProviderName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousCustomerNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"invoices\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Invoice\",\"relationName\":\"EnergyContractDetailsToInvoice\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Invoice\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyContractDetailsId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyContractDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EnergyContractDetails\",\"relationName\":\"EnergyContractDetailsToInvoice\",\"relationFromFields\":[\"energyContractDetailsId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"invoiceDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"invoiceType\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"InvoiceType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"InternetContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToInternetContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"downloadSpeed\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"uploadSpeed\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"routerModel\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"routerSerialNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"installationDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetUsername\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"homeId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"activationCode\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumbers\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PhoneNumber\",\"relationName\":\"InternetContractDetailsToPhoneNumber\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"PhoneNumber\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetContractDetailsId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"InternetContractDetails\",\"relationName\":\"InternetContractDetailsToPhoneNumber\",\"relationFromFields\":[\"internetContractDetailsId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isMain\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sipUsername\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sipPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sipServer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"MobileContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToMobileContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"requiresMultisim\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"dataVolume\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"includedMinutes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"includedSMS\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deviceModel\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deviceImei\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"simCards\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"SimCard\",\"relationName\":\"MobileContractDetailsToSimCard\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"simCardNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"SimCard\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobileDetailsId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobileDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MobileContractDetails\",\"relationName\":\"MobileContractDetailsToSimCard\",\"relationFromFields\":[\"mobileDetailsId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"simCardNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"pin\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"puk\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isMultisim\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isMain\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"TvContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToTvContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"receiverModel\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smartcardNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"package\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CarInsuranceDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"CarInsuranceDetailsToContract\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"licensePlate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hsn\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tsn\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vin\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vehicleType\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"firstRegistration\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"noClaimsClass\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"insuranceType\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"InsuranceType\",\"default\":\"LIABILITY\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deductiblePartial\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deductibleFull\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"policyNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousInsurer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false}},\"enums\":{\"CustomerType\":{\"values\":[{\"name\":\"PRIVATE\",\"dbName\":null},{\"name\":\"BUSINESS\",\"dbName\":null}],\"dbName\":null},\"AddressType\":{\"values\":[{\"name\":\"DELIVERY_RESIDENCE\",\"dbName\":null},{\"name\":\"BILLING\",\"dbName\":null}],\"dbName\":null},\"DocumentType\":{\"values\":[{\"name\":\"ID_CARD\",\"dbName\":null},{\"name\":\"PASSPORT\",\"dbName\":null},{\"name\":\"DRIVERS_LICENSE\",\"dbName\":null},{\"name\":\"OTHER\",\"dbName\":null}],\"dbName\":null},\"EmailProviderType\":{\"values\":[{\"name\":\"PLESK\",\"dbName\":null},{\"name\":\"CPANEL\",\"dbName\":null},{\"name\":\"DIRECTADMIN\",\"dbName\":null}],\"dbName\":null},\"MailEncryption\":{\"values\":[{\"name\":\"SSL\",\"dbName\":null},{\"name\":\"STARTTLS\",\"dbName\":null},{\"name\":\"NONE\",\"dbName\":null}],\"dbName\":null},\"EmailFolder\":{\"values\":[{\"name\":\"INBOX\",\"dbName\":null},{\"name\":\"SENT\",\"dbName\":null}],\"dbName\":null},\"MeterType\":{\"values\":[{\"name\":\"ELECTRICITY\",\"dbName\":null},{\"name\":\"GAS\",\"dbName\":null}],\"dbName\":null},\"ContractType\":{\"values\":[{\"name\":\"ELECTRICITY\",\"dbName\":null},{\"name\":\"GAS\",\"dbName\":null},{\"name\":\"DSL\",\"dbName\":null},{\"name\":\"CABLE\",\"dbName\":null},{\"name\":\"FIBER\",\"dbName\":null},{\"name\":\"MOBILE\",\"dbName\":null},{\"name\":\"TV\",\"dbName\":null},{\"name\":\"CAR_INSURANCE\",\"dbName\":null}],\"dbName\":null},\"ContractStatus\":{\"values\":[{\"name\":\"DRAFT\",\"dbName\":null},{\"name\":\"PENDING\",\"dbName\":null},{\"name\":\"ACTIVE\",\"dbName\":null},{\"name\":\"CANCELLED\",\"dbName\":null},{\"name\":\"EXPIRED\",\"dbName\":null},{\"name\":\"DEACTIVATED\",\"dbName\":null}],\"dbName\":null},\"ContractTaskStatus\":{\"values\":[{\"name\":\"OPEN\",\"dbName\":null},{\"name\":\"COMPLETED\",\"dbName\":null}],\"dbName\":null},\"InvoiceType\":{\"values\":[{\"name\":\"INTERIM\",\"dbName\":null},{\"name\":\"FINAL\",\"dbName\":null},{\"name\":\"NOT_AVAILABLE\",\"dbName\":null}],\"dbName\":null},\"InsuranceType\":{\"values\":[{\"name\":\"LIABILITY\",\"dbName\":null},{\"name\":\"PARTIAL\",\"dbName\":null},{\"name\":\"FULL\",\"dbName\":null}],\"dbName\":null}},\"types\":{}}") +config.runtimeDataModel = JSON.parse("{\"models\":{\"AppSetting\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"key\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"User\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"password\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"firstName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"lastName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tokenInvalidatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToUser\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"roles\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"UserRole\",\"relationName\":\"UserToUserRole\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Role\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"permissions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"RolePermission\",\"relationName\":\"RoleToRolePermission\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"users\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"UserRole\",\"relationName\":\"RoleToUserRole\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Permission\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"resource\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"action\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"roles\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"RolePermission\",\"relationName\":\"PermissionToRolePermission\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[[\"resource\",\"action\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"resource\",\"action\"]}],\"isGenerated\":false},\"RolePermission\":{\"dbName\":null,\"fields\":[{\"name\":\"roleId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"permissionId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Role\",\"relationName\":\"RoleToRolePermission\",\"relationFromFields\":[\"roleId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"permission\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Permission\",\"relationName\":\"PermissionToRolePermission\",\"relationFromFields\":[\"permissionId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":{\"name\":null,\"fields\":[\"roleId\",\"permissionId\"]},\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"UserRole\":{\"dbName\":null,\"fields\":[{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"roleId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"UserToUserRole\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Role\",\"relationName\":\"RoleToUserRole\",\"relationFromFields\":[\"roleId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":{\"name\":null,\"fields\":[\"userId\",\"roleId\"]},\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Customer\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"CustomerType\",\"default\":\"PRIVATE\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"salutation\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"firstName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"lastName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"companyName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"foundingDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"birthDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"birthPlace\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phone\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobile\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"taxNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"businessRegistrationPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"commercialRegisterPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"commercialRegisterNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"privacyPolicyPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalEnabled\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalEmail\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalPasswordHash\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalLastLogin\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"CustomerToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"addresses\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Address\",\"relationName\":\"AddressToCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankCards\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"BankCard\",\"relationName\":\"BankCardToCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"identityDocuments\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"IdentityDocument\",\"relationName\":\"CustomerToIdentityDocument\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meters\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Meter\",\"relationName\":\"CustomerToMeter\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"StressfreiEmail\",\"relationName\":\"CustomerToStressfreiEmail\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representingFor\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CustomerRepresentative\",\"relationName\":\"RepresentativeCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representedBy\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CustomerRepresentative\",\"relationName\":\"RepresentedCustomer\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CustomerRepresentative\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"RepresentedCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representativeId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"representative\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"RepresentativeCustomer\",\"relationFromFields\":[\"representativeId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"customerId\",\"representativeId\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"customerId\",\"representativeId\"]}],\"isGenerated\":false},\"Address\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"AddressToCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"AddressType\",\"default\":\"DELIVERY_RESIDENCE\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"street\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"houseNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"postalCode\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"city\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"country\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"Deutschland\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isDefault\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractsAsDelivery\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"DeliveryAddress\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractsAsBilling\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"BillingAddress\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"BankCard\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"BankCardToCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"accountHolder\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"iban\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bic\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"expiryDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"BankCardToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"IdentityDocument\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToIdentityDocument\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DocumentType\",\"default\":\"ID_CARD\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"issuingAuthority\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"issueDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"expiryDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"licenseClasses\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"licenseIssueDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToIdentityDocument\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EmailProviderConfig\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EmailProviderType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"apiUrl\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"apiKey\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"username\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"passwordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"domain\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"defaultForwardEmail\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"imapServer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"imapPort\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":993,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smtpServer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smtpPort\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":465,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"imapEncryption\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"MailEncryption\",\"default\":\"SSL\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smtpEncryption\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"MailEncryption\",\"default\":\"SSL\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"allowSelfSignedCerts\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isDefault\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"StressfreiEmail\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToStressfreiEmail\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"platform\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isProvisioned\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provisionedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provisionError\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hasMailbox\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"emailPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToStressfreiEmail\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cachedEmails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CachedEmail\",\"relationName\":\"CachedEmailToStressfreiEmail\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CachedEmail\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmailId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmail\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"StressfreiEmail\",\"relationName\":\"CachedEmailToStressfreiEmail\",\"relationFromFields\":[\"stressfreiEmailId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"folder\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"EmailFolder\",\"default\":\"INBOX\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"messageId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"uid\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"subject\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"fromAddress\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"fromName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"toAddresses\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"ccAddresses\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"receivedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"textBody\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"htmlBody\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hasAttachments\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"attachmentNames\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"CachedEmailToContract\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"SetNull\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"assignedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"assignedBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isAutoAssigned\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isRead\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isStarred\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isDeleted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"stressfreiEmailId\",\"messageId\",\"folder\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"stressfreiEmailId\",\"messageId\",\"folder\"]}],\"isGenerated\":false},\"Meter\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"CustomerToMeter\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meterNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MeterType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"location\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"readings\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MeterReading\",\"relationName\":\"MeterToMeterReading\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyDetails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EnergyContractDetails\",\"relationName\":\"EnergyContractDetailsToMeter\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"MeterReading\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meterId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meter\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Meter\",\"relationName\":\"MeterToMeterReading\",\"relationFromFields\":[\"meterId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"readingDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"value\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unit\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"String\",\"default\":\"kWh\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"SalesPlatform\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contactInfo\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToSalesPlatform\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CancellationPeriod\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"CancellationPeriodToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractDuration\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractDuration\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Provider\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalUrl\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"usernameFieldName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"passwordFieldName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariffs\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Tariff\",\"relationName\":\"ProviderToTariff\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToProvider\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"PreviousProvider\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Tariff\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"providerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provider\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Provider\",\"relationName\":\"ProviderToTariff\",\"relationFromFields\":[\"providerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToTariff\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[[\"providerId\",\"name\"]],\"uniqueIndexes\":[{\"name\":null,\"fields\":[\"providerId\",\"name\"]}],\"isGenerated\":false},\"ContractCategory\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"code\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"name\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"icon\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"color\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sortOrder\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":0,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isActive\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":true,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contracts\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractCategory\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Contract\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customer\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Customer\",\"relationName\":\"ContractToCustomer\",\"relationFromFields\":[\"customerId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"type\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"ContractStatus\",\"default\":\"DRAFT\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractCategoryId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractCategory\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractCategory\",\"relationName\":\"ContractToContractCategory\",\"relationFromFields\":[\"contractCategoryId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"addressId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"address\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Address\",\"relationName\":\"DeliveryAddress\",\"relationFromFields\":[\"addressId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"billingAddressId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"billingAddress\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Address\",\"relationName\":\"BillingAddress\",\"relationFromFields\":[\"billingAddressId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankCardId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bankCard\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"BankCard\",\"relationName\":\"BankCardToContract\",\"relationFromFields\":[\"bankCardId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"identityDocumentId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"identityDocument\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"IdentityDocument\",\"relationName\":\"ContractToIdentityDocument\",\"relationFromFields\":[\"identityDocumentId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"salesPlatformId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"salesPlatform\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"SalesPlatform\",\"relationName\":\"ContractToSalesPlatform\",\"relationFromFields\":[\"salesPlatformId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationPeriodId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationPeriod\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CancellationPeriod\",\"relationName\":\"CancellationPeriodToContract\",\"relationFromFields\":[\"cancellationPeriodId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractDurationId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractDuration\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractDuration\",\"relationName\":\"ContractToContractDuration\",\"relationFromFields\":[\"contractDurationId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractHistory\",\"relationFromFields\":[\"previousContractId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"followUpContract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractHistory\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousProviderId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousProvider\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Provider\",\"relationName\":\"PreviousProvider\",\"relationFromFields\":[\"previousProviderId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousCustomerNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousContractNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"providerId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"provider\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Provider\",\"relationName\":\"ContractToProvider\",\"relationFromFields\":[\"providerId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariffId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariff\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Tariff\",\"relationName\":\"ContractToTariff\",\"relationFromFields\":[\"tariffId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"providerName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tariffName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"customerNumberAtProvider\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractNumberAtProvider\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceFirst12Months\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceFrom13Months\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"priceAfter24Months\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"startDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"endDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"commission\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationLetterPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationLetterOptionsPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationOptionsPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"cancellationConfirmationOptionsDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"wasSpecialCancellation\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalUsername\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"portalPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmailId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"stressfreiEmail\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"StressfreiEmail\",\"relationName\":\"ContractToStressfreiEmail\",\"relationFromFields\":[\"stressfreiEmailId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"nextReviewDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EnergyContractDetails\",\"relationName\":\"ContractToEnergyContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"InternetContractDetails\",\"relationName\":\"ContractToInternetContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobileDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MobileContractDetails\",\"relationName\":\"ContractToMobileContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tvDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"TvContractDetails\",\"relationName\":\"ContractToTvContractDetails\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"carInsuranceDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CarInsuranceDetails\",\"relationName\":\"CarInsuranceDetailsToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tasks\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractTask\",\"relationName\":\"ContractToContractTask\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"assignedEmails\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"CachedEmail\",\"relationName\":\"CachedEmailToContract\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"historyEntries\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractHistoryEntry\",\"relationName\":\"ContractToContractHistoryEntry\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractHistoryEntry\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractHistoryEntry\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"title\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isAutomatic\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractTask\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToContractTask\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"title\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"description\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"ContractTaskStatus\",\"default\":\"OPEN\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"visibleInPortal\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"completedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"subtasks\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractTaskSubtask\",\"relationName\":\"ContractTaskToContractTaskSubtask\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"ContractTaskSubtask\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"taskId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"task\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"ContractTask\",\"relationName\":\"ContractTaskToContractTaskSubtask\",\"relationFromFields\":[\"taskId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"title\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"status\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"ContractTaskStatus\",\"default\":\"OPEN\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdBy\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"completedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"EnergyContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToEnergyContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meterId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"meter\",\"kind\":\"object\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Meter\",\"relationName\":\"EnergyContractDetailsToMeter\",\"relationFromFields\":[\"meterId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"maloId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"annualConsumption\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"annualConsumptionKwh\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"basePrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"unitPrice\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"bonus\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousProviderName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousCustomerNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"invoices\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Invoice\",\"relationName\":\"EnergyContractDetailsToInvoice\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Invoice\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyContractDetailsId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"energyContractDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"EnergyContractDetails\",\"relationName\":\"EnergyContractDetailsToInvoice\",\"relationFromFields\":[\"energyContractDetailsId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"invoiceDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"invoiceType\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"InvoiceType\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"documentPath\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"notes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"InternetContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToInternetContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"downloadSpeed\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"uploadSpeed\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"routerModel\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"routerSerialNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"installationDate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetUsername\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"homeId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"activationCode\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumbers\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PhoneNumber\",\"relationName\":\"InternetContractDetailsToPhoneNumber\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"PhoneNumber\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetContractDetailsId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"internetDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"InternetContractDetails\",\"relationName\":\"InternetContractDetailsToPhoneNumber\",\"relationFromFields\":[\"internetContractDetailsId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isMain\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sipUsername\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sipPasswordEncrypted\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sipServer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"MobileContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToMobileContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"requiresMultisim\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"dataVolume\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"includedMinutes\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"includedSMS\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deviceModel\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deviceImei\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"simCards\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"SimCard\",\"relationName\":\"MobileContractDetailsToSimCard\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"simCardNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"SimCard\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobileDetailsId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"mobileDetails\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"MobileContractDetails\",\"relationName\":\"MobileContractDetailsToSimCard\",\"relationFromFields\":[\"mobileDetailsId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"phoneNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"simCardNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"pin\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"puk\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isMultisim\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"isMain\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Boolean\",\"default\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":true}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"TvContractDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"ContractToTvContractDetails\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"receiverModel\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"smartcardNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"package\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"CarInsuranceDetails\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"Int\",\"default\":{\"name\":\"autoincrement\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contractId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"contract\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Contract\",\"relationName\":\"CarInsuranceDetailsToContract\",\"relationFromFields\":[\"contractId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"licensePlate\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hsn\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tsn\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vin\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"vehicleType\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"firstRegistration\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"noClaimsClass\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"insuranceType\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"InsuranceType\",\"default\":\"LIABILITY\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deductiblePartial\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"deductibleFull\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Float\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"policyNumber\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"previousInsurer\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false}},\"enums\":{\"CustomerType\":{\"values\":[{\"name\":\"PRIVATE\",\"dbName\":null},{\"name\":\"BUSINESS\",\"dbName\":null}],\"dbName\":null},\"AddressType\":{\"values\":[{\"name\":\"DELIVERY_RESIDENCE\",\"dbName\":null},{\"name\":\"BILLING\",\"dbName\":null}],\"dbName\":null},\"DocumentType\":{\"values\":[{\"name\":\"ID_CARD\",\"dbName\":null},{\"name\":\"PASSPORT\",\"dbName\":null},{\"name\":\"DRIVERS_LICENSE\",\"dbName\":null},{\"name\":\"OTHER\",\"dbName\":null}],\"dbName\":null},\"EmailProviderType\":{\"values\":[{\"name\":\"PLESK\",\"dbName\":null},{\"name\":\"CPANEL\",\"dbName\":null},{\"name\":\"DIRECTADMIN\",\"dbName\":null}],\"dbName\":null},\"MailEncryption\":{\"values\":[{\"name\":\"SSL\",\"dbName\":null},{\"name\":\"STARTTLS\",\"dbName\":null},{\"name\":\"NONE\",\"dbName\":null}],\"dbName\":null},\"EmailFolder\":{\"values\":[{\"name\":\"INBOX\",\"dbName\":null},{\"name\":\"SENT\",\"dbName\":null}],\"dbName\":null},\"MeterType\":{\"values\":[{\"name\":\"ELECTRICITY\",\"dbName\":null},{\"name\":\"GAS\",\"dbName\":null}],\"dbName\":null},\"ContractType\":{\"values\":[{\"name\":\"ELECTRICITY\",\"dbName\":null},{\"name\":\"GAS\",\"dbName\":null},{\"name\":\"DSL\",\"dbName\":null},{\"name\":\"CABLE\",\"dbName\":null},{\"name\":\"FIBER\",\"dbName\":null},{\"name\":\"MOBILE\",\"dbName\":null},{\"name\":\"TV\",\"dbName\":null},{\"name\":\"CAR_INSURANCE\",\"dbName\":null}],\"dbName\":null},\"ContractStatus\":{\"values\":[{\"name\":\"DRAFT\",\"dbName\":null},{\"name\":\"PENDING\",\"dbName\":null},{\"name\":\"ACTIVE\",\"dbName\":null},{\"name\":\"CANCELLED\",\"dbName\":null},{\"name\":\"EXPIRED\",\"dbName\":null},{\"name\":\"DEACTIVATED\",\"dbName\":null}],\"dbName\":null},\"ContractTaskStatus\":{\"values\":[{\"name\":\"OPEN\",\"dbName\":null},{\"name\":\"COMPLETED\",\"dbName\":null}],\"dbName\":null},\"InvoiceType\":{\"values\":[{\"name\":\"INTERIM\",\"dbName\":null},{\"name\":\"FINAL\",\"dbName\":null},{\"name\":\"NOT_AVAILABLE\",\"dbName\":null}],\"dbName\":null},\"InsuranceType\":{\"values\":[{\"name\":\"LIABILITY\",\"dbName\":null},{\"name\":\"PARTIAL\",\"dbName\":null},{\"name\":\"FULL\",\"dbName\":null}],\"dbName\":null}},\"types\":{}}") defineDmmfProperty(exports.Prisma, config.runtimeDataModel) config.engineWasm = undefined diff --git a/backend/node_modules/.prisma/client/package.json b/backend/node_modules/.prisma/client/package.json index a921b247..e06e0e9e 100644 --- a/backend/node_modules/.prisma/client/package.json +++ b/backend/node_modules/.prisma/client/package.json @@ -1,5 +1,5 @@ { - "name": "prisma-client-ab03eeebd49b41f4edbc7df102e0a7779d814508dbccb860745760460e9e271f", + "name": "prisma-client-652f85dbf9d7be282ff4b16714e4689fe4701aade21c76f6bcc5db624157e639", "main": "index.js", "types": "index.d.ts", "browser": "index-browser.js", diff --git a/backend/node_modules/.prisma/client/schema.prisma b/backend/node_modules/.prisma/client/schema.prisma index affa7b63..592b478f 100644 --- a/backend/node_modules/.prisma/client/schema.prisma +++ b/backend/node_modules/.prisma/client/schema.prisma @@ -566,11 +566,25 @@ model Contract { tasks ContractTask[] assignedEmails CachedEmail[] // Zugeordnete E-Mails aus dem E-Mail-Client + historyEntries ContractHistoryEntry[] createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } +// ==================== CONTRACT HISTORY ==================== + +model ContractHistoryEntry { + id Int @id @default(autoincrement()) + contractId Int + contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade) + title String // Kurzbeschreibung (z.B. "Folgevertrag erstellt", "kWh auf 18000 erhöht") + description String? @db.Text // Längere Beschreibung (optional) + isAutomatic Boolean @default(false) // true = automatisch erstellt, false = manuell + createdBy String // E-Mail des Erstellers + createdAt DateTime @default(now()) +} + // ==================== CONTRACT TASKS ==================== enum ContractTaskStatus { diff --git a/backend/node_modules/.prisma/client/wasm.js b/backend/node_modules/.prisma/client/wasm.js index ffc29f95..5dc32177 100644 --- a/backend/node_modules/.prisma/client/wasm.js +++ b/backend/node_modules/.prisma/client/wasm.js @@ -443,6 +443,16 @@ exports.Prisma.ContractScalarFieldEnum = { updatedAt: 'updatedAt' }; +exports.Prisma.ContractHistoryEntryScalarFieldEnum = { + id: 'id', + contractId: 'contractId', + title: 'title', + description: 'description', + isAutomatic: 'isAutomatic', + createdBy: 'createdBy', + createdAt: 'createdAt' +}; + exports.Prisma.ContractTaskScalarFieldEnum = { id: 'id', contractId: 'contractId', @@ -676,6 +686,7 @@ exports.Prisma.ModelName = { Tariff: 'Tariff', ContractCategory: 'ContractCategory', Contract: 'Contract', + ContractHistoryEntry: 'ContractHistoryEntry', ContractTask: 'ContractTask', ContractTaskSubtask: 'ContractTaskSubtask', EnergyContractDetails: 'EnergyContractDetails', diff --git a/backend/prisma/migrations/20260208174811_add_contract_history/migration.sql b/backend/prisma/migrations/20260208174811_add_contract_history/migration.sql new file mode 100644 index 00000000..6b6c3a94 --- /dev/null +++ b/backend/prisma/migrations/20260208174811_add_contract_history/migration.sql @@ -0,0 +1,15 @@ +-- CreateTable +CREATE TABLE `ContractHistoryEntry` ( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `contractId` INTEGER NOT NULL, + `title` VARCHAR(191) NOT NULL, + `description` TEXT NULL, + `isAutomatic` BOOLEAN NOT NULL DEFAULT false, + `createdBy` VARCHAR(191) NOT NULL, + `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), + + PRIMARY KEY (`id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- AddForeignKey +ALTER TABLE `ContractHistoryEntry` ADD CONSTRAINT `ContractHistoryEntry_contractId_fkey` FOREIGN KEY (`contractId`) REFERENCES `Contract`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma index fd16deb8..41ee4c56 100644 --- a/backend/prisma/schema.prisma +++ b/backend/prisma/schema.prisma @@ -566,11 +566,25 @@ model Contract { tasks ContractTask[] assignedEmails CachedEmail[] // Zugeordnete E-Mails aus dem E-Mail-Client + historyEntries ContractHistoryEntry[] createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } +// ==================== CONTRACT HISTORY ==================== + +model ContractHistoryEntry { + id Int @id @default(autoincrement()) + contractId Int + contract Contract @relation(fields: [contractId], references: [id], onDelete: Cascade) + title String // Kurzbeschreibung (z.B. "Folgevertrag erstellt", "kWh auf 18000 erhöht") + description String? @db.Text // Längere Beschreibung (optional) + isAutomatic Boolean @default(false) // true = automatisch erstellt, false = manuell + createdBy String // E-Mail des Erstellers + createdAt DateTime @default(now()) +} + // ==================== CONTRACT TASKS ==================== enum ContractTaskStatus { diff --git a/backend/src/controllers/contract.controller.ts b/backend/src/controllers/contract.controller.ts index 8d3b6f70..0371193a 100644 --- a/backend/src/controllers/contract.controller.ts +++ b/backend/src/controllers/contract.controller.ts @@ -2,6 +2,7 @@ import { Request, Response } from 'express'; import { PrismaClient } from '@prisma/client'; import * as contractService from '../services/contract.service.js'; import * as contractCockpitService from '../services/contractCockpit.service.js'; +import * as contractHistoryService from '../services/contractHistory.service.js'; import { ApiResponse, AuthRequest } from '../types/index.js'; const prisma = new PrismaClient(); @@ -116,9 +117,38 @@ export async function deleteContract(req: Request, res: Response): Promise } } -export async function createFollowUp(req: Request, res: Response): Promise { +export async function createFollowUp(req: AuthRequest, res: Response): Promise { try { - const contract = await contractService.createFollowUpContract(parseInt(req.params.id)); + const previousContractId = parseInt(req.params.id); + + // Vorgängervertrag laden für Vertragsnummer + const previousContract = await prisma.contract.findUnique({ + where: { id: previousContractId }, + select: { contractNumber: true }, + }); + + if (!previousContract) { + res.status(404).json({ success: false, error: 'Vorgängervertrag nicht gefunden' } as ApiResponse); + return; + } + + const contract = await contractService.createFollowUpContract(previousContractId); + const createdBy = req.user?.email || 'unbekannt'; + + // Historie-Eintrag für den Vorgängervertrag erstellen + await contractHistoryService.createFollowUpHistoryEntry( + previousContractId, + contract.contractNumber, + createdBy + ); + + // Historie-Eintrag für den neuen Folgevertrag erstellen + await contractHistoryService.createNewContractFromPredecessorEntry( + contract.id, + previousContract.contractNumber, + createdBy + ); + res.status(201).json({ success: true, data: contract } as ApiResponse); } catch (error) { res.status(400).json({ diff --git a/backend/src/controllers/contractHistory.controller.ts b/backend/src/controllers/contractHistory.controller.ts new file mode 100644 index 00000000..443c404c --- /dev/null +++ b/backend/src/controllers/contractHistory.controller.ts @@ -0,0 +1,81 @@ +import { Request, Response } from 'express'; +import * as contractHistoryService from '../services/contractHistory.service.js'; +import { ApiResponse, AuthRequest } from '../types/index.js'; + +export async function getHistoryEntries(req: AuthRequest, res: Response): Promise { + try { + const contractId = parseInt(req.params.contractId); + const entries = await contractHistoryService.getHistoryEntries(contractId); + res.json({ success: true, data: entries } as ApiResponse); + } catch (error) { + res.status(500).json({ + success: false, + error: 'Fehler beim Laden der Historie', + } as ApiResponse); + } +} + +export async function createHistoryEntry(req: AuthRequest, res: Response): Promise { + try { + const contractId = parseInt(req.params.contractId); + const { title, description } = req.body; + + if (!title || typeof title !== 'string' || title.trim().length === 0) { + res.status(400).json({ + success: false, + error: 'Titel ist erforderlich', + } as ApiResponse); + return; + } + + const entry = await contractHistoryService.createHistoryEntry(contractId, { + title: title.trim(), + description: description?.trim() || undefined, + isAutomatic: false, + createdBy: req.user?.email || 'unbekannt', + }); + + res.status(201).json({ success: true, data: entry } as ApiResponse); + } catch (error) { + res.status(400).json({ + success: false, + error: error instanceof Error ? error.message : 'Fehler beim Erstellen des Eintrags', + } as ApiResponse); + } +} + +export async function updateHistoryEntry(req: AuthRequest, res: Response): Promise { + try { + const contractId = parseInt(req.params.contractId); + const entryId = parseInt(req.params.entryId); + const { title, description } = req.body; + + const entry = await contractHistoryService.updateHistoryEntry(contractId, entryId, { + title: title?.trim(), + description: description?.trim(), + }); + + res.json({ success: true, data: entry } as ApiResponse); + } catch (error) { + res.status(400).json({ + success: false, + error: error instanceof Error ? error.message : 'Fehler beim Aktualisieren des Eintrags', + } as ApiResponse); + } +} + +export async function deleteHistoryEntry(req: AuthRequest, res: Response): Promise { + try { + const contractId = parseInt(req.params.contractId); + const entryId = parseInt(req.params.entryId); + + await contractHistoryService.deleteHistoryEntry(contractId, entryId); + + res.json({ success: true, message: 'Eintrag gelöscht' } as ApiResponse); + } catch (error) { + res.status(400).json({ + success: false, + error: error instanceof Error ? error.message : 'Fehler beim Löschen des Eintrags', + } as ApiResponse); + } +} diff --git a/backend/src/index.ts b/backend/src/index.ts index c9f4a7bf..4763d7bb 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -25,6 +25,7 @@ import appSettingRoutes from './routes/appSetting.routes.js'; import emailProviderRoutes from './routes/emailProvider.routes.js'; import cachedEmailRoutes from './routes/cachedEmail.routes.js'; import invoiceRoutes from './routes/invoice.routes.js'; +import contractHistoryRoutes from './routes/contractHistory.routes.js'; dotenv.config(); @@ -61,6 +62,7 @@ app.use('/api/settings', appSettingRoutes); app.use('/api/email-providers', emailProviderRoutes); app.use('/api', cachedEmailRoutes); app.use('/api/energy-details', invoiceRoutes); +app.use('/api', contractHistoryRoutes); // Health check app.get('/api/health', (req, res) => { diff --git a/backend/src/routes/contractHistory.routes.ts b/backend/src/routes/contractHistory.routes.ts new file mode 100644 index 00000000..fd801400 --- /dev/null +++ b/backend/src/routes/contractHistory.routes.ts @@ -0,0 +1,39 @@ +import { Router } from 'express'; +import * as contractHistoryController from '../controllers/contractHistory.controller.js'; +import { authenticate, requirePermission } from '../middleware/auth.js'; + +const router = Router(); + +// Alle Einträge für einen Vertrag +router.get( + '/contracts/:contractId/history', + authenticate, + requirePermission('contracts:read'), + contractHistoryController.getHistoryEntries +); + +// Neuen Eintrag erstellen +router.post( + '/contracts/:contractId/history', + authenticate, + requirePermission('contracts:update'), + contractHistoryController.createHistoryEntry +); + +// Eintrag aktualisieren +router.put( + '/contracts/:contractId/history/:entryId', + authenticate, + requirePermission('contracts:update'), + contractHistoryController.updateHistoryEntry +); + +// Eintrag löschen +router.delete( + '/contracts/:contractId/history/:entryId', + authenticate, + requirePermission('contracts:update'), + contractHistoryController.deleteHistoryEntry +); + +export default router; diff --git a/backend/src/services/contract.service.ts b/backend/src/services/contract.service.ts index 7adc9a3d..a7e07cc2 100644 --- a/backend/src/services/contract.service.ts +++ b/backend/src/services/contract.service.ts @@ -626,7 +626,7 @@ export async function createFollowUpContract(previousContractId: number) { // Explicitly NOT copying: providerName, tariffName, portalUsername, portalPassword, price fields cancellationPeriodId: previousContract.cancellationPeriodId ?? undefined, contractDurationId: previousContract.contractDurationId ?? undefined, - notes: `Folgevertrag zu ${previousContract.contractNumber}`, + // notes nicht mehr automatisch setzen - wird jetzt über Historie-Eintrag dokumentiert }; // Copy type-specific details (without credentials) diff --git a/backend/src/services/contractHistory.service.ts b/backend/src/services/contractHistory.service.ts new file mode 100644 index 00000000..a7fffb53 --- /dev/null +++ b/backend/src/services/contractHistory.service.ts @@ -0,0 +1,133 @@ +import { PrismaClient } from '@prisma/client'; + +const prisma = new PrismaClient(); + +export interface CreateHistoryEntryData { + title: string; + description?: string; + isAutomatic?: boolean; + createdBy: string; +} + +/** + * Alle Historie-Einträge für einen Vertrag abrufen + */ +export async function getHistoryEntries(contractId: number) { + return prisma.contractHistoryEntry.findMany({ + where: { contractId }, + orderBy: { createdAt: 'desc' }, + }); +} + +/** + * Einzelnen Historie-Eintrag abrufen + */ +export async function getHistoryEntry(contractId: number, entryId: number) { + return prisma.contractHistoryEntry.findFirst({ + where: { id: entryId, contractId }, + }); +} + +/** + * Neuen Historie-Eintrag erstellen + */ +export async function createHistoryEntry(contractId: number, data: CreateHistoryEntryData) { + // Prüfen ob Vertrag existiert + const contract = await prisma.contract.findUnique({ + where: { id: contractId }, + }); + + if (!contract) { + throw new Error('Vertrag nicht gefunden'); + } + + return prisma.contractHistoryEntry.create({ + data: { + contractId, + title: data.title, + description: data.description, + isAutomatic: data.isAutomatic ?? false, + createdBy: data.createdBy, + }, + }); +} + +/** + * Historie-Eintrag aktualisieren (nur manuelle Einträge) + */ +export async function updateHistoryEntry( + contractId: number, + entryId: number, + data: { title?: string; description?: string } +) { + const entry = await prisma.contractHistoryEntry.findFirst({ + where: { id: entryId, contractId }, + }); + + if (!entry) { + throw new Error('Historie-Eintrag nicht gefunden'); + } + + if (entry.isAutomatic) { + throw new Error('Automatische Einträge können nicht bearbeitet werden'); + } + + return prisma.contractHistoryEntry.update({ + where: { id: entryId }, + data: { + title: data.title, + description: data.description, + }, + }); +} + +/** + * Historie-Eintrag löschen (nur manuelle Einträge) + */ +export async function deleteHistoryEntry(contractId: number, entryId: number) { + const entry = await prisma.contractHistoryEntry.findFirst({ + where: { id: entryId, contractId }, + }); + + if (!entry) { + throw new Error('Historie-Eintrag nicht gefunden'); + } + + if (entry.isAutomatic) { + throw new Error('Automatische Einträge können nicht gelöscht werden'); + } + + return prisma.contractHistoryEntry.delete({ where: { id: entryId } }); +} + +/** + * Automatischen Historie-Eintrag für Folgevertrag erstellen (im Vorgängervertrag) + */ +export async function createFollowUpHistoryEntry( + previousContractId: number, + newContractNumber: string, + createdBy: string +) { + return createHistoryEntry(previousContractId, { + title: `Folgevertrag erstellt: ${newContractNumber}`, + description: `Ein neuer Folgevertrag (${newContractNumber}) wurde aus diesem Vertrag erstellt.`, + isAutomatic: true, + createdBy, + }); +} + +/** + * Automatischen Historie-Eintrag für neuen Folgevertrag erstellen (im neuen Vertrag selbst) + */ +export async function createNewContractFromPredecessorEntry( + newContractId: number, + previousContractNumber: string, + createdBy: string +) { + return createHistoryEntry(newContractId, { + title: `Folgevertrag zu ${previousContractNumber}`, + description: `Dieser Vertrag wurde als Folgevertrag zu ${previousContractNumber} erstellt.`, + isAutomatic: true, + createdBy, + }); +} diff --git a/frontend/dist/assets/index-B06MVODt.css b/frontend/dist/assets/index-B06MVODt.css deleted file mode 100644 index 1e63cbca..00000000 --- a/frontend/dist/assets/index-B06MVODt.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.bottom-4{bottom:1rem}.bottom-6{bottom:1.5rem}.left-3{left:.75rem}.left-4{left:1rem}.right-0{right:0}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-0{top:0}.top-1\/2{top:50%}.top-4{top:1rem}.top-full{top:100%}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2 / span 2}.-mx-2{margin-left:-.5rem;margin-right:-.5rem}.-mx-6{margin-left:-1.5rem;margin-right:-1.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-3{margin-top:.75rem;margin-bottom:.75rem}.-mb-6{margin-bottom:-1.5rem}.-mb-px{margin-bottom:-1px}.-ml-1{margin-left:-.25rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-4{margin-right:1rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-0\.5{height:.125rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-8{height:2rem}.h-\[85vh\]{height:85vh}.h-full{height:100%}.max-h-40{max-height:10rem}.max-h-48{max-height:12rem}.max-h-80{max-height:20rem}.max-h-96{max-height:24rem}.max-h-\[600px\]{max-height:600px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[90vh\]{max-height:90vh}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-1\/3{width:33.333333%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-\[90vw\]{width:90vw}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[90px\]{min-width:90px}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-8>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(2rem * var(--tw-space-x-reverse));margin-left:calc(2rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(229 231 235 / var(--tw-divide-opacity, 1))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-l-lg{border-top-left-radius:.5rem;border-bottom-left-radius:.5rem}.rounded-r-lg{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l-0{border-left-width:0px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-amber-300{--tw-border-opacity: 1;border-color:rgb(252 211 77 / var(--tw-border-opacity, 1))}.border-blue-100{--tw-border-opacity: 1;border-color:rgb(219 234 254 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-600{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-400{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-purple-300{--tw-border-opacity: 1;border-color:rgb(216 180 254 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-400{--tw-border-opacity: 1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-600{--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-300{--tw-border-opacity: 1;border-color:rgb(253 224 71 / var(--tw-border-opacity, 1))}.border-l-blue-500{--tw-border-opacity: 1;border-left-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-l-gray-300{--tw-border-opacity: 1;border-left-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-l-gray-400{--tw-border-opacity: 1;border-left-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.border-t-transparent{border-top-color:transparent}.bg-amber-100{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/20{background-color:#0003}.bg-black\/50{background-color:#00000080}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-50\/50{background-color:#f9fafb80}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-orange-100{--tw-bg-opacity: 1;background-color:rgb(255 237 213 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-opacity-50{--tw-bg-opacity: .5}.fill-current{fill:currentColor}.\!p-4{padding:1rem!important}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-3{padding-left:.75rem}.pr-10{padding-right:2.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.line-through{text-decoration-line:line-through}.opacity-0{opacity:0}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-blue-500{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.ring-gray-400{--tw-ring-opacity: 1;--tw-ring-color: rgb(156 163 175 / var(--tw-ring-opacity, 1))}.ring-offset-2{--tw-ring-offset-width: 2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}body{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:h-5:after{content:var(--tw-content);height:1.25rem}.after\:w-5:after{content:var(--tw-content);width:1.25rem}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:border:after{content:var(--tw-content);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.after\:bg-white:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.after\:content-\[\'\'\]:after{--tw-content: "";content:var(--tw-content)}.last\:border-0:last-child{border-width:0px}.last\:border-b-0:last-child{border-bottom-width:0px}.hover\:border-blue-300:hover{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:border-gray-400:hover{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.hover\:bg-amber-200:hover{--tw-bg-opacity: 1;background-color:rgb(253 230 138 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-50:hover{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-800:hover{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.hover\:bg-green-100:hover{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\:bg-opacity-50:hover{--tw-bg-opacity: .5}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:text-blue-800:hover{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.hover\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.hover\:text-green-600:hover{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-600:hover{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-red-500:focus{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.focus\:border-transparent:focus{border-color:transparent}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-gray-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(107 114 128 / var(--tw-ring-opacity, 1))}.focus\:ring-purple-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(168 85 247 / var(--tw-ring-opacity, 1))}.focus\:ring-red-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.group\/subtask:hover .group-hover\/subtask\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.peer:checked~.peer-checked\:bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:after\:translate-x-full:after{content:var(--tw-content);--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:checked~.peer-checked\:after\:border-white:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.peer:focus~.peer-focus\:outline-none{outline:2px solid transparent;outline-offset:2px}.peer:focus~.peer-focus\:ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.peer:focus~.peer-focus\:ring-blue-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity, 1))}@media (min-width: 640px){.sm\:w-auto{width:auto}}@media (min-width: 768px){.md\:col-span-2{grid-column:span 2 / span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-3{grid-column:span 3 / span 3}.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}} diff --git a/frontend/dist/assets/index-Cdzd21Iz.js b/frontend/dist/assets/index-Cdzd21Iz.js new file mode 100644 index 00000000..69eaba96 --- /dev/null +++ b/frontend/dist/assets/index-Cdzd21Iz.js @@ -0,0 +1,725 @@ +var vf=e=>{throw TypeError(e)};var zc=(e,t,n)=>t.has(e)||vf("Cannot "+n);var M=(e,t,n)=>(zc(e,t,"read from private field"),n?n.call(e):t.get(e)),me=(e,t,n)=>t.has(e)?vf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),te=(e,t,n,r)=>(zc(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),be=(e,t,n)=>(zc(e,t,"access private method"),n);var Ll=(e,t,n,r)=>({set _(a){te(e,t,a,n)},get _(){return M(e,t,r)}});function Qv(e,t){for(var n=0;nr[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function Hv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sg={exports:{}},rc={},ng={exports:{}},Ee={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var bl=Symbol.for("react.element"),Wv=Symbol.for("react.portal"),Gv=Symbol.for("react.fragment"),Zv=Symbol.for("react.strict_mode"),Jv=Symbol.for("react.profiler"),Xv=Symbol.for("react.provider"),Yv=Symbol.for("react.context"),ej=Symbol.for("react.forward_ref"),tj=Symbol.for("react.suspense"),sj=Symbol.for("react.memo"),nj=Symbol.for("react.lazy"),jf=Symbol.iterator;function rj(e){return e===null||typeof e!="object"?null:(e=jf&&e[jf]||e["@@iterator"],typeof e=="function"?e:null)}var rg={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ag=Object.assign,ig={};function Ya(e,t,n){this.props=e,this.context=t,this.refs=ig,this.updater=n||rg}Ya.prototype.isReactComponent={};Ya.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ya.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function lg(){}lg.prototype=Ya.prototype;function Yu(e,t,n){this.props=e,this.context=t,this.refs=ig,this.updater=n||rg}var em=Yu.prototype=new lg;em.constructor=Yu;ag(em,Ya.prototype);em.isPureReactComponent=!0;var bf=Array.isArray,og=Object.prototype.hasOwnProperty,tm={current:null},cg={key:!0,ref:!0,__self:!0,__source:!0};function dg(e,t,n){var r,a={},i=null,l=null;if(t!=null)for(r in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(i=""+t.key),t)og.call(t,r)&&!cg.hasOwnProperty(r)&&(a[r]=t[r]);var o=arguments.length-2;if(o===1)a.children=n;else if(1>>1,de=B[le];if(0>>1;lea(st,Q))Ca(nt,st)?(B[le]=nt,B[C]=Q,le=C):(B[le]=st,B[Ve]=Q,le=Ve);else if(Ca(nt,Q))B[le]=nt,B[C]=Q,le=C;else break e}}return _}function a(B,_){var Q=B.sortIndex-_.sortIndex;return Q!==0?Q:B.id-_.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,o=l.now();e.unstable_now=function(){return l.now()-o}}var c=[],d=[],u=1,h=null,x=3,m=!1,f=!1,p=!1,b=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(B){for(var _=n(d);_!==null;){if(_.callback===null)r(d);else if(_.startTime<=B)r(d),_.sortIndex=_.expirationTime,t(c,_);else break;_=n(d)}}function N(B){if(p=!1,v(B),!f)if(n(c)!==null)f=!0,k(E);else{var _=n(d);_!==null&&K(N,_.startTime-B)}}function E(B,_){f=!1,p&&(p=!1,g(w),w=-1),m=!0;var Q=x;try{for(v(_),h=n(c);h!==null&&(!(h.expirationTime>_)||B&&!O());){var le=h.callback;if(typeof le=="function"){h.callback=null,x=h.priorityLevel;var de=le(h.expirationTime<=_);_=e.unstable_now(),typeof de=="function"?h.callback=de:h===n(c)&&r(c),v(_)}else r(c);h=n(c)}if(h!==null)var Ke=!0;else{var Ve=n(d);Ve!==null&&K(N,Ve.startTime-_),Ke=!1}return Ke}finally{h=null,x=Q,m=!1}}var P=!1,I=null,w=-1,S=5,A=-1;function O(){return!(e.unstable_now()-AB||125le?(B.sortIndex=Q,t(d,B),n(c)===null&&B===n(d)&&(p?(g(w),w=-1):p=!0,K(N,Q-le))):(B.sortIndex=de,t(c,B),f||m||(f=!0,k(E))),B},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(B){var _=x;return function(){var Q=x;x=_;try{return B.apply(this,arguments)}finally{x=Q}}}})(pg);fg.exports=pg;var xj=fg.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var gj=j,js=xj;function Y(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wd=Object.prototype.hasOwnProperty,yj=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,wf={},Sf={};function vj(e){return wd.call(Sf,e)?!0:wd.call(wf,e)?!1:yj.test(e)?Sf[e]=!0:(wf[e]=!0,!1)}function jj(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function bj(e,t,n,r){if(t===null||typeof t>"u"||jj(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Xt(e,t,n,r,a,i,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=l}var Lt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Lt[e]=new Xt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Lt[t]=new Xt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Lt[e]=new Xt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Lt[e]=new Xt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Lt[e]=new Xt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Lt[e]=new Xt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Lt[e]=new Xt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Lt[e]=new Xt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Lt[e]=new Xt(e,5,!1,e.toLowerCase(),null,!1,!1)});var nm=/[\-:]([a-z])/g;function rm(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(nm,rm);Lt[t]=new Xt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(nm,rm);Lt[t]=new Xt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(nm,rm);Lt[t]=new Xt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Lt[e]=new Xt(e,1,!1,e.toLowerCase(),null,!1,!1)});Lt.xlinkHref=new Xt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Lt[e]=new Xt(e,1,!1,e.toLowerCase(),null,!0,!0)});function am(e,t,n,r){var a=Lt.hasOwnProperty(t)?Lt[t]:null;(a!==null?a.type!==0:r||!(2o||a[l]!==i[o]){var c=` +`+a[l].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=l&&0<=o);break}}}finally{Kc=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?bi(e):""}function Nj(e){switch(e.tag){case 5:return bi(e.type);case 16:return bi("Lazy");case 13:return bi("Suspense");case 19:return bi("SuspenseList");case 0:case 2:case 15:return e=Bc(e.type,!1),e;case 11:return e=Bc(e.type.render,!1),e;case 1:return e=Bc(e.type,!0),e;default:return""}}function Ed(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case oa:return"Fragment";case la:return"Portal";case Sd:return"Profiler";case im:return"StrictMode";case kd:return"Suspense";case Cd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case yg:return(e.displayName||"Context")+".Consumer";case gg:return(e._context.displayName||"Context")+".Provider";case lm:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case om:return t=e.displayName||null,t!==null?t:Ed(e.type)||"Memo";case $n:t=e._payload,e=e._init;try{return Ed(e(t))}catch{}}return null}function wj(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ed(t);case 8:return t===im?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function fr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function jg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Sj(e){var t=jg(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(l){r=""+l,i.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(l){r=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function $l(e){e._valueTracker||(e._valueTracker=Sj(e))}function bg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=jg(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function wo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Dd(e,t){var n=t.checked;return ot({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Cf(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=fr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ng(e,t){t=t.checked,t!=null&&am(e,"checked",t,!1)}function Ad(e,t){Ng(e,t);var n=fr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Pd(e,t.type,n):t.hasOwnProperty("defaultValue")&&Pd(e,t.type,fr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ef(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Pd(e,t,n){(t!=="number"||wo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ni=Array.isArray;function ja(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=_l.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function _i(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ei={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},kj=["Webkit","ms","Moz","O"];Object.keys(Ei).forEach(function(e){kj.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ei[t]=Ei[e]})});function Cg(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ei.hasOwnProperty(e)&&Ei[e]?(""+t).trim():t+"px"}function Eg(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=Cg(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var Cj=ot({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Fd(e,t){if(t){if(Cj[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Y(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Y(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Y(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Y(62))}}function Id(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Rd=null;function cm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ld=null,ba=null,Na=null;function Pf(e){if(e=Sl(e)){if(typeof Ld!="function")throw Error(Y(280));var t=e.stateNode;t&&(t=cc(t),Ld(e.stateNode,e.type,t))}}function Dg(e){ba?Na?Na.push(e):Na=[e]:ba=e}function Ag(){if(ba){var e=ba,t=Na;if(Na=ba=null,Pf(e),t)for(e=0;e>>=0,e===0?32:31-(Oj(e)/zj|0)|0}var Kl=64,Bl=4194304;function wi(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Eo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,a=e.suspendedLanes,i=e.pingedLanes,l=n&268435455;if(l!==0){var o=l&~a;o!==0?r=wi(o):(i&=l,i!==0&&(r=wi(i)))}else l=n&~a,l!==0?r=wi(l):i!==0&&(r=wi(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&a)&&(a=r&-r,i=t&-t,a>=i||a===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Nl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Bs(t),e[t]=n}function Bj(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Ai),$f=" ",_f=!1;function Gg(e,t){switch(e){case"keyup":return xb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ca=!1;function yb(e,t){switch(e){case"compositionend":return Zg(t);case"keypress":return t.which!==32?null:(_f=!0,$f);case"textInput":return e=t.data,e===$f&&_f?null:e;default:return null}}function vb(e,t){if(ca)return e==="compositionend"||!gm&&Gg(e,t)?(e=Hg(),lo=fm=tr=null,ca=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=qf(n)}}function ey(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ey(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ty(){for(var e=window,t=wo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=wo(e.document)}return t}function ym(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Db(e){var t=ty(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ey(n.ownerDocument.documentElement,n)){if(r!==null&&ym(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,i=Math.min(r.start,a);r=r.end===void 0?i:Math.min(r.end,a),!e.extend&&i>r&&(a=r,r=i,i=a),a=Vf(n,i);var l=Vf(n,r);a&&l&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,da=null,Bd=null,Mi=null,Ud=!1;function Qf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ud||da==null||da!==wo(r)||(r=da,"selectionStart"in r&&ym(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Mi&&Qi(Mi,r)||(Mi=r,r=Po(Bd,"onSelect"),0ha||(e.current=Gd[ha],Gd[ha]=null,ha--)}function Qe(e,t){ha++,Gd[ha]=e.current,e.current=t}var pr={},Ut=yr(pr),os=yr(!1),qr=pr;function qa(e,t){var n=e.type.contextTypes;if(!n)return pr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in n)a[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function cs(e){return e=e.childContextTypes,e!=null}function To(){Je(os),Je(Ut)}function Yf(e,t,n){if(Ut.current!==pr)throw Error(Y(168));Qe(Ut,t),Qe(os,n)}function dy(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var a in r)if(!(a in t))throw Error(Y(108,wj(e)||"Unknown",a));return ot({},n,r)}function Fo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pr,qr=Ut.current,Qe(Ut,e),Qe(os,os.current),!0}function ep(e,t,n){var r=e.stateNode;if(!r)throw Error(Y(169));n?(e=dy(e,t,qr),r.__reactInternalMemoizedMergedChildContext=e,Je(os),Je(Ut),Qe(Ut,e)):Je(os),Qe(os,n)}var gn=null,dc=!1,sd=!1;function uy(e){gn===null?gn=[e]:gn.push(e)}function _b(e){dc=!0,uy(e)}function vr(){if(!sd&&gn!==null){sd=!0;var e=0,t=Ue;try{var n=gn;for(Ue=1;e>=l,a-=l,wn=1<<32-Bs(t)+a|n<w?(S=I,I=null):S=I.sibling;var A=x(g,I,v[w],N);if(A===null){I===null&&(I=S);break}e&&I&&A.alternate===null&&t(g,I),y=i(A,y,w),P===null?E=A:P.sibling=A,P=A,I=S}if(w===v.length)return n(g,I),tt&&Nr(g,w),E;if(I===null){for(;ww?(S=I,I=null):S=I.sibling;var O=x(g,I,A.value,N);if(O===null){I===null&&(I=S);break}e&&I&&O.alternate===null&&t(g,I),y=i(O,y,w),P===null?E=O:P.sibling=O,P=O,I=S}if(A.done)return n(g,I),tt&&Nr(g,w),E;if(I===null){for(;!A.done;w++,A=v.next())A=h(g,A.value,N),A!==null&&(y=i(A,y,w),P===null?E=A:P.sibling=A,P=A);return tt&&Nr(g,w),E}for(I=r(g,I);!A.done;w++,A=v.next())A=m(I,g,w,A.value,N),A!==null&&(e&&A.alternate!==null&&I.delete(A.key===null?w:A.key),y=i(A,y,w),P===null?E=A:P.sibling=A,P=A);return e&&I.forEach(function(R){return t(g,R)}),tt&&Nr(g,w),E}function b(g,y,v,N){if(typeof v=="object"&&v!==null&&v.type===oa&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case zl:e:{for(var E=v.key,P=y;P!==null;){if(P.key===E){if(E=v.type,E===oa){if(P.tag===7){n(g,P.sibling),y=a(P,v.props.children),y.return=g,g=y;break e}}else if(P.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===$n&&np(E)===P.type){n(g,P.sibling),y=a(P,v.props),y.ref=xi(g,P,v),y.return=g,g=y;break e}n(g,P);break}else t(g,P);P=P.sibling}v.type===oa?(y=Kr(v.props.children,g.mode,N,v.key),y.return=g,g=y):(N=xo(v.type,v.key,v.props,null,g.mode,N),N.ref=xi(g,y,v),N.return=g,g=N)}return l(g);case la:e:{for(P=v.key;y!==null;){if(y.key===P)if(y.tag===4&&y.stateNode.containerInfo===v.containerInfo&&y.stateNode.implementation===v.implementation){n(g,y.sibling),y=a(y,v.children||[]),y.return=g,g=y;break e}else{n(g,y);break}else t(g,y);y=y.sibling}y=dd(v,g.mode,N),y.return=g,g=y}return l(g);case $n:return P=v._init,b(g,y,P(v._payload),N)}if(Ni(v))return f(g,y,v,N);if(ui(v))return p(g,y,v,N);Gl(g,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,y!==null&&y.tag===6?(n(g,y.sibling),y=a(y,v),y.return=g,g=y):(n(g,y),y=cd(v,g.mode,N),y.return=g,g=y),l(g)):n(g,y)}return b}var Qa=py(!0),xy=py(!1),Lo=yr(null),Oo=null,xa=null,Nm=null;function wm(){Nm=xa=Oo=null}function Sm(e){var t=Lo.current;Je(Lo),e._currentValue=t}function Xd(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Sa(e,t){Oo=e,Nm=xa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ls=!0),e.firstContext=null)}function Ts(e){var t=e._currentValue;if(Nm!==e)if(e={context:e,memoizedValue:t,next:null},xa===null){if(Oo===null)throw Error(Y(308));xa=e,Oo.dependencies={lanes:0,firstContext:e}}else xa=xa.next=e;return t}var Cr=null;function km(e){Cr===null?Cr=[e]:Cr.push(e)}function gy(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,km(t)):(n.next=a.next,a.next=n),t.interleaved=n,Pn(e,r)}function Pn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var _n=!1;function Cm(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function yy(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Cn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function or(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Te&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Pn(e,n)}return a=r.interleaved,a===null?(t.next=t,km(r)):(t.next=a.next,a.next=t),r.interleaved=t,Pn(e,n)}function co(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,um(e,n)}}function rp(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?a=i=l:i=i.next=l,n=n.next}while(n!==null);i===null?a=i=t:i=i.next=t}else a=i=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function zo(e,t,n,r){var a=e.updateQueue;_n=!1;var i=a.firstBaseUpdate,l=a.lastBaseUpdate,o=a.shared.pending;if(o!==null){a.shared.pending=null;var c=o,d=c.next;c.next=null,l===null?i=d:l.next=d,l=c;var u=e.alternate;u!==null&&(u=u.updateQueue,o=u.lastBaseUpdate,o!==l&&(o===null?u.firstBaseUpdate=d:o.next=d,u.lastBaseUpdate=c))}if(i!==null){var h=a.baseState;l=0,u=d=c=null,o=i;do{var x=o.lane,m=o.eventTime;if((r&x)===x){u!==null&&(u=u.next={eventTime:m,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var f=e,p=o;switch(x=t,m=n,p.tag){case 1:if(f=p.payload,typeof f=="function"){h=f.call(m,h,x);break e}h=f;break e;case 3:f.flags=f.flags&-65537|128;case 0:if(f=p.payload,x=typeof f=="function"?f.call(m,h,x):f,x==null)break e;h=ot({},h,x);break e;case 2:_n=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,x=a.effects,x===null?a.effects=[o]:x.push(o))}else m={eventTime:m,lane:x,tag:o.tag,payload:o.payload,callback:o.callback,next:null},u===null?(d=u=m,c=h):u=u.next=m,l|=x;if(o=o.next,o===null){if(o=a.shared.pending,o===null)break;x=o,o=x.next,x.next=null,a.lastBaseUpdate=x,a.shared.pending=null}}while(!0);if(u===null&&(c=h),a.baseState=c,a.firstBaseUpdate=d,a.lastBaseUpdate=u,t=a.shared.interleaved,t!==null){a=t;do l|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);Hr|=l,e.lanes=l,e.memoizedState=h}}function ap(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=rd.transition;rd.transition={};try{e(!1),t()}finally{Ue=n,rd.transition=r}}function Ry(){return Fs().memoizedState}function qb(e,t,n){var r=dr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ly(e))Oy(t,n);else if(n=gy(e,t,n,r),n!==null){var a=Zt();Us(n,e,r,a),zy(n,t,r)}}function Vb(e,t,n){var r=dr(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ly(e))Oy(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var l=t.lastRenderedState,o=i(l,n);if(a.hasEagerState=!0,a.eagerState=o,qs(o,l)){var c=t.interleaved;c===null?(a.next=a,km(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=gy(e,t,a,r),n!==null&&(a=Zt(),Us(n,e,r,a),zy(n,t,r))}}function Ly(e){var t=e.alternate;return e===it||t!==null&&t===it}function Oy(e,t){Ti=_o=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function zy(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,um(e,n)}}var Ko={readContext:Ts,useCallback:zt,useContext:zt,useEffect:zt,useImperativeHandle:zt,useInsertionEffect:zt,useLayoutEffect:zt,useMemo:zt,useReducer:zt,useRef:zt,useState:zt,useDebugValue:zt,useDeferredValue:zt,useTransition:zt,useMutableSource:zt,useSyncExternalStore:zt,useId:zt,unstable_isNewReconciler:!1},Qb={readContext:Ts,useCallback:function(e,t){return Zs().memoizedState=[e,t===void 0?null:t],e},useContext:Ts,useEffect:lp,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,mo(4194308,4,Py.bind(null,t,e),n)},useLayoutEffect:function(e,t){return mo(4194308,4,e,t)},useInsertionEffect:function(e,t){return mo(4,2,e,t)},useMemo:function(e,t){var n=Zs();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Zs();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=qb.bind(null,it,e),[r.memoizedState,e]},useRef:function(e){var t=Zs();return e={current:e},t.memoizedState=e},useState:ip,useDebugValue:Im,useDeferredValue:function(e){return Zs().memoizedState=e},useTransition:function(){var e=ip(!1),t=e[0];return e=Ub.bind(null,e[1]),Zs().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=it,a=Zs();if(tt){if(n===void 0)throw Error(Y(407));n=n()}else{if(n=t(),Pt===null)throw Error(Y(349));Qr&30||Ny(r,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,lp(Sy.bind(null,r,i,e),[e]),r.flags|=2048,el(9,wy.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Zs(),t=Pt.identifierPrefix;if(tt){var n=Sn,r=wn;n=(r&~(1<<32-Bs(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Xi++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),n==="select"&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[tn]=t,e[Gi]=r,Wy(e,t,!1,!1),t.stateNode=e;e:{switch(l=Id(n,r),n){case"dialog":Ze("cancel",e),Ze("close",e),a=r;break;case"iframe":case"object":case"embed":Ze("load",e),a=r;break;case"video":case"audio":for(a=0;aGa&&(t.flags|=128,r=!0,gi(i,!1),t.lanes=4194304)}else{if(!r)if(e=$o(l),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),gi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!l.alternate&&!tt)return $t(t),null}else 2*ft()-i.renderingStartTime>Ga&&n!==1073741824&&(t.flags|=128,r=!0,gi(i,!1),t.lanes=4194304);i.isBackwards?(l.sibling=t.child,t.child=l):(n=i.last,n!==null?n.sibling=l:t.child=l,i.last=l)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ft(),t.sibling=null,n=at.current,Qe(at,r?n&1|2:n&1),t):($t(t),null);case 22:case 23:return _m(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ps&1073741824&&($t(t),t.subtreeFlags&6&&(t.flags|=8192)):$t(t),null;case 24:return null;case 25:return null}throw Error(Y(156,t.tag))}function eN(e,t){switch(jm(t),t.tag){case 1:return cs(t.type)&&To(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ha(),Je(os),Je(Ut),Am(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Dm(t),null;case 13:if(Je(at),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Y(340));Va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Je(at),null;case 4:return Ha(),null;case 10:return Sm(t.type._context),null;case 22:case 23:return _m(),null;case 24:return null;default:return null}}var Jl=!1,Kt=!1,tN=typeof WeakSet=="function"?WeakSet:Set,he=null;function ga(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){mt(e,t,r)}else n.current=null}function lu(e,t,n){try{n()}catch(r){mt(e,t,r)}}var yp=!1;function sN(e,t){if(qd=Do,e=ty(),ym(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var l=0,o=-1,c=-1,d=0,u=0,h=e,x=null;t:for(;;){for(var m;h!==n||a!==0&&h.nodeType!==3||(o=l+a),h!==i||r!==0&&h.nodeType!==3||(c=l+r),h.nodeType===3&&(l+=h.nodeValue.length),(m=h.firstChild)!==null;)x=h,h=m;for(;;){if(h===e)break t;if(x===n&&++d===a&&(o=l),x===i&&++u===r&&(c=l),(m=h.nextSibling)!==null)break;h=x,x=h.parentNode}h=m}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Vd={focusedElem:e,selectionRange:n},Do=!1,he=t;he!==null;)if(t=he,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,he=e;else for(;he!==null;){t=he;try{var f=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(f!==null){var p=f.memoizedProps,b=f.memoizedState,g=t.stateNode,y=g.getSnapshotBeforeUpdate(t.elementType===t.type?p:Rs(t.type,p),b);g.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Y(163))}}catch(N){mt(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,he=e;break}he=t.return}return f=yp,yp=!1,f}function Fi(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&lu(t,n,i)}a=a.next}while(a!==r)}}function hc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ou(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Jy(e){var t=e.alternate;t!==null&&(e.alternate=null,Jy(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[tn],delete t[Gi],delete t[Wd],delete t[zb],delete t[$b])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Xy(e){return e.tag===5||e.tag===3||e.tag===4}function vp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xy(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function cu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Mo));else if(r!==4&&(e=e.child,e!==null))for(cu(e,t,n),e=e.sibling;e!==null;)cu(e,t,n),e=e.sibling}function du(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(du(e,t,n),e=e.sibling;e!==null;)du(e,t,n),e=e.sibling}var Mt=null,zs=!1;function On(e,t,n){for(n=n.child;n!==null;)Yy(e,t,n),n=n.sibling}function Yy(e,t,n){if(rn&&typeof rn.onCommitFiberUnmount=="function")try{rn.onCommitFiberUnmount(ac,n)}catch{}switch(n.tag){case 5:Kt||ga(n,t);case 6:var r=Mt,a=zs;Mt=null,On(e,t,n),Mt=r,zs=a,Mt!==null&&(zs?(e=Mt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Mt.removeChild(n.stateNode));break;case 18:Mt!==null&&(zs?(e=Mt,n=n.stateNode,e.nodeType===8?td(e.parentNode,n):e.nodeType===1&&td(e,n),qi(e)):td(Mt,n.stateNode));break;case 4:r=Mt,a=zs,Mt=n.stateNode.containerInfo,zs=!0,On(e,t,n),Mt=r,zs=a;break;case 0:case 11:case 14:case 15:if(!Kt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var i=a,l=i.destroy;i=i.tag,l!==void 0&&(i&2||i&4)&&lu(n,t,l),a=a.next}while(a!==r)}On(e,t,n);break;case 1:if(!Kt&&(ga(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){mt(n,t,o)}On(e,t,n);break;case 21:On(e,t,n);break;case 22:n.mode&1?(Kt=(r=Kt)||n.memoizedState!==null,On(e,t,n),Kt=r):On(e,t,n);break;default:On(e,t,n)}}function jp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new tN),t.forEach(function(r){var a=uN.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function Is(e,t){var n=t.deletions;if(n!==null)for(var r=0;ra&&(a=l),r&=~i}if(r=a,r=ft()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*rN(r/1960))-r,10e?16:e,sr===null)var r=!1;else{if(e=sr,sr=null,qo=0,Te&6)throw Error(Y(331));var a=Te;for(Te|=4,he=e.current;he!==null;){var i=he,l=i.child;if(he.flags&16){var o=i.deletions;if(o!==null){for(var c=0;cft()-zm?_r(e,0):Om|=n),ds(e,t)}function l0(e,t){t===0&&(e.mode&1?(t=Bl,Bl<<=1,!(Bl&130023424)&&(Bl=4194304)):t=1);var n=Zt();e=Pn(e,t),e!==null&&(Nl(e,t,n),ds(e,n))}function dN(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),l0(e,n)}function uN(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Y(314))}r!==null&&r.delete(t),l0(e,n)}var o0;o0=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||os.current)ls=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ls=!1,Xb(e,t,n);ls=!!(e.flags&131072)}else ls=!1,tt&&t.flags&1048576&&my(t,Ro,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ho(e,t),e=t.pendingProps;var a=qa(t,Ut.current);Sa(t,n),a=Mm(null,t,r,e,a,n);var i=Tm();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,cs(r)?(i=!0,Fo(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Cm(t),a.updater=mc,t.stateNode=a,a._reactInternals=t,eu(t,r,e,n),t=nu(null,t,r,!0,i,n)):(t.tag=0,tt&&i&&vm(t),Gt(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ho(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=hN(r),e=Rs(r,e),a){case 0:t=su(null,t,r,e,n);break e;case 1:t=pp(null,t,r,e,n);break e;case 11:t=hp(null,t,r,e,n);break e;case 14:t=fp(null,t,r,Rs(r.type,e),n);break e}throw Error(Y(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Rs(r,a),su(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Rs(r,a),pp(e,t,r,a,n);case 3:e:{if(Vy(t),e===null)throw Error(Y(387));r=t.pendingProps,i=t.memoizedState,a=i.element,yy(e,t),zo(t,r,null,n);var l=t.memoizedState;if(r=l.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=Wa(Error(Y(423)),t),t=xp(e,t,r,n,a);break e}else if(r!==a){a=Wa(Error(Y(424)),t),t=xp(e,t,r,n,a);break e}else for(ys=lr(t.stateNode.containerInfo.firstChild),vs=t,tt=!0,$s=null,n=xy(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Va(),r===a){t=Mn(e,t,n);break e}Gt(e,t,r,n)}t=t.child}return t;case 5:return vy(t),e===null&&Jd(t),r=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,l=a.children,Qd(r,a)?l=null:i!==null&&Qd(r,i)&&(t.flags|=32),qy(e,t),Gt(e,t,l,n),t.child;case 6:return e===null&&Jd(t),null;case 13:return Qy(e,t,n);case 4:return Em(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Qa(t,null,r,n):Gt(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Rs(r,a),hp(e,t,r,a,n);case 7:return Gt(e,t,t.pendingProps,n),t.child;case 8:return Gt(e,t,t.pendingProps.children,n),t.child;case 12:return Gt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,i=t.memoizedProps,l=a.value,Qe(Lo,r._currentValue),r._currentValue=l,i!==null)if(qs(i.value,l)){if(i.children===a.children&&!os.current){t=Mn(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){l=i.child;for(var c=o.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=Cn(-1,n&-n),c.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Xd(i.return,n,t),o.lanes|=n;break}c=c.next}}else if(i.tag===10)l=i.type===t.type?null:i.child;else if(i.tag===18){if(l=i.return,l===null)throw Error(Y(341));l.lanes|=n,o=l.alternate,o!==null&&(o.lanes|=n),Xd(l,n,t),l=i.sibling}else l=i.child;if(l!==null)l.return=i;else for(l=i;l!==null;){if(l===t){l=null;break}if(i=l.sibling,i!==null){i.return=l.return,l=i;break}l=l.return}i=l}Gt(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,Sa(t,n),a=Ts(a),r=r(a),t.flags|=1,Gt(e,t,r,n),t.child;case 14:return r=t.type,a=Rs(r,t.pendingProps),a=Rs(r.type,a),fp(e,t,r,a,n);case 15:return By(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Rs(r,a),ho(e,t),t.tag=1,cs(r)?(e=!0,Fo(t)):e=!1,Sa(t,n),$y(t,r,a),eu(t,r,a,n),nu(null,t,r,!0,e,n);case 19:return Hy(e,t,n);case 22:return Uy(e,t,n)}throw Error(Y(156,t.tag))};function c0(e,t){return Lg(e,t)}function mN(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ds(e,t,n,r){return new mN(e,t,n,r)}function Bm(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hN(e){if(typeof e=="function")return Bm(e)?1:0;if(e!=null){if(e=e.$$typeof,e===lm)return 11;if(e===om)return 14}return 2}function ur(e,t){var n=e.alternate;return n===null?(n=Ds(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function xo(e,t,n,r,a,i){var l=2;if(r=e,typeof e=="function")Bm(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case oa:return Kr(n.children,a,i,t);case im:l=8,a|=8;break;case Sd:return e=Ds(12,n,t,a|2),e.elementType=Sd,e.lanes=i,e;case kd:return e=Ds(13,n,t,a),e.elementType=kd,e.lanes=i,e;case Cd:return e=Ds(19,n,t,a),e.elementType=Cd,e.lanes=i,e;case vg:return pc(n,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case gg:l=10;break e;case yg:l=9;break e;case lm:l=11;break e;case om:l=14;break e;case $n:l=16,r=null;break e}throw Error(Y(130,e==null?e:typeof e,""))}return t=Ds(l,n,t,a),t.elementType=e,t.type=r,t.lanes=i,t}function Kr(e,t,n,r){return e=Ds(7,e,r,t),e.lanes=n,e}function pc(e,t,n,r){return e=Ds(22,e,r,t),e.elementType=vg,e.lanes=n,e.stateNode={isHidden:!1},e}function cd(e,t,n){return e=Ds(6,e,null,t),e.lanes=n,e}function dd(e,t,n){return t=Ds(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function fN(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qc(0),this.expirationTimes=qc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qc(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Um(e,t,n,r,a,i,l,o,c){return e=new fN(e,t,n,o,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ds(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Cm(i),e}function pN(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h0)}catch(e){console.error(e)}}h0(),hg.exports=bs;var jN=hg.exports,Dp=jN;Nd.createRoot=Dp.createRoot,Nd.hydrateRoot=Dp.hydrateRoot;/** + * @remix-run/router v1.23.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function sl(){return sl=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Hm(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function NN(){return Math.random().toString(36).substr(2,8)}function Pp(e,t){return{usr:e.state,key:e.key,idx:t}}function pu(e,t,n,r){return n===void 0&&(n=null),sl({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?si(t):t,{state:n,key:t&&t.key||r||NN()})}function Ho(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function si(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function wN(e,t,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,l=a.history,o=nr.Pop,c=null,d=u();d==null&&(d=0,l.replaceState(sl({},l.state,{idx:d}),""));function u(){return(l.state||{idx:null}).idx}function h(){o=nr.Pop;let b=u(),g=b==null?null:b-d;d=b,c&&c({action:o,location:p.location,delta:g})}function x(b,g){o=nr.Push;let y=pu(p.location,b,g);d=u()+1;let v=Pp(y,d),N=p.createHref(y);try{l.pushState(v,"",N)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;a.location.assign(N)}i&&c&&c({action:o,location:p.location,delta:1})}function m(b,g){o=nr.Replace;let y=pu(p.location,b,g);d=u();let v=Pp(y,d),N=p.createHref(y);l.replaceState(v,"",N),i&&c&&c({action:o,location:p.location,delta:0})}function f(b){let g=a.location.origin!=="null"?a.location.origin:a.location.href,y=typeof b=="string"?b:Ho(b);return y=y.replace(/ $/,"%20"),lt(g,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,g)}let p={get action(){return o},get location(){return e(a,l)},listen(b){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(Ap,h),c=b,()=>{a.removeEventListener(Ap,h),c=null}},createHref(b){return t(a,b)},createURL:f,encodeLocation(b){let g=f(b);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:x,replace:m,go(b){return l.go(b)}};return p}var Mp;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Mp||(Mp={}));function SN(e,t,n){return n===void 0&&(n="/"),kN(e,t,n)}function kN(e,t,n,r){let a=typeof t=="string"?si(t):t,i=Za(a.pathname||"/",n);if(i==null)return null;let l=f0(e);CN(l);let o=null;for(let c=0;o==null&&c{let c={relativePath:o===void 0?i.path||"":o,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};c.relativePath.startsWith("/")&&(lt(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let d=mr([r,c.relativePath]),u=n.concat(c);i.children&&i.children.length>0&&(lt(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),f0(i.children,t,u,d)),!(i.path==null&&!i.index)&&t.push({path:d,score:FN(d,i.index),routesMeta:u})};return e.forEach((i,l)=>{var o;if(i.path===""||!((o=i.path)!=null&&o.includes("?")))a(i,l);else for(let c of p0(i.path))a(i,l,c)}),t}function p0(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let l=p0(r.join("/")),o=[];return o.push(...l.map(c=>c===""?i:[i,c].join("/"))),a&&o.push(...l),o.map(c=>e.startsWith("/")&&c===""?"/":c)}function CN(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:IN(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const EN=/^:[\w-]+$/,DN=3,AN=2,PN=1,MN=10,TN=-2,Tp=e=>e==="*";function FN(e,t){let n=e.split("/"),r=n.length;return n.some(Tp)&&(r+=TN),t&&(r+=AN),n.filter(a=>!Tp(a)).reduce((a,i)=>a+(EN.test(i)?DN:i===""?PN:MN),r)}function IN(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function RN(e,t,n){let{routesMeta:r}=e,a={},i="/",l=[];for(let o=0;o{let{paramName:x,isOptional:m}=u;if(x==="*"){let p=o[h]||"";l=i.slice(0,i.length-p.length).replace(/(.)\/+$/,"$1")}const f=o[h];return m&&!f?d[x]=void 0:d[x]=(f||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:l,pattern:e}}function LN(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Hm(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,o,c)=>(r.push({paramName:o,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function ON(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Hm(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Za(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const zN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$N=e=>zN.test(e);function _N(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?si(e):e,i;if(n)if($N(n))i=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),Hm(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?i=Fp(n.substring(1),"/"):i=Fp(n,t)}else i=t;return{pathname:i,search:UN(r),hash:qN(a)}}function Fp(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function ud(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function KN(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Wm(e,t){let n=KN(e);return t?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Gm(e,t,n,r){r===void 0&&(r=!1);let a;typeof e=="string"?a=si(e):(a=sl({},e),lt(!a.pathname||!a.pathname.includes("?"),ud("?","pathname","search",a)),lt(!a.pathname||!a.pathname.includes("#"),ud("#","pathname","hash",a)),lt(!a.search||!a.search.includes("#"),ud("#","search","hash",a)));let i=e===""||a.pathname==="",l=i?"/":a.pathname,o;if(l==null)o=n;else{let h=t.length-1;if(!r&&l.startsWith("..")){let x=l.split("/");for(;x[0]==="..";)x.shift(),h-=1;a.pathname=x.join("/")}o=h>=0?t[h]:"/"}let c=_N(a,o),d=l&&l!=="/"&&l.endsWith("/"),u=(i||l===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}const mr=e=>e.join("/").replace(/\/\/+/g,"/"),BN=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),UN=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,qN=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function VN(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const x0=["post","put","patch","delete"];new Set(x0);const QN=["get",...x0];new Set(QN);/** + * React Router v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function nl(){return nl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{o.current=!0}),j.useCallback(function(d,u){if(u===void 0&&(u={}),!o.current)return;if(typeof d=="number"){r.go(d);return}let h=Gm(d,JSON.parse(l),i,u.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:mr([t,h.pathname])),(u.replace?r.replace:r.push)(h,u.state,u)},[t,r,l,i,e])}const GN=j.createContext(null);function ZN(e){let t=j.useContext(cn).outlet;return t&&j.createElement(GN.Provider,{value:e},t)}function Nc(){let{matches:e}=j.useContext(cn),t=e[e.length-1];return t?t.params:{}}function wc(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=j.useContext(In),{matches:a}=j.useContext(cn),{pathname:i}=Rn(),l=JSON.stringify(Wm(a,r.v7_relativeSplatPath));return j.useMemo(()=>Gm(e,JSON.parse(l),i,n==="path"),[e,l,i,n])}function JN(e,t){return XN(e,t)}function XN(e,t,n,r){ni()||lt(!1);let{navigator:a}=j.useContext(In),{matches:i}=j.useContext(cn),l=i[i.length-1],o=l?l.params:{};l&&l.pathname;let c=l?l.pathnameBase:"/";l&&l.route;let d=Rn(),u;if(t){var h;let b=typeof t=="string"?si(t):t;c==="/"||(h=b.pathname)!=null&&h.startsWith(c)||lt(!1),u=b}else u=d;let x=u.pathname||"/",m=x;if(c!=="/"){let b=c.replace(/^\//,"").split("/");m="/"+x.replace(/^\//,"").split("/").slice(b.length).join("/")}let f=SN(e,{pathname:m}),p=nw(f&&f.map(b=>Object.assign({},b,{params:Object.assign({},o,b.params),pathname:mr([c,a.encodeLocation?a.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?c:mr([c,a.encodeLocation?a.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),i,n,r);return t&&p?j.createElement(bc.Provider,{value:{location:nl({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:nr.Pop}},p):p}function YN(){let e=lw(),t=VN(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return j.createElement(j.Fragment,null,j.createElement("h2",null,"Unexpected Application Error!"),j.createElement("h3",{style:{fontStyle:"italic"}},t),n?j.createElement("pre",{style:a},n):null,null)}const ew=j.createElement(YN,null);class tw extends j.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?j.createElement(cn.Provider,{value:this.props.routeContext},j.createElement(y0.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function sw(e){let{routeContext:t,match:n,children:r}=e,a=j.useContext(jc);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),j.createElement(cn.Provider,{value:t},r)}function nw(e,t,n,r){var a;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,o=(a=n)==null?void 0:a.errors;if(o!=null){let u=l.findIndex(h=>h.route.id&&(o==null?void 0:o[h.route.id])!==void 0);u>=0||lt(!1),l=l.slice(0,Math.min(l.length,u+1))}let c=!1,d=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u=0?l=l.slice(0,d+1):l=[l[0]];break}}}return l.reduceRight((u,h,x)=>{let m,f=!1,p=null,b=null;n&&(m=o&&h.route.id?o[h.route.id]:void 0,p=h.route.errorElement||ew,c&&(d<0&&x===0?(cw("route-fallback"),f=!0,b=null):d===x&&(f=!0,b=h.route.hydrateFallbackElement||null)));let g=t.concat(l.slice(0,x+1)),y=()=>{let v;return m?v=p:f?v=b:h.route.Component?v=j.createElement(h.route.Component,null):h.route.element?v=h.route.element:v=u,j.createElement(sw,{match:h,routeContext:{outlet:u,matches:g,isDataRoute:n!=null},children:v})};return n&&(h.route.ErrorBoundary||h.route.errorElement||x===0)?j.createElement(tw,{location:n.location,revalidation:n.revalidation,component:p,error:m,children:y(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):y()},null)}var j0=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(j0||{}),b0=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(b0||{});function rw(e){let t=j.useContext(jc);return t||lt(!1),t}function aw(e){let t=j.useContext(g0);return t||lt(!1),t}function iw(e){let t=j.useContext(cn);return t||lt(!1),t}function N0(e){let t=iw(),n=t.matches[t.matches.length-1];return n.route.id||lt(!1),n.route.id}function lw(){var e;let t=j.useContext(y0),n=aw(),r=N0();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function ow(){let{router:e}=rw(j0.UseNavigateStable),t=N0(b0.UseNavigateStable),n=j.useRef(!1);return v0(()=>{n.current=!0}),j.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,nl({fromRouteId:t},i)))},[e,t])}const Ip={};function cw(e,t,n){Ip[e]||(Ip[e]=!0)}function dw(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function va(e){let{to:t,replace:n,state:r,relative:a}=e;ni()||lt(!1);let{future:i,static:l}=j.useContext(In),{matches:o}=j.useContext(cn),{pathname:c}=Rn(),d=Yt(),u=Gm(t,Wm(o,i.v7_relativeSplatPath),c,a==="path"),h=JSON.stringify(u);return j.useEffect(()=>d(JSON.parse(h),{replace:n,state:r,relative:a}),[d,h,a,n,r]),null}function uw(e){return ZN(e.context)}function ze(e){lt(!1)}function mw(e){let{basename:t="/",children:n=null,location:r,navigationType:a=nr.Pop,navigator:i,static:l=!1,future:o}=e;ni()&<(!1);let c=t.replace(/^\/*/,"/"),d=j.useMemo(()=>({basename:c,navigator:i,static:l,future:nl({v7_relativeSplatPath:!1},o)}),[c,o,i,l]);typeof r=="string"&&(r=si(r));let{pathname:u="/",search:h="",hash:x="",state:m=null,key:f="default"}=r,p=j.useMemo(()=>{let b=Za(u,c);return b==null?null:{location:{pathname:b,search:h,hash:x,state:m,key:f},navigationType:a}},[c,u,h,x,m,f,a]);return p==null?null:j.createElement(In.Provider,{value:d},j.createElement(bc.Provider,{children:n,value:p}))}function hw(e){let{children:t,location:n}=e;return JN(gu(t),n)}new Promise(()=>{});function gu(e,t){t===void 0&&(t=[]);let n=[];return j.Children.forEach(e,(r,a)=>{if(!j.isValidElement(r))return;let i=[...t,a];if(r.type===j.Fragment){n.push.apply(n,gu(r.props.children,i));return}r.type!==ze&<(!1),!r.props.index||!r.props.children||lt(!1);let l={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=gu(r.props.children,i)),n.push(l)}),n}/** + * React Router DOM v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Wo(){return Wo=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[a]=e[a]);return n}function fw(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function pw(e,t){return e.button===0&&(!t||t==="_self")&&!fw(e)}function yu(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function xw(e,t){let n=yu(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(i=>{n.append(a,i)})}),n}const gw=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],yw=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],vw="6";try{window.__reactRouterVersion=vw}catch{}const jw=j.createContext({isTransitioning:!1}),bw="startTransition",Rp=cj[bw];function Nw(e){let{basename:t,children:n,future:r,window:a}=e,i=j.useRef();i.current==null&&(i.current=bN({window:a,v5Compat:!0}));let l=i.current,[o,c]=j.useState({action:l.action,location:l.location}),{v7_startTransition:d}=r||{},u=j.useCallback(h=>{d&&Rp?Rp(()=>c(h)):c(h)},[c,d]);return j.useLayoutEffect(()=>l.listen(u),[l,u]),j.useEffect(()=>dw(r),[r]),j.createElement(mw,{basename:t,children:n,location:o.location,navigationType:o.action,navigator:l,future:r})}const ww=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Sw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ke=j.forwardRef(function(t,n){let{onClick:r,relative:a,reloadDocument:i,replace:l,state:o,target:c,to:d,preventScrollReset:u,viewTransition:h}=t,x=w0(t,gw),{basename:m}=j.useContext(In),f,p=!1;if(typeof d=="string"&&Sw.test(d)&&(f=d,ww))try{let v=new URL(window.location.href),N=d.startsWith("//")?new URL(v.protocol+d):new URL(d),E=Za(N.pathname,m);N.origin===v.origin&&E!=null?d=E+N.search+N.hash:p=!0}catch{}let b=HN(d,{relative:a}),g=Cw(d,{replace:l,state:o,target:c,preventScrollReset:u,relative:a,viewTransition:h});function y(v){r&&r(v),v.defaultPrevented||g(v)}return j.createElement("a",Wo({},x,{href:f||b,onClick:p||i?r:y,ref:n,target:c}))}),md=j.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:a=!1,className:i="",end:l=!1,style:o,to:c,viewTransition:d,children:u}=t,h=w0(t,yw),x=wc(c,{relative:h.relative}),m=Rn(),f=j.useContext(g0),{navigator:p,basename:b}=j.useContext(In),g=f!=null&&Ew(x)&&d===!0,y=p.encodeLocation?p.encodeLocation(x).pathname:x.pathname,v=m.pathname,N=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;a||(v=v.toLowerCase(),N=N?N.toLowerCase():null,y=y.toLowerCase()),N&&b&&(N=Za(N,b)||N);const E=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let P=v===y||!l&&v.startsWith(y)&&v.charAt(E)==="/",I=N!=null&&(N===y||!l&&N.startsWith(y)&&N.charAt(y.length)==="/"),w={isActive:P,isPending:I,isTransitioning:g},S=P?r:void 0,A;typeof i=="function"?A=i(w):A=[i,P?"active":null,I?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let O=typeof o=="function"?o(w):o;return j.createElement(ke,Wo({},h,{"aria-current":S,className:A,ref:n,style:O,to:c,viewTransition:d}),typeof u=="function"?u(w):u)});var vu;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(vu||(vu={}));var Lp;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Lp||(Lp={}));function kw(e){let t=j.useContext(jc);return t||lt(!1),t}function Cw(e,t){let{target:n,replace:r,state:a,preventScrollReset:i,relative:l,viewTransition:o}=t===void 0?{}:t,c=Yt(),d=Rn(),u=wc(e,{relative:l});return j.useCallback(h=>{if(pw(h,n)){h.preventDefault();let x=r!==void 0?r:Ho(d)===Ho(u);c(e,{replace:x,state:a,preventScrollReset:i,relative:l,viewTransition:o})}},[d,c,u,r,a,n,e,i,l,o])}function Sc(e){let t=j.useRef(yu(e)),n=j.useRef(!1),r=Rn(),a=j.useMemo(()=>xw(r.search,n.current?null:t.current),[r.search]),i=Yt(),l=j.useCallback((o,c)=>{const d=yu(typeof o=="function"?o(a):o);n.current=!0,i("?"+d,c)},[i,a]);return[a,l]}function Ew(e,t){t===void 0&&(t={});let n=j.useContext(jw);n==null&<(!1);let{basename:r}=kw(vu.useViewTransitionState),a=wc(e,{relative:t.relative});if(!n.isTransitioning)return!1;let i=Za(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=Za(n.nextLocation.pathname,r)||n.nextLocation.pathname;return xu(a.pathname,l)!=null||xu(a.pathname,i)!=null}var ta=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Dw={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Vn,Xu,qx,Aw=(qx=class{constructor(){me(this,Vn,Dw);me(this,Xu,!1)}setTimeoutProvider(e){te(this,Vn,e)}setTimeout(e,t){return M(this,Vn).setTimeout(e,t)}clearTimeout(e){M(this,Vn).clearTimeout(e)}setInterval(e,t){return M(this,Vn).setInterval(e,t)}clearInterval(e){M(this,Vn).clearInterval(e)}},Vn=new WeakMap,Xu=new WeakMap,qx),Dr=new Aw;function Pw(e){setTimeout(e,0)}var Gr=typeof window>"u"||"Deno"in globalThis;function _t(){}function Mw(e,t){return typeof e=="function"?e(t):e}function ju(e){return typeof e=="number"&&e>=0&&e!==1/0}function S0(e,t){return Math.max(e+(t||0)-Date.now(),0)}function hr(e,t){return typeof e=="function"?e(t):e}function ks(e,t){return typeof e=="function"?e(t):e}function Op(e,t){const{type:n="all",exact:r,fetchStatus:a,predicate:i,queryKey:l,stale:o}=e;if(l){if(r){if(t.queryHash!==Zm(l,t.options))return!1}else if(!rl(t.queryKey,l))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||a&&a!==t.state.fetchStatus||i&&!i(t))}function zp(e,t){const{exact:n,status:r,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Zr(t.options.mutationKey)!==Zr(i))return!1}else if(!rl(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function Zm(e,t){return((t==null?void 0:t.queryKeyHashFn)||Zr)(e)}function Zr(e){return JSON.stringify(e,(t,n)=>bu(n)?Object.keys(n).sort().reduce((r,a)=>(r[a]=n[a],r),{}):n)}function rl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>rl(e[n],t[n])):!1}var Tw=Object.prototype.hasOwnProperty;function Jm(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=$p(e)&&$p(t);if(!r&&!(bu(e)&&bu(t)))return t;const i=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),o=l.length,c=r?new Array(o):{};let d=0;for(let u=0;u{Dr.setTimeout(t,e)})}function Nu(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Jm(e,t):t}function Iw(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Rw(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Xm=Symbol();function k0(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Xm?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ym(e,t){return typeof e=="function"?e(...t):!!e}function Lw(e,t,n){let r=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),r||(r=!0,a.aborted?n():a.addEventListener("abort",n,{once:!0})),a)}),e}var Mr,Qn,Da,Vx,Ow=(Vx=class extends ta{constructor(){super();me(this,Mr);me(this,Qn);me(this,Da);te(this,Da,t=>{if(!Gr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){M(this,Qn)||this.setEventListener(M(this,Da))}onUnsubscribe(){var t;this.hasListeners()||((t=M(this,Qn))==null||t.call(this),te(this,Qn,void 0))}setEventListener(t){var n;te(this,Da,t),(n=M(this,Qn))==null||n.call(this),te(this,Qn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){M(this,Mr)!==t&&(te(this,Mr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof M(this,Mr)=="boolean"?M(this,Mr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Mr=new WeakMap,Qn=new WeakMap,Da=new WeakMap,Vx),eh=new Ow;function wu(){let e,t;const n=new Promise((a,i)=>{e=a,t=i});n.status="pending",n.catch(()=>{});function r(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{r({status:"fulfilled",value:a}),e(a)},n.reject=a=>{r({status:"rejected",reason:a}),t(a)},n}var zw=Pw;function $w(){let e=[],t=0,n=o=>{o()},r=o=>{o()},a=zw;const i=o=>{t?e.push(o):a(()=>{n(o)})},l=()=>{const o=e;e=[],o.length&&a(()=>{r(()=>{o.forEach(c=>{n(c)})})})};return{batch:o=>{let c;t++;try{c=o()}finally{t--,t||l()}return c},batchCalls:o=>(...c)=>{i(()=>{o(...c)})},schedule:i,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{a=o}}}var ht=$w(),Aa,Hn,Pa,Qx,_w=(Qx=class extends ta{constructor(){super();me(this,Aa,!0);me(this,Hn);me(this,Pa);te(this,Pa,t=>{if(!Gr&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){M(this,Hn)||this.setEventListener(M(this,Pa))}onUnsubscribe(){var t;this.hasListeners()||((t=M(this,Hn))==null||t.call(this),te(this,Hn,void 0))}setEventListener(t){var n;te(this,Pa,t),(n=M(this,Hn))==null||n.call(this),te(this,Hn,t(this.setOnline.bind(this)))}setOnline(t){M(this,Aa)!==t&&(te(this,Aa,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return M(this,Aa)}},Aa=new WeakMap,Hn=new WeakMap,Pa=new WeakMap,Qx),Go=new _w;function Kw(e){return Math.min(1e3*2**e,3e4)}function C0(e){return(e??"online")==="online"?Go.isOnline():!0}var Su=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function E0(e){let t=!1,n=0,r;const a=wu(),i=()=>a.status!=="pending",l=p=>{var b;if(!i()){const g=new Su(p);x(g),(b=e.onCancel)==null||b.call(e,g)}},o=()=>{t=!0},c=()=>{t=!1},d=()=>eh.isFocused()&&(e.networkMode==="always"||Go.isOnline())&&e.canRun(),u=()=>C0(e.networkMode)&&e.canRun(),h=p=>{i()||(r==null||r(),a.resolve(p))},x=p=>{i()||(r==null||r(),a.reject(p))},m=()=>new Promise(p=>{var b;r=g=>{(i()||d())&&p(g)},(b=e.onPause)==null||b.call(e)}).then(()=>{var p;r=void 0,i()||(p=e.onContinue)==null||p.call(e)}),f=()=>{if(i())return;let p;const b=n===0?e.initialPromise:void 0;try{p=b??e.fn()}catch(g){p=Promise.reject(g)}Promise.resolve(p).then(h).catch(g=>{var P;if(i())return;const y=e.retry??(Gr?0:3),v=e.retryDelay??Kw,N=typeof v=="function"?v(n,g):v,E=y===!0||typeof y=="number"&&nd()?void 0:m()).then(()=>{t?x(g):f()})})};return{promise:a,status:()=>a.status,cancel:l,continue:()=>(r==null||r(),a),cancelRetry:o,continueRetry:c,canStart:u,start:()=>(u()?f():m().then(f),a)}}var Tr,Hx,D0=(Hx=class{constructor(){me(this,Tr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ju(this.gcTime)&&te(this,Tr,Dr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Gr?1/0:5*60*1e3))}clearGcTimeout(){M(this,Tr)&&(Dr.clearTimeout(M(this,Tr)),te(this,Tr,void 0))}},Tr=new WeakMap,Hx),Fr,Ma,ws,Ir,Ct,ml,Rr,Ls,pn,Wx,Bw=(Wx=class extends D0{constructor(t){super();me(this,Ls);me(this,Fr);me(this,Ma);me(this,ws);me(this,Ir);me(this,Ct);me(this,ml);me(this,Rr);te(this,Rr,!1),te(this,ml,t.defaultOptions),this.setOptions(t.options),this.observers=[],te(this,Ir,t.client),te(this,ws,M(this,Ir).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,te(this,Fr,Bp(this.options)),this.state=t.state??M(this,Fr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=M(this,Ct))==null?void 0:t.promise}setOptions(t){if(this.options={...M(this,ml),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Bp(this.options);n.data!==void 0&&(this.setState(Kp(n.data,n.dataUpdatedAt)),te(this,Fr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&M(this,ws).remove(this)}setData(t,n){const r=Nu(this.state.data,t,this.options);return be(this,Ls,pn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){be(this,Ls,pn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,a;const n=(r=M(this,Ct))==null?void 0:r.promise;return(a=M(this,Ct))==null||a.cancel(t),n?n.then(_t).catch(_t):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(M(this,Fr))}isActive(){return this.observers.some(t=>ks(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Xm||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>hr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!S0(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=M(this,Ct))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=M(this,Ct))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),M(this,ws).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(M(this,Ct)&&(M(this,Rr)?M(this,Ct).cancel({revert:!0}):M(this,Ct).cancelRetry()),this.scheduleGc()),M(this,ws).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||be(this,Ls,pn).call(this,{type:"invalidate"})}async fetch(t,n){var c,d,u,h,x,m,f,p,b,g,y,v;if(this.state.fetchStatus!=="idle"&&((c=M(this,Ct))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(M(this,Ct))return M(this,Ct).continueRetry(),M(this,Ct).promise}if(t&&this.setOptions(t),!this.options.queryFn){const N=this.observers.find(E=>E.options.queryFn);N&&this.setOptions(N.options)}const r=new AbortController,a=N=>{Object.defineProperty(N,"signal",{enumerable:!0,get:()=>(te(this,Rr,!0),r.signal)})},i=()=>{const N=k0(this.options,n),P=(()=>{const I={client:M(this,Ir),queryKey:this.queryKey,meta:this.meta};return a(I),I})();return te(this,Rr,!1),this.options.persister?this.options.persister(N,P,this):N(P)},o=(()=>{const N={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:M(this,Ir),state:this.state,fetchFn:i};return a(N),N})();(d=this.options.behavior)==null||d.onFetch(o,this),te(this,Ma,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&be(this,Ls,pn).call(this,{type:"fetch",meta:(h=o.fetchOptions)==null?void 0:h.meta}),te(this,Ct,E0({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:N=>{N instanceof Su&&N.revert&&this.setState({...M(this,Ma),fetchStatus:"idle"}),r.abort()},onFail:(N,E)=>{be(this,Ls,pn).call(this,{type:"failed",failureCount:N,error:E})},onPause:()=>{be(this,Ls,pn).call(this,{type:"pause"})},onContinue:()=>{be(this,Ls,pn).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const N=await M(this,Ct).start();if(N===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(N),(m=(x=M(this,ws).config).onSuccess)==null||m.call(x,N,this),(p=(f=M(this,ws).config).onSettled)==null||p.call(f,N,this.state.error,this),N}catch(N){if(N instanceof Su){if(N.silent)return M(this,Ct).promise;if(N.revert){if(this.state.data===void 0)throw N;return this.state.data}}throw be(this,Ls,pn).call(this,{type:"error",error:N}),(g=(b=M(this,ws).config).onError)==null||g.call(b,N,this),(v=(y=M(this,ws).config).onSettled)==null||v.call(y,this.state.data,N,this),N}finally{this.scheduleGc()}}},Fr=new WeakMap,Ma=new WeakMap,ws=new WeakMap,Ir=new WeakMap,Ct=new WeakMap,ml=new WeakMap,Rr=new WeakMap,Ls=new WeakSet,pn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...A0(r.data,this.options),fetchMeta:t.meta??null};case"success":const a={...r,...Kp(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return te(this,Ma,t.manual?a:void 0),a;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ht.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),M(this,ws).notify({query:this,type:"updated",action:t})})},Wx);function A0(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:C0(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Kp(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Bp(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var ns,De,hl,Qt,Lr,Ta,vn,Wn,fl,Fa,Ia,Or,zr,Gn,Ra,$e,ki,ku,Cu,Eu,Du,Au,Pu,Mu,P0,Gx,th=(Gx=class extends ta{constructor(t,n){super();me(this,$e);me(this,ns);me(this,De);me(this,hl);me(this,Qt);me(this,Lr);me(this,Ta);me(this,vn);me(this,Wn);me(this,fl);me(this,Fa);me(this,Ia);me(this,Or);me(this,zr);me(this,Gn);me(this,Ra,new Set);this.options=n,te(this,ns,t),te(this,Wn,null),te(this,vn,wu()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(M(this,De).addObserver(this),Up(M(this,De),this.options)?be(this,$e,ki).call(this):this.updateResult(),be(this,$e,Du).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Tu(M(this,De),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Tu(M(this,De),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,be(this,$e,Au).call(this),be(this,$e,Pu).call(this),M(this,De).removeObserver(this)}setOptions(t){const n=this.options,r=M(this,De);if(this.options=M(this,ns).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ks(this.options.enabled,M(this,De))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");be(this,$e,Mu).call(this),M(this,De).setOptions(this.options),n._defaulted&&!al(this.options,n)&&M(this,ns).getQueryCache().notify({type:"observerOptionsUpdated",query:M(this,De),observer:this});const a=this.hasListeners();a&&qp(M(this,De),r,this.options,n)&&be(this,$e,ki).call(this),this.updateResult(),a&&(M(this,De)!==r||ks(this.options.enabled,M(this,De))!==ks(n.enabled,M(this,De))||hr(this.options.staleTime,M(this,De))!==hr(n.staleTime,M(this,De)))&&be(this,$e,ku).call(this);const i=be(this,$e,Cu).call(this);a&&(M(this,De)!==r||ks(this.options.enabled,M(this,De))!==ks(n.enabled,M(this,De))||i!==M(this,Gn))&&be(this,$e,Eu).call(this,i)}getOptimisticResult(t){const n=M(this,ns).getQueryCache().build(M(this,ns),t),r=this.createResult(n,t);return qw(this,r)&&(te(this,Qt,r),te(this,Ta,this.options),te(this,Lr,M(this,De).state)),r}getCurrentResult(){return M(this,Qt)}trackResult(t,n){return new Proxy(t,{get:(r,a)=>(this.trackProp(a),n==null||n(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&M(this,vn).status==="pending"&&M(this,vn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,a))})}trackProp(t){M(this,Ra).add(t)}getCurrentQuery(){return M(this,De)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=M(this,ns).defaultQueryOptions(t),r=M(this,ns).getQueryCache().build(M(this,ns),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return be(this,$e,ki).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),M(this,Qt)))}createResult(t,n){var S;const r=M(this,De),a=this.options,i=M(this,Qt),l=M(this,Lr),o=M(this,Ta),d=t!==r?t.state:M(this,hl),{state:u}=t;let h={...u},x=!1,m;if(n._optimisticResults){const A=this.hasListeners(),O=!A&&Up(t,n),R=A&&qp(t,r,n,a);(O||R)&&(h={...h,...A0(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:f,errorUpdatedAt:p,status:b}=h;m=h.data;let g=!1;if(n.placeholderData!==void 0&&m===void 0&&b==="pending"){let A;i!=null&&i.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(A=i.data,g=!0):A=typeof n.placeholderData=="function"?n.placeholderData((S=M(this,Ia))==null?void 0:S.state.data,M(this,Ia)):n.placeholderData,A!==void 0&&(b="success",m=Nu(i==null?void 0:i.data,A,n),x=!0)}if(n.select&&m!==void 0&&!g)if(i&&m===(l==null?void 0:l.data)&&n.select===M(this,fl))m=M(this,Fa);else try{te(this,fl,n.select),m=n.select(m),m=Nu(i==null?void 0:i.data,m,n),te(this,Fa,m),te(this,Wn,null)}catch(A){te(this,Wn,A)}M(this,Wn)&&(f=M(this,Wn),m=M(this,Fa),p=Date.now(),b="error");const y=h.fetchStatus==="fetching",v=b==="pending",N=b==="error",E=v&&y,P=m!==void 0,w={status:b,fetchStatus:h.fetchStatus,isPending:v,isSuccess:b==="success",isError:N,isInitialLoading:E,isLoading:E,data:m,dataUpdatedAt:h.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>d.dataUpdateCount||h.errorUpdateCount>d.errorUpdateCount,isFetching:y,isRefetching:y&&!v,isLoadingError:N&&!P,isPaused:h.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:N&&P,isStale:sh(t,n),refetch:this.refetch,promise:M(this,vn),isEnabled:ks(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const A=w.data!==void 0,O=w.status==="error"&&!A,R=z=>{O?z.reject(w.error):A&&z.resolve(w.data)},q=()=>{const z=te(this,vn,w.promise=wu());R(z)},D=M(this,vn);switch(D.status){case"pending":t.queryHash===r.queryHash&&R(D);break;case"fulfilled":(O||w.data!==D.value)&&q();break;case"rejected":(!O||w.error!==D.reason)&&q();break}}return w}updateResult(){const t=M(this,Qt),n=this.createResult(M(this,De),this.options);if(te(this,Lr,M(this,De).state),te(this,Ta,this.options),M(this,Lr).data!==void 0&&te(this,Ia,M(this,De)),al(n,t))return;te(this,Qt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!M(this,Ra).size)return!0;const l=new Set(i??M(this,Ra));return this.options.throwOnError&&l.add("error"),Object.keys(M(this,Qt)).some(o=>{const c=o;return M(this,Qt)[c]!==t[c]&&l.has(c)})};be(this,$e,P0).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&be(this,$e,Du).call(this)}},ns=new WeakMap,De=new WeakMap,hl=new WeakMap,Qt=new WeakMap,Lr=new WeakMap,Ta=new WeakMap,vn=new WeakMap,Wn=new WeakMap,fl=new WeakMap,Fa=new WeakMap,Ia=new WeakMap,Or=new WeakMap,zr=new WeakMap,Gn=new WeakMap,Ra=new WeakMap,$e=new WeakSet,ki=function(t){be(this,$e,Mu).call(this);let n=M(this,De).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(_t)),n},ku=function(){be(this,$e,Au).call(this);const t=hr(this.options.staleTime,M(this,De));if(Gr||M(this,Qt).isStale||!ju(t))return;const r=S0(M(this,Qt).dataUpdatedAt,t)+1;te(this,Or,Dr.setTimeout(()=>{M(this,Qt).isStale||this.updateResult()},r))},Cu=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(M(this,De)):this.options.refetchInterval)??!1},Eu=function(t){be(this,$e,Pu).call(this),te(this,Gn,t),!(Gr||ks(this.options.enabled,M(this,De))===!1||!ju(M(this,Gn))||M(this,Gn)===0)&&te(this,zr,Dr.setInterval(()=>{(this.options.refetchIntervalInBackground||eh.isFocused())&&be(this,$e,ki).call(this)},M(this,Gn)))},Du=function(){be(this,$e,ku).call(this),be(this,$e,Eu).call(this,be(this,$e,Cu).call(this))},Au=function(){M(this,Or)&&(Dr.clearTimeout(M(this,Or)),te(this,Or,void 0))},Pu=function(){M(this,zr)&&(Dr.clearInterval(M(this,zr)),te(this,zr,void 0))},Mu=function(){const t=M(this,ns).getQueryCache().build(M(this,ns),this.options);if(t===M(this,De))return;const n=M(this,De);te(this,De,t),te(this,hl,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},P0=function(t){ht.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(M(this,Qt))}),M(this,ns).getQueryCache().notify({query:M(this,De),type:"observerResultsUpdated"})})},Gx);function Uw(e,t){return ks(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Up(e,t){return Uw(e,t)||e.state.data!==void 0&&Tu(e,t,t.refetchOnMount)}function Tu(e,t,n){if(ks(t.enabled,e)!==!1&&hr(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&sh(e,t)}return!1}function qp(e,t,n,r){return(e!==t||ks(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&sh(e,n)}function sh(e,t){return ks(t.enabled,e)!==!1&&e.isStaleByTime(hr(t.staleTime,e))}function qw(e,t){return!al(e.getCurrentResult(),t)}function Vp(e){return{onFetch:(t,n)=>{var u,h,x,m,f;const r=t.options,a=(x=(h=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:h.fetchMore)==null?void 0:x.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],l=((f=t.state.data)==null?void 0:f.pageParams)||[];let o={pages:[],pageParams:[]},c=0;const d=async()=>{let p=!1;const b=v=>{Lw(v,()=>t.signal,()=>p=!0)},g=k0(t.options,t.fetchOptions),y=async(v,N,E)=>{if(p)return Promise.reject();if(N==null&&v.pages.length)return Promise.resolve(v);const I=(()=>{const O={client:t.client,queryKey:t.queryKey,pageParam:N,direction:E?"backward":"forward",meta:t.options.meta};return b(O),O})(),w=await g(I),{maxPages:S}=t.options,A=E?Rw:Iw;return{pages:A(v.pages,w,S),pageParams:A(v.pageParams,N,S)}};if(a&&i.length){const v=a==="backward",N=v?Vw:Qp,E={pages:i,pageParams:l},P=N(r,E);o=await y(E,P,v)}else{const v=e??i.length;do{const N=c===0?l[0]??r.initialPageParam:Qp(r,o);if(c>0&&N==null)break;o=await y(o,N),c++}while(c{var p,b;return(b=(p=t.options).persister)==null?void 0:b.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function Qp(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Vw(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var pl,Xs,Ht,$r,Ys,zn,Zx,Qw=(Zx=class extends D0{constructor(t){super();me(this,Ys);me(this,pl);me(this,Xs);me(this,Ht);me(this,$r);te(this,pl,t.client),this.mutationId=t.mutationId,te(this,Ht,t.mutationCache),te(this,Xs,[]),this.state=t.state||M0(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){M(this,Xs).includes(t)||(M(this,Xs).push(t),this.clearGcTimeout(),M(this,Ht).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){te(this,Xs,M(this,Xs).filter(n=>n!==t)),this.scheduleGc(),M(this,Ht).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){M(this,Xs).length||(this.state.status==="pending"?this.scheduleGc():M(this,Ht).remove(this))}continue(){var t;return((t=M(this,$r))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,o,c,d,u,h,x,m,f,p,b,g,y,v,N,E,P,I,w,S;const n=()=>{be(this,Ys,zn).call(this,{type:"continue"})},r={client:M(this,pl),meta:this.options.meta,mutationKey:this.options.mutationKey};te(this,$r,E0({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(A,O)=>{be(this,Ys,zn).call(this,{type:"failed",failureCount:A,error:O})},onPause:()=>{be(this,Ys,zn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>M(this,Ht).canRun(this)}));const a=this.state.status==="pending",i=!M(this,$r).canStart();try{if(a)n();else{be(this,Ys,zn).call(this,{type:"pending",variables:t,isPaused:i}),await((o=(l=M(this,Ht).config).onMutate)==null?void 0:o.call(l,t,this,r));const O=await((d=(c=this.options).onMutate)==null?void 0:d.call(c,t,r));O!==this.state.context&&be(this,Ys,zn).call(this,{type:"pending",context:O,variables:t,isPaused:i})}const A=await M(this,$r).start();return await((h=(u=M(this,Ht).config).onSuccess)==null?void 0:h.call(u,A,t,this.state.context,this,r)),await((m=(x=this.options).onSuccess)==null?void 0:m.call(x,A,t,this.state.context,r)),await((p=(f=M(this,Ht).config).onSettled)==null?void 0:p.call(f,A,null,this.state.variables,this.state.context,this,r)),await((g=(b=this.options).onSettled)==null?void 0:g.call(b,A,null,t,this.state.context,r)),be(this,Ys,zn).call(this,{type:"success",data:A}),A}catch(A){try{await((v=(y=M(this,Ht).config).onError)==null?void 0:v.call(y,A,t,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((E=(N=this.options).onError)==null?void 0:E.call(N,A,t,this.state.context,r))}catch(O){Promise.reject(O)}try{await((I=(P=M(this,Ht).config).onSettled)==null?void 0:I.call(P,void 0,A,this.state.variables,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((S=(w=this.options).onSettled)==null?void 0:S.call(w,void 0,A,t,this.state.context,r))}catch(O){Promise.reject(O)}throw be(this,Ys,zn).call(this,{type:"error",error:A}),A}finally{M(this,Ht).runNext(this)}}},pl=new WeakMap,Xs=new WeakMap,Ht=new WeakMap,$r=new WeakMap,Ys=new WeakSet,zn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ht.batch(()=>{M(this,Xs).forEach(r=>{r.onMutationUpdate(t)}),M(this,Ht).notify({mutation:this,type:"updated",action:t})})},Zx);function M0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var jn,Os,xl,Jx,Hw=(Jx=class extends ta{constructor(t={}){super();me(this,jn);me(this,Os);me(this,xl);this.config=t,te(this,jn,new Set),te(this,Os,new Map),te(this,xl,0)}build(t,n,r){const a=new Qw({client:t,mutationCache:this,mutationId:++Ll(this,xl)._,options:t.defaultMutationOptions(n),state:r});return this.add(a),a}add(t){M(this,jn).add(t);const n=eo(t);if(typeof n=="string"){const r=M(this,Os).get(n);r?r.push(t):M(this,Os).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(M(this,jn).delete(t)){const n=eo(t);if(typeof n=="string"){const r=M(this,Os).get(n);if(r)if(r.length>1){const a=r.indexOf(t);a!==-1&&r.splice(a,1)}else r[0]===t&&M(this,Os).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=eo(t);if(typeof n=="string"){const r=M(this,Os).get(n),a=r==null?void 0:r.find(i=>i.state.status==="pending");return!a||a===t}else return!0}runNext(t){var r;const n=eo(t);if(typeof n=="string"){const a=(r=M(this,Os).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ht.batch(()=>{M(this,jn).forEach(t=>{this.notify({type:"removed",mutation:t})}),M(this,jn).clear(),M(this,Os).clear()})}getAll(){return Array.from(M(this,jn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>zp(n,r))}findAll(t={}){return this.getAll().filter(n=>zp(t,n))}notify(t){ht.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ht.batch(()=>Promise.all(t.map(n=>n.continue().catch(_t))))}},jn=new WeakMap,Os=new WeakMap,xl=new WeakMap,Jx);function eo(e){var t;return(t=e.options.scope)==null?void 0:t.id}var bn,Zn,rs,Nn,En,go,Fu,Xx,Ww=(Xx=class extends ta{constructor(n,r){super();me(this,En);me(this,bn);me(this,Zn);me(this,rs);me(this,Nn);te(this,bn,n),this.setOptions(r),this.bindMethods(),be(this,En,go).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var a;const r=this.options;this.options=M(this,bn).defaultMutationOptions(n),al(this.options,r)||M(this,bn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:M(this,rs),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Zr(r.mutationKey)!==Zr(this.options.mutationKey)?this.reset():((a=M(this,rs))==null?void 0:a.state.status)==="pending"&&M(this,rs).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=M(this,rs))==null||n.removeObserver(this)}onMutationUpdate(n){be(this,En,go).call(this),be(this,En,Fu).call(this,n)}getCurrentResult(){return M(this,Zn)}reset(){var n;(n=M(this,rs))==null||n.removeObserver(this),te(this,rs,void 0),be(this,En,go).call(this),be(this,En,Fu).call(this)}mutate(n,r){var a;return te(this,Nn,r),(a=M(this,rs))==null||a.removeObserver(this),te(this,rs,M(this,bn).getMutationCache().build(M(this,bn),this.options)),M(this,rs).addObserver(this),M(this,rs).execute(n)}},bn=new WeakMap,Zn=new WeakMap,rs=new WeakMap,Nn=new WeakMap,En=new WeakSet,go=function(){var r;const n=((r=M(this,rs))==null?void 0:r.state)??M0();te(this,Zn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Fu=function(n){ht.batch(()=>{var r,a,i,l,o,c,d,u;if(M(this,Nn)&&this.hasListeners()){const h=M(this,Zn).variables,x=M(this,Zn).context,m={client:M(this,bn),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(a=(r=M(this,Nn)).onSuccess)==null||a.call(r,n.data,h,x,m)}catch(f){Promise.reject(f)}try{(l=(i=M(this,Nn)).onSettled)==null||l.call(i,n.data,null,h,x,m)}catch(f){Promise.reject(f)}}else if((n==null?void 0:n.type)==="error"){try{(c=(o=M(this,Nn)).onError)==null||c.call(o,n.error,h,x,m)}catch(f){Promise.reject(f)}try{(u=(d=M(this,Nn)).onSettled)==null||u.call(d,void 0,n.error,h,x,m)}catch(f){Promise.reject(f)}}}this.listeners.forEach(h=>{h(M(this,Zn))})})},Xx);function Hp(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}function Gw(e,t,n){const r=e.slice(0);return r[t]=n,r}var La,fs,Oa,za,Ss,Jn,gl,yl,vl,jl,Ot,Iu,Ru,Lu,Ou,zu,Yx,Zw=(Yx=class extends ta{constructor(t,n,r){super();me(this,Ot);me(this,La);me(this,fs);me(this,Oa);me(this,za);me(this,Ss);me(this,Jn);me(this,gl);me(this,yl);me(this,vl);me(this,jl,[]);te(this,La,t),te(this,za,r),te(this,Oa,[]),te(this,Ss,[]),te(this,fs,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&M(this,Ss).forEach(t=>{t.subscribe(n=>{be(this,Ot,Ou).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,M(this,Ss).forEach(t=>{t.destroy()})}setQueries(t,n){te(this,Oa,t),te(this,za,n),ht.batch(()=>{const r=M(this,Ss),a=be(this,Ot,Lu).call(this,M(this,Oa));a.forEach(h=>h.observer.setOptions(h.defaultedQueryOptions));const i=a.map(h=>h.observer),l=i.map(h=>h.getCurrentResult()),o=r.length!==i.length,c=i.some((h,x)=>h!==r[x]),d=o||c,u=d?!0:l.some((h,x)=>{const m=M(this,fs)[x];return!m||!al(h,m)});!d&&!u||(d&&(te(this,jl,a),te(this,Ss,i)),te(this,fs,l),this.hasListeners()&&(d&&(Hp(r,i).forEach(h=>{h.destroy()}),Hp(i,r).forEach(h=>{h.subscribe(x=>{be(this,Ot,Ou).call(this,h,x)})})),be(this,Ot,zu).call(this)))})}getCurrentResult(){return M(this,fs)}getQueries(){return M(this,Ss).map(t=>t.getCurrentQuery())}getObservers(){return M(this,Ss)}getOptimisticResult(t,n){const r=be(this,Ot,Lu).call(this,t),a=r.map(l=>l.observer.getOptimisticResult(l.defaultedQueryOptions)),i=r.map(l=>l.defaultedQueryOptions.queryHash);return[a,l=>be(this,Ot,Ru).call(this,l??a,n,i),()=>be(this,Ot,Iu).call(this,a,r)]}},La=new WeakMap,fs=new WeakMap,Oa=new WeakMap,za=new WeakMap,Ss=new WeakMap,Jn=new WeakMap,gl=new WeakMap,yl=new WeakMap,vl=new WeakMap,jl=new WeakMap,Ot=new WeakSet,Iu=function(t,n){return n.map((r,a)=>{const i=t[a];return r.defaultedQueryOptions.notifyOnChangeProps?i:r.observer.trackResult(i,l=>{n.forEach(o=>{o.observer.trackProp(l)})})})},Ru=function(t,n,r){if(n){const a=M(this,vl),i=r!==void 0&&a!==void 0&&(a.length!==r.length||r.some((l,o)=>l!==a[o]));return(!M(this,Jn)||M(this,fs)!==M(this,yl)||i||n!==M(this,gl))&&(te(this,gl,n),te(this,yl,M(this,fs)),r!==void 0&&te(this,vl,r),te(this,Jn,Jm(M(this,Jn),n(t)))),M(this,Jn)}return t},Lu=function(t){const n=new Map;M(this,Ss).forEach(a=>{const i=a.options.queryHash;if(!i)return;const l=n.get(i);l?l.push(a):n.set(i,[a])});const r=[];return t.forEach(a=>{var c;const i=M(this,La).defaultQueryOptions(a),o=((c=n.get(i.queryHash))==null?void 0:c.shift())??new th(M(this,La),i);r.push({defaultedQueryOptions:i,observer:o})}),r},Ou=function(t,n){const r=M(this,Ss).indexOf(t);r!==-1&&(te(this,fs,Gw(M(this,fs),r,n)),be(this,Ot,zu).call(this))},zu=function(){var t;if(this.hasListeners()){const n=M(this,Jn),r=be(this,Ot,Iu).call(this,M(this,fs),M(this,jl)),a=be(this,Ot,Ru).call(this,r,(t=M(this,za))==null?void 0:t.combine);n!==a&&ht.batch(()=>{this.listeners.forEach(i=>{i(M(this,fs))})})}},Yx),en,eg,Jw=(eg=class extends ta{constructor(t={}){super();me(this,en);this.config=t,te(this,en,new Map)}build(t,n,r){const a=n.queryKey,i=n.queryHash??Zm(a,n);let l=this.get(i);return l||(l=new Bw({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(a)}),this.add(l)),l}add(t){M(this,en).has(t.queryHash)||(M(this,en).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=M(this,en).get(t.queryHash);n&&(t.destroy(),n===t&&M(this,en).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ht.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return M(this,en).get(t)}getAll(){return[...M(this,en).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Op(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Op(t,r)):n}notify(t){ht.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ht.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ht.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},en=new WeakMap,eg),dt,Xn,Yn,$a,_a,er,Ka,Ba,tg,Xw=(tg=class{constructor(e={}){me(this,dt);me(this,Xn);me(this,Yn);me(this,$a);me(this,_a);me(this,er);me(this,Ka);me(this,Ba);te(this,dt,e.queryCache||new Jw),te(this,Xn,e.mutationCache||new Hw),te(this,Yn,e.defaultOptions||{}),te(this,$a,new Map),te(this,_a,new Map),te(this,er,0)}mount(){Ll(this,er)._++,M(this,er)===1&&(te(this,Ka,eh.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(this,dt).onFocus())})),te(this,Ba,Go.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(this,dt).onOnline())})))}unmount(){var e,t;Ll(this,er)._--,M(this,er)===0&&((e=M(this,Ka))==null||e.call(this),te(this,Ka,void 0),(t=M(this,Ba))==null||t.call(this),te(this,Ba,void 0))}isFetching(e){return M(this,dt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return M(this,Xn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=M(this,dt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=M(this,dt).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(hr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return M(this,dt).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),a=M(this,dt).get(r.queryHash),i=a==null?void 0:a.state.data,l=Mw(t,i);if(l!==void 0)return M(this,dt).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return ht.batch(()=>M(this,dt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=M(this,dt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=M(this,dt);ht.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=M(this,dt);return ht.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ht.batch(()=>M(this,dt).findAll(e).map(a=>a.cancel(n)));return Promise.all(r).then(_t).catch(_t)}invalidateQueries(e,t={}){return ht.batch(()=>(M(this,dt).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ht.batch(()=>M(this,dt).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,n);return n.throwOnError||(i=i.catch(_t)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(_t)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=M(this,dt).build(this,t);return n.isStaleByTime(hr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_t).catch(_t)}fetchInfiniteQuery(e){return e.behavior=Vp(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_t).catch(_t)}ensureInfiniteQueryData(e){return e.behavior=Vp(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Go.isOnline()?M(this,Xn).resumePausedMutations():Promise.resolve()}getQueryCache(){return M(this,dt)}getMutationCache(){return M(this,Xn)}getDefaultOptions(){return M(this,Yn)}setDefaultOptions(e){te(this,Yn,e)}setQueryDefaults(e,t){M(this,$a).set(Zr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...M(this,$a).values()],n={};return t.forEach(r=>{rl(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){M(this,_a).set(Zr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...M(this,_a).values()],n={};return t.forEach(r=>{rl(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...M(this,Yn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Zm(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Xm&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...M(this,Yn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){M(this,dt).clear(),M(this,Xn).clear()}},dt=new WeakMap,Xn=new WeakMap,Yn=new WeakMap,$a=new WeakMap,_a=new WeakMap,er=new WeakMap,Ka=new WeakMap,Ba=new WeakMap,tg),T0=j.createContext(void 0),ge=e=>{const t=j.useContext(T0);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Yw=({client:e,children:t})=>(j.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(T0.Provider,{value:e,children:t})),F0=j.createContext(!1),I0=()=>j.useContext(F0);F0.Provider;function e1(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var t1=j.createContext(e1()),R0=()=>j.useContext(t1),L0=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Ym(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},O0=e=>{j.useEffect(()=>{e.clearReset()},[e])},z0=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||Ym(n,[e.error,r])),$0=e=>{if(e.suspense){const n=a=>a==="static"?a:Math.max(a??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...a)=>n(r(...a)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},_0=(e,t)=>e.isLoading&&e.isFetching&&!t,$u=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Zo=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function s1({queries:e,...t},n){const r=ge(),a=I0(),i=R0(),l=j.useMemo(()=>e.map(p=>{const b=r.defaultQueryOptions(p);return b._optimisticResults=a?"isRestoring":"optimistic",b}),[e,r,a]);l.forEach(p=>{$0(p);const b=r.getQueryCache().get(p.queryHash);L0(p,i,b)}),O0(i);const[o]=j.useState(()=>new Zw(r,l,t)),[c,d,u]=o.getOptimisticResult(l,t.combine),h=!a&&t.subscribed!==!1;j.useSyncExternalStore(j.useCallback(p=>h?o.subscribe(ht.batchCalls(p)):_t,[o,h]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),j.useEffect(()=>{o.setQueries(l,t)},[l,t,o]);const m=c.some((p,b)=>$u(l[b],p))?c.flatMap((p,b)=>{const g=l[b];if(g){const y=new th(r,g);if($u(g,p))return Zo(g,y,i);_0(p,a)&&Zo(g,y,i)}return[]}):[];if(m.length>0)throw Promise.all(m);const f=c.find((p,b)=>{const g=l[b];return g&&z0({result:p,errorResetBoundary:i,throwOnError:g.throwOnError,query:r.getQueryCache().get(g.queryHash),suspense:g.suspense})});if(f!=null&&f.error)throw f.error;return d(u())}function n1(e,t,n){var x,m,f,p;const r=I0(),a=R0(),i=ge(),l=i.defaultQueryOptions(e);(m=(x=i.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||m.call(x,l);const o=i.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",$0(l),L0(l,a,o),O0(a);const c=!i.getQueryCache().get(l.queryHash),[d]=j.useState(()=>new t(i,l)),u=d.getOptimisticResult(l),h=!r&&e.subscribed!==!1;if(j.useSyncExternalStore(j.useCallback(b=>{const g=h?d.subscribe(ht.batchCalls(b)):_t;return d.updateResult(),g},[d,h]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),j.useEffect(()=>{d.setOptions(l)},[l,d]),$u(l,u))throw Zo(l,d,a);if(z0({result:u,errorResetBoundary:a,throwOnError:l.throwOnError,query:o,suspense:l.suspense}))throw u.error;if((p=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_afterQuery)==null||p.call(f,l,u),l.experimental_prefetchInRender&&!Gr&&_0(u,r)){const b=c?Zo(l,d,a):o==null?void 0:o.promise;b==null||b.catch(_t).finally(()=>{d.updateResult()})}return l.notifyOnChangeProps?u:d.trackResult(u)}function fe(e,t){return n1(e,th)}function G(e,t){const n=ge(),[r]=j.useState(()=>new Ww(n,e));j.useEffect(()=>{r.setOptions(e)},[r,e]);const a=j.useSyncExternalStore(j.useCallback(l=>r.subscribe(ht.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=j.useCallback((l,o)=>{r.mutate(l,o).catch(_t)},[r]);if(a.error&&Ym(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:i,mutateAsync:a.mutate}}let r1={data:""},a1=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||r1},i1=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,l1=/\/\*[^]*?\*\/| +/g,Wp=/\n+/g,Un=(e,t)=>{let n="",r="",a="";for(let i in e){let l=e[i];i[0]=="@"?i[1]=="i"?n=i+" "+l+";":r+=i[1]=="f"?Un(l,i):i+"{"+Un(l,i[1]=="k"?"":t)+"}":typeof l=="object"?r+=Un(l,t?t.replace(/([^,])+/g,o=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,o):o?o+" "+c:c)):i):l!=null&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=Un.p?Un.p(i,l):i+":"+l+";")}return n+(t&&a?t+"{"+a+"}":a)+r},hn={},K0=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+K0(e[n]);return t}return e},o1=(e,t,n,r,a)=>{let i=K0(e),l=hn[i]||(hn[i]=(c=>{let d=0,u=11;for(;d>>0;return"go"+u})(i));if(!hn[l]){let c=i!==e?e:(d=>{let u,h,x=[{}];for(;u=i1.exec(d.replace(l1,""));)u[4]?x.shift():u[3]?(h=u[3].replace(Wp," ").trim(),x.unshift(x[0][h]=x[0][h]||{})):x[0][u[1]]=u[2].replace(Wp," ").trim();return x[0]})(e);hn[l]=Un(a?{["@keyframes "+l]:c}:c,n?"":"."+l)}let o=n&&hn.g?hn.g:null;return n&&(hn.g=hn[l]),((c,d,u,h)=>{h?d.data=d.data.replace(h,c):d.data.indexOf(c)===-1&&(d.data=u?c+d.data:d.data+c)})(hn[l],t,r,o),l},c1=(e,t,n)=>e.reduce((r,a,i)=>{let l=t[i];if(l&&l.call){let o=l(n),c=o&&o.props&&o.props.className||/^go/.test(o)&&o;l=c?"."+c:o&&typeof o=="object"?o.props?"":Un(o,""):o===!1?"":o}return r+a+(l??"")},"");function kc(e){let t=this||{},n=e.call?e(t.p):e;return o1(n.unshift?n.raw?c1(n,[].slice.call(arguments,1),t.p):n.reduce((r,a)=>Object.assign(r,a&&a.call?a(t.p):a),{}):n,a1(t.target),t.g,t.o,t.k)}let B0,_u,Ku;kc.bind({g:1});let Tn=kc.bind({k:1});function d1(e,t,n,r){Un.p=t,B0=e,_u=n,Ku=r}function jr(e,t){let n=this||{};return function(){let r=arguments;function a(i,l){let o=Object.assign({},i),c=o.className||a.className;n.p=Object.assign({theme:_u&&_u()},o),n.o=/ *go\d+/.test(c),o.className=kc.apply(n,r)+(c?" "+c:"");let d=e;return e[0]&&(d=o.as||e,delete o.as),Ku&&d[0]&&Ku(o),B0(d,o)}return a}}var u1=e=>typeof e=="function",Jo=(e,t)=>u1(e)?e(t):e,m1=(()=>{let e=0;return()=>(++e).toString()})(),U0=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),h1=20,nh="default",q0=(e,t)=>{let{toastLimit:n}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,n)};case 1:return{...e,toasts:e.toasts.map(l=>l.id===t.toast.id?{...l,...t.toast}:l)};case 2:let{toast:r}=t;return q0(e,{type:e.toasts.find(l=>l.id===r.id)?1:0,toast:r});case 3:let{toastId:a}=t;return{...e,toasts:e.toasts.map(l=>l.id===a||a===void 0?{...l,dismissed:!0,visible:!1}:l)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(l=>l.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(l=>({...l,pauseDuration:l.pauseDuration+i}))}}},yo=[],V0={toasts:[],pausedAt:void 0,settings:{toastLimit:h1}},sn={},Q0=(e,t=nh)=>{sn[t]=q0(sn[t]||V0,e),yo.forEach(([n,r])=>{n===t&&r(sn[t])})},H0=e=>Object.keys(sn).forEach(t=>Q0(e,t)),f1=e=>Object.keys(sn).find(t=>sn[t].toasts.some(n=>n.id===e)),Cc=(e=nh)=>t=>{Q0(t,e)},p1={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},x1=(e={},t=nh)=>{let[n,r]=j.useState(sn[t]||V0),a=j.useRef(sn[t]);j.useEffect(()=>(a.current!==sn[t]&&r(sn[t]),yo.push([t,r]),()=>{let l=yo.findIndex(([o])=>o===t);l>-1&&yo.splice(l,1)}),[t]);let i=n.toasts.map(l=>{var o,c,d;return{...e,...e[l.type],...l,removeDelay:l.removeDelay||((o=e[l.type])==null?void 0:o.removeDelay)||(e==null?void 0:e.removeDelay),duration:l.duration||((c=e[l.type])==null?void 0:c.duration)||(e==null?void 0:e.duration)||p1[l.type],style:{...e.style,...(d=e[l.type])==null?void 0:d.style,...l.style}}});return{...n,toasts:i}},g1=(e,t="blank",n)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...n,id:(n==null?void 0:n.id)||m1()}),Cl=e=>(t,n)=>{let r=g1(t,e,n);return Cc(r.toasterId||f1(r.id))({type:2,toast:r}),r.id},wt=(e,t)=>Cl("blank")(e,t);wt.error=Cl("error");wt.success=Cl("success");wt.loading=Cl("loading");wt.custom=Cl("custom");wt.dismiss=(e,t)=>{let n={type:3,toastId:e};t?Cc(t)(n):H0(n)};wt.dismissAll=e=>wt.dismiss(void 0,e);wt.remove=(e,t)=>{let n={type:4,toastId:e};t?Cc(t)(n):H0(n)};wt.removeAll=e=>wt.remove(void 0,e);wt.promise=(e,t,n)=>{let r=wt.loading(t.loading,{...n,...n==null?void 0:n.loading});return typeof e=="function"&&(e=e()),e.then(a=>{let i=t.success?Jo(t.success,a):void 0;return i?wt.success(i,{id:r,...n,...n==null?void 0:n.success}):wt.dismiss(r),a}).catch(a=>{let i=t.error?Jo(t.error,a):void 0;i?wt.error(i,{id:r,...n,...n==null?void 0:n.error}):wt.dismiss(r)}),e};var y1=1e3,v1=(e,t="default")=>{let{toasts:n,pausedAt:r}=x1(e,t),a=j.useRef(new Map).current,i=j.useCallback((h,x=y1)=>{if(a.has(h))return;let m=setTimeout(()=>{a.delete(h),l({type:4,toastId:h})},x);a.set(h,m)},[]);j.useEffect(()=>{if(r)return;let h=Date.now(),x=n.map(m=>{if(m.duration===1/0)return;let f=(m.duration||0)+m.pauseDuration-(h-m.createdAt);if(f<0){m.visible&&wt.dismiss(m.id);return}return setTimeout(()=>wt.dismiss(m.id,t),f)});return()=>{x.forEach(m=>m&&clearTimeout(m))}},[n,r,t]);let l=j.useCallback(Cc(t),[t]),o=j.useCallback(()=>{l({type:5,time:Date.now()})},[l]),c=j.useCallback((h,x)=>{l({type:1,toast:{id:h,height:x}})},[l]),d=j.useCallback(()=>{r&&l({type:6,time:Date.now()})},[r,l]),u=j.useCallback((h,x)=>{let{reverseOrder:m=!1,gutter:f=8,defaultPosition:p}=x||{},b=n.filter(v=>(v.position||p)===(h.position||p)&&v.height),g=b.findIndex(v=>v.id===h.id),y=b.filter((v,N)=>Nv.visible).slice(...m?[y+1]:[0,y]).reduce((v,N)=>v+(N.height||0)+f,0)},[n]);return j.useEffect(()=>{n.forEach(h=>{if(h.dismissed)i(h.id,h.removeDelay);else{let x=a.get(h.id);x&&(clearTimeout(x),a.delete(h.id))}})},[n,i]),{toasts:n,handlers:{updateHeight:c,startPause:o,endPause:d,calculateOffset:u}}},j1=Tn` +from { + transform: scale(0) rotate(45deg); + opacity: 0; +} +to { + transform: scale(1) rotate(45deg); + opacity: 1; +}`,b1=Tn` +from { + transform: scale(0); + opacity: 0; +} +to { + transform: scale(1); + opacity: 1; +}`,N1=Tn` +from { + transform: scale(0) rotate(90deg); + opacity: 0; +} +to { + transform: scale(1) rotate(90deg); + opacity: 1; +}`,w1=jr("div")` + width: 20px; + opacity: 0; + height: 20px; + border-radius: 10px; + background: ${e=>e.primary||"#ff4b4b"}; + position: relative; + transform: rotate(45deg); + + animation: ${j1} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) + forwards; + animation-delay: 100ms; + + &:after, + &:before { + content: ''; + animation: ${b1} 0.15s ease-out forwards; + animation-delay: 150ms; + position: absolute; + border-radius: 3px; + opacity: 0; + background: ${e=>e.secondary||"#fff"}; + bottom: 9px; + left: 4px; + height: 2px; + width: 12px; + } + + &:before { + animation: ${N1} 0.15s ease-out forwards; + animation-delay: 180ms; + transform: rotate(90deg); + } +`,S1=Tn` + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +`,k1=jr("div")` + width: 12px; + height: 12px; + box-sizing: border-box; + border: 2px solid; + border-radius: 100%; + border-color: ${e=>e.secondary||"#e0e0e0"}; + border-right-color: ${e=>e.primary||"#616161"}; + animation: ${S1} 1s linear infinite; +`,C1=Tn` +from { + transform: scale(0) rotate(45deg); + opacity: 0; +} +to { + transform: scale(1) rotate(45deg); + opacity: 1; +}`,E1=Tn` +0% { + height: 0; + width: 0; + opacity: 0; +} +40% { + height: 0; + width: 6px; + opacity: 1; +} +100% { + opacity: 1; + height: 10px; +}`,D1=jr("div")` + width: 20px; + opacity: 0; + height: 20px; + border-radius: 10px; + background: ${e=>e.primary||"#61d345"}; + position: relative; + transform: rotate(45deg); + + animation: ${C1} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) + forwards; + animation-delay: 100ms; + &:after { + content: ''; + box-sizing: border-box; + animation: ${E1} 0.2s ease-out forwards; + opacity: 0; + animation-delay: 200ms; + position: absolute; + border-right: 2px solid; + border-bottom: 2px solid; + border-color: ${e=>e.secondary||"#fff"}; + bottom: 6px; + left: 6px; + height: 10px; + width: 6px; + } +`,A1=jr("div")` + position: absolute; +`,P1=jr("div")` + position: relative; + display: flex; + justify-content: center; + align-items: center; + min-width: 20px; + min-height: 20px; +`,M1=Tn` +from { + transform: scale(0.6); + opacity: 0.4; +} +to { + transform: scale(1); + opacity: 1; +}`,T1=jr("div")` + position: relative; + transform: scale(0.6); + opacity: 0.4; + min-width: 20px; + animation: ${M1} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) + forwards; +`,F1=({toast:e})=>{let{icon:t,type:n,iconTheme:r}=e;return t!==void 0?typeof t=="string"?j.createElement(T1,null,t):t:n==="blank"?null:j.createElement(P1,null,j.createElement(k1,{...r}),n!=="loading"&&j.createElement(A1,null,n==="error"?j.createElement(w1,{...r}):j.createElement(D1,{...r})))},I1=e=>` +0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;} +100% {transform: translate3d(0,0,0) scale(1); opacity:1;} +`,R1=e=>` +0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} +100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;} +`,L1="0%{opacity:0;} 100%{opacity:1;}",O1="0%{opacity:1;} 100%{opacity:0;}",z1=jr("div")` + display: flex; + align-items: center; + background: #fff; + color: #363636; + line-height: 1.3; + will-change: transform; + box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); + max-width: 350px; + pointer-events: auto; + padding: 8px 10px; + border-radius: 8px; +`,$1=jr("div")` + display: flex; + justify-content: center; + margin: 4px 10px; + color: inherit; + flex: 1 1 auto; + white-space: pre-line; +`,_1=(e,t)=>{let n=e.includes("top")?1:-1,[r,a]=U0()?[L1,O1]:[I1(n),R1(n)];return{animation:t?`${Tn(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${Tn(a)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},K1=j.memo(({toast:e,position:t,style:n,children:r})=>{let a=e.height?_1(e.position||t||"top-center",e.visible):{opacity:0},i=j.createElement(F1,{toast:e}),l=j.createElement($1,{...e.ariaProps},Jo(e.message,e));return j.createElement(z1,{className:e.className,style:{...a,...n,...e.style}},typeof r=="function"?r({icon:i,message:l}):j.createElement(j.Fragment,null,i,l))});d1(j.createElement);var B1=({id:e,className:t,style:n,onHeightUpdate:r,children:a})=>{let i=j.useCallback(l=>{if(l){let o=()=>{let c=l.getBoundingClientRect().height;r(e,c)};o(),new MutationObserver(o).observe(l,{subtree:!0,childList:!0,characterData:!0})}},[e,r]);return j.createElement("div",{ref:i,className:t,style:n},a)},U1=(e,t)=>{let n=e.includes("top"),r=n?{top:0}:{bottom:0},a=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:U0()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(n?1:-1)}px)`,...r,...a}},q1=kc` + z-index: 9999; + > * { + pointer-events: auto; + } +`,to=16,V1=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:a,toasterId:i,containerStyle:l,containerClassName:o})=>{let{toasts:c,handlers:d}=v1(n,i);return j.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:to,left:to,right:to,bottom:to,pointerEvents:"none",...l},className:o,onMouseEnter:d.startPause,onMouseLeave:d.endPause},c.map(u=>{let h=u.position||t,x=d.calculateOffset(u,{reverseOrder:e,gutter:r,defaultPosition:t}),m=U1(h,x);return j.createElement(B1,{id:u.id,key:u.id,onHeightUpdate:d.updateHeight,className:u.visible?q1:"",style:m},u.type==="custom"?Jo(u.message,u):a?a(u):j.createElement(K1,{toast:u,position:h}))}))},Re=wt;function W0(e,t){return function(){return e.apply(t,arguments)}}const{toString:Q1}=Object.prototype,{getPrototypeOf:rh}=Object,{iterator:Ec,toStringTag:G0}=Symbol,Dc=(e=>t=>{const n=Q1.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Qs=e=>(e=e.toLowerCase(),t=>Dc(t)===e),Ac=e=>t=>typeof t===e,{isArray:ri}=Array,Ja=Ac("undefined");function El(e){return e!==null&&!Ja(e)&&e.constructor!==null&&!Ja(e.constructor)&&us(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Z0=Qs("ArrayBuffer");function H1(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Z0(e.buffer),t}const W1=Ac("string"),us=Ac("function"),J0=Ac("number"),Dl=e=>e!==null&&typeof e=="object",G1=e=>e===!0||e===!1,vo=e=>{if(Dc(e)!=="object")return!1;const t=rh(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(G0 in e)&&!(Ec in e)},Z1=e=>{if(!Dl(e)||El(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},J1=Qs("Date"),X1=Qs("File"),Y1=Qs("Blob"),eS=Qs("FileList"),tS=e=>Dl(e)&&us(e.pipe),sS=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||us(e.append)&&((t=Dc(e))==="formdata"||t==="object"&&us(e.toString)&&e.toString()==="[object FormData]"))},nS=Qs("URLSearchParams"),[rS,aS,iS,lS]=["ReadableStream","Request","Response","Headers"].map(Qs),oS=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Al(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,a;if(typeof e!="object"&&(e=[e]),ri(e))for(r=0,a=e.length;r0;)if(a=n[r],t===a.toLowerCase())return a;return null}const Ar=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Y0=e=>!Ja(e)&&e!==Ar;function Bu(){const{caseless:e,skipUndefined:t}=Y0(this)&&this||{},n={},r=(a,i)=>{const l=e&&X0(n,i)||i;vo(n[l])&&vo(a)?n[l]=Bu(n[l],a):vo(a)?n[l]=Bu({},a):ri(a)?n[l]=a.slice():(!t||!Ja(a))&&(n[l]=a)};for(let a=0,i=arguments.length;a(Al(t,(a,i)=>{n&&us(a)?e[i]=W0(a,n):e[i]=a},{allOwnKeys:r}),e),dS=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),uS=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},mS=(e,t,n,r)=>{let a,i,l;const o={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),i=a.length;i-- >0;)l=a[i],(!r||r(l,e,t))&&!o[l]&&(t[l]=e[l],o[l]=!0);e=n!==!1&&rh(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},hS=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},fS=e=>{if(!e)return null;if(ri(e))return e;let t=e.length;if(!J0(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},pS=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&rh(Uint8Array)),xS=(e,t)=>{const r=(e&&e[Ec]).call(e);let a;for(;(a=r.next())&&!a.done;){const i=a.value;t.call(e,i[0],i[1])}},gS=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},yS=Qs("HTMLFormElement"),vS=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,a){return r.toUpperCase()+a}),Gp=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),jS=Qs("RegExp"),ev=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Al(n,(a,i)=>{let l;(l=t(a,i,e))!==!1&&(r[i]=l||a)}),Object.defineProperties(e,r)},bS=e=>{ev(e,(t,n)=>{if(us(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(us(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},NS=(e,t)=>{const n={},r=a=>{a.forEach(i=>{n[i]=!0})};return ri(e)?r(e):r(String(e).split(t)),n},wS=()=>{},SS=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function kS(e){return!!(e&&us(e.append)&&e[G0]==="FormData"&&e[Ec])}const CS=e=>{const t=new Array(10),n=(r,a)=>{if(Dl(r)){if(t.indexOf(r)>=0)return;if(El(r))return r;if(!("toJSON"in r)){t[a]=r;const i=ri(r)?[]:{};return Al(r,(l,o)=>{const c=n(l,a+1);!Ja(c)&&(i[o]=c)}),t[a]=void 0,i}}return r};return n(e,0)},ES=Qs("AsyncFunction"),DS=e=>e&&(Dl(e)||us(e))&&us(e.then)&&us(e.catch),tv=((e,t)=>e?setImmediate:t?((n,r)=>(Ar.addEventListener("message",({source:a,data:i})=>{a===Ar&&i===n&&r.length&&r.shift()()},!1),a=>{r.push(a),Ar.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",us(Ar.postMessage)),AS=typeof queueMicrotask<"u"?queueMicrotask.bind(Ar):typeof process<"u"&&process.nextTick||tv,PS=e=>e!=null&&us(e[Ec]),V={isArray:ri,isArrayBuffer:Z0,isBuffer:El,isFormData:sS,isArrayBufferView:H1,isString:W1,isNumber:J0,isBoolean:G1,isObject:Dl,isPlainObject:vo,isEmptyObject:Z1,isReadableStream:rS,isRequest:aS,isResponse:iS,isHeaders:lS,isUndefined:Ja,isDate:J1,isFile:X1,isBlob:Y1,isRegExp:jS,isFunction:us,isStream:tS,isURLSearchParams:nS,isTypedArray:pS,isFileList:eS,forEach:Al,merge:Bu,extend:cS,trim:oS,stripBOM:dS,inherits:uS,toFlatObject:mS,kindOf:Dc,kindOfTest:Qs,endsWith:hS,toArray:fS,forEachEntry:xS,matchAll:gS,isHTMLForm:yS,hasOwnProperty:Gp,hasOwnProp:Gp,reduceDescriptors:ev,freezeMethods:bS,toObjectSet:NS,toCamelCase:vS,noop:wS,toFiniteNumber:SS,findKey:X0,global:Ar,isContextDefined:Y0,isSpecCompliantForm:kS,toJSONObject:CS,isAsyncFn:ES,isThenable:DS,setImmediate:tv,asap:AS,isIterable:PS};function Se(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}V.inherits(Se,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:V.toJSONObject(this.config),code:this.code,status:this.status}}});const sv=Se.prototype,nv={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{nv[e]={value:e}});Object.defineProperties(Se,nv);Object.defineProperty(sv,"isAxiosError",{value:!0});Se.from=(e,t,n,r,a,i)=>{const l=Object.create(sv);V.toFlatObject(e,l,function(u){return u!==Error.prototype},d=>d!=="isAxiosError");const o=e&&e.message?e.message:"Error",c=t==null&&e?e.code:t;return Se.call(l,o,c,n,r,a),e&&l.cause==null&&Object.defineProperty(l,"cause",{value:e,configurable:!0}),l.name=e&&e.name||"Error",i&&Object.assign(l,i),l};const MS=null;function Uu(e){return V.isPlainObject(e)||V.isArray(e)}function rv(e){return V.endsWith(e,"[]")?e.slice(0,-2):e}function Zp(e,t,n){return e?e.concat(t).map(function(a,i){return a=rv(a),!n&&i?"["+a+"]":a}).join(n?".":""):t}function TS(e){return V.isArray(e)&&!e.some(Uu)}const FS=V.toFlatObject(V,{},null,function(t){return/^is[A-Z]/.test(t)});function Pc(e,t,n){if(!V.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=V.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,b){return!V.isUndefined(b[p])});const r=n.metaTokens,a=n.visitor||u,i=n.dots,l=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&V.isSpecCompliantForm(t);if(!V.isFunction(a))throw new TypeError("visitor must be a function");function d(f){if(f===null)return"";if(V.isDate(f))return f.toISOString();if(V.isBoolean(f))return f.toString();if(!c&&V.isBlob(f))throw new Se("Blob is not supported. Use a Buffer instead.");return V.isArrayBuffer(f)||V.isTypedArray(f)?c&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,p,b){let g=f;if(f&&!b&&typeof f=="object"){if(V.endsWith(p,"{}"))p=r?p:p.slice(0,-2),f=JSON.stringify(f);else if(V.isArray(f)&&TS(f)||(V.isFileList(f)||V.endsWith(p,"[]"))&&(g=V.toArray(f)))return p=rv(p),g.forEach(function(v,N){!(V.isUndefined(v)||v===null)&&t.append(l===!0?Zp([p],N,i):l===null?p:p+"[]",d(v))}),!1}return Uu(f)?!0:(t.append(Zp(b,p,i),d(f)),!1)}const h=[],x=Object.assign(FS,{defaultVisitor:u,convertValue:d,isVisitable:Uu});function m(f,p){if(!V.isUndefined(f)){if(h.indexOf(f)!==-1)throw Error("Circular reference detected in "+p.join("."));h.push(f),V.forEach(f,function(g,y){(!(V.isUndefined(g)||g===null)&&a.call(t,g,V.isString(y)?y.trim():y,p,x))===!0&&m(g,p?p.concat(y):[y])}),h.pop()}}if(!V.isObject(e))throw new TypeError("data must be an object");return m(e),t}function Jp(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function ah(e,t){this._pairs=[],e&&Pc(e,this,t)}const av=ah.prototype;av.append=function(t,n){this._pairs.push([t,n])};av.toString=function(t){const n=t?function(r){return t.call(this,r,Jp)}:Jp;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function IS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function iv(e,t,n){if(!t)return e;const r=n&&n.encode||IS;V.isFunction(n)&&(n={serialize:n});const a=n&&n.serialize;let i;if(a?i=a(t,n):i=V.isURLSearchParams(t)?t.toString():new ah(t,n).toString(r),i){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Xp{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){V.forEach(this.handlers,function(r){r!==null&&t(r)})}}const lv={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},RS=typeof URLSearchParams<"u"?URLSearchParams:ah,LS=typeof FormData<"u"?FormData:null,OS=typeof Blob<"u"?Blob:null,zS={isBrowser:!0,classes:{URLSearchParams:RS,FormData:LS,Blob:OS},protocols:["http","https","file","blob","url","data"]},ih=typeof window<"u"&&typeof document<"u",qu=typeof navigator=="object"&&navigator||void 0,$S=ih&&(!qu||["ReactNative","NativeScript","NS"].indexOf(qu.product)<0),_S=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",KS=ih&&window.location.href||"http://localhost",BS=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ih,hasStandardBrowserEnv:$S,hasStandardBrowserWebWorkerEnv:_S,navigator:qu,origin:KS},Symbol.toStringTag,{value:"Module"})),Bt={...BS,...zS};function US(e,t){return Pc(e,new Bt.classes.URLSearchParams,{visitor:function(n,r,a,i){return Bt.isNode&&V.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function qS(e){return V.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function VS(e){const t={},n=Object.keys(e);let r;const a=n.length;let i;for(r=0;r=n.length;return l=!l&&V.isArray(a)?a.length:l,c?(V.hasOwnProp(a,l)?a[l]=[a[l],r]:a[l]=r,!o):((!a[l]||!V.isObject(a[l]))&&(a[l]=[]),t(n,r,a[l],i)&&V.isArray(a[l])&&(a[l]=VS(a[l])),!o)}if(V.isFormData(e)&&V.isFunction(e.entries)){const n={};return V.forEachEntry(e,(r,a)=>{t(qS(r),a,n,0)}),n}return null}function QS(e,t,n){if(V.isString(e))try{return(t||JSON.parse)(e),V.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Pl={transitional:lv,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",a=r.indexOf("application/json")>-1,i=V.isObject(t);if(i&&V.isHTMLForm(t)&&(t=new FormData(t)),V.isFormData(t))return a?JSON.stringify(ov(t)):t;if(V.isArrayBuffer(t)||V.isBuffer(t)||V.isStream(t)||V.isFile(t)||V.isBlob(t)||V.isReadableStream(t))return t;if(V.isArrayBufferView(t))return t.buffer;if(V.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return US(t,this.formSerializer).toString();if((o=V.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Pc(o?{"files[]":t}:t,c&&new c,this.formSerializer)}}return i||a?(n.setContentType("application/json",!1),QS(t)):t}],transformResponse:[function(t){const n=this.transitional||Pl.transitional,r=n&&n.forcedJSONParsing,a=this.responseType==="json";if(V.isResponse(t)||V.isReadableStream(t))return t;if(t&&V.isString(t)&&(r&&!this.responseType||a)){const l=!(n&&n.silentJSONParsing)&&a;try{return JSON.parse(t,this.parseReviver)}catch(o){if(l)throw o.name==="SyntaxError"?Se.from(o,Se.ERR_BAD_RESPONSE,this,null,this.response):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Bt.classes.FormData,Blob:Bt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};V.forEach(["delete","get","head","post","put","patch"],e=>{Pl.headers[e]={}});const HS=V.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),WS=e=>{const t={};let n,r,a;return e&&e.split(` +`).forEach(function(l){a=l.indexOf(":"),n=l.substring(0,a).trim().toLowerCase(),r=l.substring(a+1).trim(),!(!n||t[n]&&HS[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Yp=Symbol("internals");function vi(e){return e&&String(e).trim().toLowerCase()}function jo(e){return e===!1||e==null?e:V.isArray(e)?e.map(jo):String(e)}function GS(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const ZS=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function hd(e,t,n,r,a){if(V.isFunction(r))return r.call(this,t,n);if(a&&(t=n),!!V.isString(t)){if(V.isString(r))return t.indexOf(r)!==-1;if(V.isRegExp(r))return r.test(t)}}function JS(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function XS(e,t){const n=V.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(a,i,l){return this[r].call(this,t,a,i,l)},configurable:!0})})}let ms=class{constructor(t){t&&this.set(t)}set(t,n,r){const a=this;function i(o,c,d){const u=vi(c);if(!u)throw new Error("header name must be a non-empty string");const h=V.findKey(a,u);(!h||a[h]===void 0||d===!0||d===void 0&&a[h]!==!1)&&(a[h||c]=jo(o))}const l=(o,c)=>V.forEach(o,(d,u)=>i(d,u,c));if(V.isPlainObject(t)||t instanceof this.constructor)l(t,n);else if(V.isString(t)&&(t=t.trim())&&!ZS(t))l(WS(t),n);else if(V.isObject(t)&&V.isIterable(t)){let o={},c,d;for(const u of t){if(!V.isArray(u))throw TypeError("Object iterator must return a key-value pair");o[d=u[0]]=(c=o[d])?V.isArray(c)?[...c,u[1]]:[c,u[1]]:u[1]}l(o,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=vi(t),t){const r=V.findKey(this,t);if(r){const a=this[r];if(!n)return a;if(n===!0)return GS(a);if(V.isFunction(n))return n.call(this,a,r);if(V.isRegExp(n))return n.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=vi(t),t){const r=V.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||hd(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let a=!1;function i(l){if(l=vi(l),l){const o=V.findKey(r,l);o&&(!n||hd(r,r[o],o,n))&&(delete r[o],a=!0)}}return V.isArray(t)?t.forEach(i):i(t),a}clear(t){const n=Object.keys(this);let r=n.length,a=!1;for(;r--;){const i=n[r];(!t||hd(this,this[i],i,t,!0))&&(delete this[i],a=!0)}return a}normalize(t){const n=this,r={};return V.forEach(this,(a,i)=>{const l=V.findKey(r,i);if(l){n[l]=jo(a),delete n[i];return}const o=t?JS(i):String(i).trim();o!==i&&delete n[i],n[o]=jo(a),r[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return V.forEach(this,(r,a)=>{r!=null&&r!==!1&&(n[a]=t&&V.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(a=>r.set(a)),r}static accessor(t){const r=(this[Yp]=this[Yp]={accessors:{}}).accessors,a=this.prototype;function i(l){const o=vi(l);r[o]||(XS(a,l),r[o]=!0)}return V.isArray(t)?t.forEach(i):i(t),this}};ms.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);V.reduceDescriptors(ms.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});V.freezeMethods(ms);function fd(e,t){const n=this||Pl,r=t||n,a=ms.from(r.headers);let i=r.data;return V.forEach(e,function(o){i=o.call(n,i,a.normalize(),t?t.status:void 0)}),a.normalize(),i}function cv(e){return!!(e&&e.__CANCEL__)}function ai(e,t,n){Se.call(this,e??"canceled",Se.ERR_CANCELED,t,n),this.name="CanceledError"}V.inherits(ai,Se,{__CANCEL__:!0});function dv(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Se("Request failed with status code "+n.status,[Se.ERR_BAD_REQUEST,Se.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function YS(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function e2(e,t){e=e||10;const n=new Array(e),r=new Array(e);let a=0,i=0,l;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),u=r[i];l||(l=d),n[a]=c,r[a]=d;let h=i,x=0;for(;h!==a;)x+=n[h++],h=h%e;if(a=(a+1)%e,a===i&&(i=(i+1)%e),d-l{n=u,a=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),h=u-n;h>=r?l(d,u):(a=d,i||(i=setTimeout(()=>{i=null,l(a)},r-h)))},()=>a&&l(a)]}const Xo=(e,t,n=3)=>{let r=0;const a=e2(50,250);return t2(i=>{const l=i.loaded,o=i.lengthComputable?i.total:void 0,c=l-r,d=a(c),u=l<=o;r=l;const h={loaded:l,total:o,progress:o?l/o:void 0,bytes:c,rate:d||void 0,estimated:d&&o&&u?(o-l)/d:void 0,event:i,lengthComputable:o!=null,[t?"download":"upload"]:!0};e(h)},n)},ex=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},tx=e=>(...t)=>V.asap(()=>e(...t)),s2=Bt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Bt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Bt.origin),Bt.navigator&&/(msie|trident)/i.test(Bt.navigator.userAgent)):()=>!0,n2=Bt.hasStandardBrowserEnv?{write(e,t,n,r,a,i,l){if(typeof document>"u")return;const o=[`${e}=${encodeURIComponent(t)}`];V.isNumber(n)&&o.push(`expires=${new Date(n).toUTCString()}`),V.isString(r)&&o.push(`path=${r}`),V.isString(a)&&o.push(`domain=${a}`),i===!0&&o.push("secure"),V.isString(l)&&o.push(`SameSite=${l}`),document.cookie=o.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function r2(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function a2(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function uv(e,t,n){let r=!r2(t);return e&&(r||n==!1)?a2(e,t):t}const sx=e=>e instanceof ms?{...e}:e;function Jr(e,t){t=t||{};const n={};function r(d,u,h,x){return V.isPlainObject(d)&&V.isPlainObject(u)?V.merge.call({caseless:x},d,u):V.isPlainObject(u)?V.merge({},u):V.isArray(u)?u.slice():u}function a(d,u,h,x){if(V.isUndefined(u)){if(!V.isUndefined(d))return r(void 0,d,h,x)}else return r(d,u,h,x)}function i(d,u){if(!V.isUndefined(u))return r(void 0,u)}function l(d,u){if(V.isUndefined(u)){if(!V.isUndefined(d))return r(void 0,d)}else return r(void 0,u)}function o(d,u,h){if(h in t)return r(d,u);if(h in e)return r(void 0,d)}const c={url:i,method:i,data:i,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:o,headers:(d,u,h)=>a(sx(d),sx(u),h,!0)};return V.forEach(Object.keys({...e,...t}),function(u){const h=c[u]||a,x=h(e[u],t[u],u);V.isUndefined(x)&&h!==o||(n[u]=x)}),n}const mv=e=>{const t=Jr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:i,headers:l,auth:o}=t;if(t.headers=l=ms.from(l),t.url=iv(uv(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),o&&l.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),V.isFormData(n)){if(Bt.hasStandardBrowserEnv||Bt.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(V.isFunction(n.getHeaders)){const c=n.getHeaders(),d=["content-type","content-length"];Object.entries(c).forEach(([u,h])=>{d.includes(u.toLowerCase())&&l.set(u,h)})}}if(Bt.hasStandardBrowserEnv&&(r&&V.isFunction(r)&&(r=r(t)),r||r!==!1&&s2(t.url))){const c=a&&i&&n2.read(i);c&&l.set(a,c)}return t},i2=typeof XMLHttpRequest<"u",l2=i2&&function(e){return new Promise(function(n,r){const a=mv(e);let i=a.data;const l=ms.from(a.headers).normalize();let{responseType:o,onUploadProgress:c,onDownloadProgress:d}=a,u,h,x,m,f;function p(){m&&m(),f&&f(),a.cancelToken&&a.cancelToken.unsubscribe(u),a.signal&&a.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(a.method.toUpperCase(),a.url,!0),b.timeout=a.timeout;function g(){if(!b)return;const v=ms.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),E={data:!o||o==="text"||o==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:v,config:e,request:b};dv(function(I){n(I),p()},function(I){r(I),p()},E),b=null}"onloadend"in b?b.onloadend=g:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(g)},b.onabort=function(){b&&(r(new Se("Request aborted",Se.ECONNABORTED,e,b)),b=null)},b.onerror=function(N){const E=N&&N.message?N.message:"Network Error",P=new Se(E,Se.ERR_NETWORK,e,b);P.event=N||null,r(P),b=null},b.ontimeout=function(){let N=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const E=a.transitional||lv;a.timeoutErrorMessage&&(N=a.timeoutErrorMessage),r(new Se(N,E.clarifyTimeoutError?Se.ETIMEDOUT:Se.ECONNABORTED,e,b)),b=null},i===void 0&&l.setContentType(null),"setRequestHeader"in b&&V.forEach(l.toJSON(),function(N,E){b.setRequestHeader(E,N)}),V.isUndefined(a.withCredentials)||(b.withCredentials=!!a.withCredentials),o&&o!=="json"&&(b.responseType=a.responseType),d&&([x,f]=Xo(d,!0),b.addEventListener("progress",x)),c&&b.upload&&([h,m]=Xo(c),b.upload.addEventListener("progress",h),b.upload.addEventListener("loadend",m)),(a.cancelToken||a.signal)&&(u=v=>{b&&(r(!v||v.type?new ai(null,e,b):v),b.abort(),b=null)},a.cancelToken&&a.cancelToken.subscribe(u),a.signal&&(a.signal.aborted?u():a.signal.addEventListener("abort",u)));const y=YS(a.url);if(y&&Bt.protocols.indexOf(y)===-1){r(new Se("Unsupported protocol "+y+":",Se.ERR_BAD_REQUEST,e));return}b.send(i||null)})},o2=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,a;const i=function(d){if(!a){a=!0,o();const u=d instanceof Error?d:this.reason;r.abort(u instanceof Se?u:new ai(u instanceof Error?u.message:u))}};let l=t&&setTimeout(()=>{l=null,i(new Se(`timeout ${t} of ms exceeded`,Se.ETIMEDOUT))},t);const o=()=>{e&&(l&&clearTimeout(l),l=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),e=null)};e.forEach(d=>d.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>V.asap(o),c}},c2=function*(e,t){let n=e.byteLength;if(n{const a=d2(e,t);let i=0,l,o=c=>{l||(l=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await a.next();if(d){o(),c.close();return}let h=u.byteLength;if(n){let x=i+=h;n(x)}c.enqueue(new Uint8Array(u))}catch(d){throw o(d),d}},cancel(c){return o(c),a.return()}},{highWaterMark:2})},rx=64*1024,{isFunction:so}=V,m2=(({Request:e,Response:t})=>({Request:e,Response:t}))(V.global),{ReadableStream:ax,TextEncoder:ix}=V.global,lx=(e,...t)=>{try{return!!e(...t)}catch{return!1}},h2=e=>{e=V.merge.call({skipUndefined:!0},m2,e);const{fetch:t,Request:n,Response:r}=e,a=t?so(t):typeof fetch=="function",i=so(n),l=so(r);if(!a)return!1;const o=a&&so(ax),c=a&&(typeof ix=="function"?(f=>p=>f.encode(p))(new ix):async f=>new Uint8Array(await new n(f).arrayBuffer())),d=i&&o&&lx(()=>{let f=!1;const p=new n(Bt.origin,{body:new ax,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!p}),u=l&&o&&lx(()=>V.isReadableStream(new r("").body)),h={stream:u&&(f=>f.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!h[f]&&(h[f]=(p,b)=>{let g=p&&p[f];if(g)return g.call(p);throw new Se(`Response type '${f}' is not supported`,Se.ERR_NOT_SUPPORT,b)})});const x=async f=>{if(f==null)return 0;if(V.isBlob(f))return f.size;if(V.isSpecCompliantForm(f))return(await new n(Bt.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(V.isArrayBufferView(f)||V.isArrayBuffer(f))return f.byteLength;if(V.isURLSearchParams(f)&&(f=f+""),V.isString(f))return(await c(f)).byteLength},m=async(f,p)=>{const b=V.toFiniteNumber(f.getContentLength());return b??x(p)};return async f=>{let{url:p,method:b,data:g,signal:y,cancelToken:v,timeout:N,onDownloadProgress:E,onUploadProgress:P,responseType:I,headers:w,withCredentials:S="same-origin",fetchOptions:A}=mv(f),O=t||fetch;I=I?(I+"").toLowerCase():"text";let R=o2([y,v&&v.toAbortSignal()],N),q=null;const D=R&&R.unsubscribe&&(()=>{R.unsubscribe()});let z;try{if(P&&d&&b!=="get"&&b!=="head"&&(z=await m(w,g))!==0){let le=new n(p,{method:"POST",body:g,duplex:"half"}),de;if(V.isFormData(g)&&(de=le.headers.get("content-type"))&&w.setContentType(de),le.body){const[Ke,Ve]=ex(z,Xo(tx(P)));g=nx(le.body,rx,Ke,Ve)}}V.isString(S)||(S=S?"include":"omit");const k=i&&"credentials"in n.prototype,K={...A,signal:R,method:b.toUpperCase(),headers:w.normalize().toJSON(),body:g,duplex:"half",credentials:k?S:void 0};q=i&&new n(p,K);let B=await(i?O(q,A):O(p,K));const _=u&&(I==="stream"||I==="response");if(u&&(E||_&&D)){const le={};["status","statusText","headers"].forEach(st=>{le[st]=B[st]});const de=V.toFiniteNumber(B.headers.get("content-length")),[Ke,Ve]=E&&ex(de,Xo(tx(E),!0))||[];B=new r(nx(B.body,rx,Ke,()=>{Ve&&Ve(),D&&D()}),le)}I=I||"text";let Q=await h[V.findKey(h,I)||"text"](B,f);return!_&&D&&D(),await new Promise((le,de)=>{dv(le,de,{data:Q,headers:ms.from(B.headers),status:B.status,statusText:B.statusText,config:f,request:q})})}catch(k){throw D&&D(),k&&k.name==="TypeError"&&/Load failed|fetch/i.test(k.message)?Object.assign(new Se("Network Error",Se.ERR_NETWORK,f,q),{cause:k.cause||k}):Se.from(k,k&&k.code,f,q)}}},f2=new Map,hv=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:a}=t,i=[r,a,n];let l=i.length,o=l,c,d,u=f2;for(;o--;)c=i[o],d=u.get(c),d===void 0&&u.set(c,d=o?new Map:h2(t)),u=d;return d};hv();const lh={http:MS,xhr:l2,fetch:{get:hv}};V.forEach(lh,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ox=e=>`- ${e}`,p2=e=>V.isFunction(e)||e===null||e===!1;function x2(e,t){e=V.isArray(e)?e:[e];const{length:n}=e;let r,a;const i={};for(let l=0;l`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let o=n?l.length>1?`since : +`+l.map(ox).join(` +`):" "+ox(l[0]):"as no adapter specified";throw new Se("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return a}const fv={getAdapter:x2,adapters:lh};function pd(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ai(null,e)}function cx(e){return pd(e),e.headers=ms.from(e.headers),e.data=fd.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),fv.getAdapter(e.adapter||Pl.adapter,e)(e).then(function(r){return pd(e),r.data=fd.call(e,e.transformResponse,r),r.headers=ms.from(r.headers),r},function(r){return cv(r)||(pd(e),r&&r.response&&(r.response.data=fd.call(e,e.transformResponse,r.response),r.response.headers=ms.from(r.response.headers))),Promise.reject(r)})}const pv="1.13.2",Mc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Mc[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const dx={};Mc.transitional=function(t,n,r){function a(i,l){return"[Axios v"+pv+"] Transitional option '"+i+"'"+l+(r?". "+r:"")}return(i,l,o)=>{if(t===!1)throw new Se(a(l," has been removed"+(n?" in "+n:"")),Se.ERR_DEPRECATED);return n&&!dx[l]&&(dx[l]=!0,console.warn(a(l," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,l,o):!0}};Mc.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function g2(e,t,n){if(typeof e!="object")throw new Se("options must be an object",Se.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let a=r.length;for(;a-- >0;){const i=r[a],l=t[i];if(l){const o=e[i],c=o===void 0||l(o,i,e);if(c!==!0)throw new Se("option "+i+" must be "+c,Se.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Se("Unknown option "+i,Se.ERR_BAD_OPTION)}}const bo={assertOptions:g2,validators:Mc},Gs=bo.validators;let Br=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Xp,response:new Xp}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const i=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Jr(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:i}=n;r!==void 0&&bo.assertOptions(r,{silentJSONParsing:Gs.transitional(Gs.boolean),forcedJSONParsing:Gs.transitional(Gs.boolean),clarifyTimeoutError:Gs.transitional(Gs.boolean)},!1),a!=null&&(V.isFunction(a)?n.paramsSerializer={serialize:a}:bo.assertOptions(a,{encode:Gs.function,serialize:Gs.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),bo.assertOptions(n,{baseUrl:Gs.spelling("baseURL"),withXsrfToken:Gs.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&V.merge(i.common,i[n.method]);i&&V.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=ms.concat(l,i);const o=[];let c=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(n)===!1||(c=c&&p.synchronous,o.unshift(p.fulfilled,p.rejected))});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let u,h=0,x;if(!c){const f=[cx.bind(this),void 0];for(f.unshift(...o),f.push(...d),x=f.length,u=Promise.resolve(n);h{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](a);r._listeners=null}),this.promise.then=a=>{let i;const l=new Promise(o=>{r.subscribe(o),i=o}).then(a);return l.cancel=function(){r.unsubscribe(i)},l},t(function(i,l,o){r.reason||(r.reason=new ai(i,l,o),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new xv(function(a){t=a}),cancel:t}}};function v2(e){return function(n){return e.apply(null,n)}}function j2(e){return V.isObject(e)&&e.isAxiosError===!0}const Vu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Vu).forEach(([e,t])=>{Vu[t]=e});function gv(e){const t=new Br(e),n=W0(Br.prototype.request,t);return V.extend(n,Br.prototype,t,{allOwnKeys:!0}),V.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return gv(Jr(e,a))},n}const pt=gv(Pl);pt.Axios=Br;pt.CanceledError=ai;pt.CancelToken=y2;pt.isCancel=cv;pt.VERSION=pv;pt.toFormData=Pc;pt.AxiosError=Se;pt.Cancel=pt.CanceledError;pt.all=function(t){return Promise.all(t)};pt.spread=v2;pt.isAxiosError=j2;pt.mergeConfig=Jr;pt.AxiosHeaders=ms;pt.formToJSON=e=>ov(V.isHTMLForm(e)?new FormData(e):e);pt.getAdapter=fv.getAdapter;pt.HttpStatusCode=Vu;pt.default=pt;const{Axios:g4,AxiosError:y4,CanceledError:v4,isCancel:j4,CancelToken:b4,VERSION:N4,all:w4,Cancel:S4,isAxiosError:k4,spread:C4,toFormData:E4,AxiosHeaders:D4,HttpStatusCode:A4,formToJSON:P4,getAdapter:M4,mergeConfig:T4}=pt,$=pt.create({baseURL:"/api",headers:{"Content-Type":"application/json"}});$.interceptors.request.use(e=>{const t=localStorage.getItem("token");return t&&(e.headers.Authorization=`Bearer ${t}`),e});$.interceptors.response.use(e=>e,e=>{var a,i,l,o,c,d,u;const t=((i=(a=e.config)==null?void 0:a.url)==null?void 0:i.includes("/auth/login"))||((o=(l=e.config)==null?void 0:l.url)==null?void 0:o.includes("/auth/customer-login"));((c=e.response)==null?void 0:c.status)===401&&!t&&(localStorage.removeItem("token"),localStorage.removeItem("user"),window.location.href="/login");const n=((u=(d=e.response)==null?void 0:d.data)==null?void 0:u.error)||e.message||"Ein Fehler ist aufgetreten",r=new Error(n);return Promise.reject(r)});const no={login:async(e,t)=>(await $.post("/auth/login",{email:e,password:t})).data,customerLogin:async(e,t)=>(await $.post("/auth/customer-login",{email:e,password:t})).data,me:async()=>(await $.get("/auth/me")).data},At={getAll:async e=>(await $.get("/customers",{params:e})).data,getById:async e=>(await $.get(`/customers/${e}`)).data,create:async e=>(await $.post("/customers",e)).data,update:async(e,t)=>(await $.put(`/customers/${e}`,t)).data,delete:async e=>(await $.delete(`/customers/${e}`)).data,getPortalSettings:async e=>(await $.get(`/customers/${e}/portal`)).data,updatePortalSettings:async(e,t)=>(await $.put(`/customers/${e}/portal`,t)).data,setPortalPassword:async(e,t)=>(await $.post(`/customers/${e}/portal/password`,{password:t})).data,getPortalPassword:async e=>(await $.get(`/customers/${e}/portal/password`)).data,getRepresentatives:async e=>(await $.get(`/customers/${e}/representatives`)).data,addRepresentative:async(e,t,n)=>(await $.post(`/customers/${e}/representatives`,{representativeId:t,notes:n})).data,removeRepresentative:async(e,t)=>(await $.delete(`/customers/${e}/representatives/${t}`)).data,searchForRepresentative:async(e,t)=>(await $.get(`/customers/${e}/representatives/search`,{params:{search:t}})).data},Qu={getByCustomer:async e=>(await $.get(`/customers/${e}/addresses`)).data,create:async(e,t)=>(await $.post(`/customers/${e}/addresses`,t)).data,update:async(e,t)=>(await $.put(`/addresses/${e}`,t)).data,delete:async e=>(await $.delete(`/addresses/${e}`)).data},Yo={getByCustomer:async(e,t=!1)=>(await $.get(`/customers/${e}/bank-cards`,{params:{showInactive:t}})).data,create:async(e,t)=>(await $.post(`/customers/${e}/bank-cards`,t)).data,update:async(e,t)=>(await $.put(`/bank-cards/${e}`,t)).data,delete:async e=>(await $.delete(`/bank-cards/${e}`)).data},ec={getByCustomer:async(e,t=!1)=>(await $.get(`/customers/${e}/documents`,{params:{showInactive:t}})).data,create:async(e,t)=>(await $.post(`/customers/${e}/documents`,t)).data,update:async(e,t)=>(await $.put(`/documents/${e}`,t)).data,delete:async e=>(await $.delete(`/documents/${e}`)).data},ln={getByCustomer:async(e,t=!1)=>(await $.get(`/customers/${e}/meters`,{params:{showInactive:t}})).data,create:async(e,t)=>(await $.post(`/customers/${e}/meters`,t)).data,update:async(e,t)=>(await $.put(`/meters/${e}`,t)).data,delete:async e=>(await $.delete(`/meters/${e}`)).data,getReadings:async e=>(await $.get(`/meters/${e}/readings`)).data,addReading:async(e,t)=>(await $.post(`/meters/${e}/readings`,t)).data,updateReading:async(e,t,n)=>(await $.put(`/meters/${e}/readings/${t}`,n)).data,deleteReading:async(e,t)=>(await $.delete(`/meters/${e}/readings/${t}`)).data},aa={getInvoices:async e=>(await $.get(`/energy-details/${e}/invoices`)).data,addInvoice:async(e,t)=>(await $.post(`/energy-details/${e}/invoices`,t)).data,updateInvoice:async(e,t,n)=>(await $.put(`/energy-details/${e}/invoices/${t}`,n)).data,deleteInvoice:async(e,t)=>(await $.delete(`/energy-details/${e}/invoices/${t}`)).data,uploadDocument:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/invoices/${e}`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteDocument:async e=>(await $.delete(`/upload/invoices/${e}`)).data},xs={getByCustomer:async(e,t=!1)=>(await $.get(`/customers/${e}/stressfrei-emails`,{params:{includeInactive:t}})).data,create:async(e,t)=>(await $.post(`/customers/${e}/stressfrei-emails`,t)).data,update:async(e,t)=>(await $.put(`/stressfrei-emails/${e}`,t)).data,delete:async e=>(await $.delete(`/stressfrei-emails/${e}`)).data,enableMailbox:async e=>(await $.post(`/stressfrei-emails/${e}/enable-mailbox`)).data,syncMailboxStatus:async e=>(await $.post(`/stressfrei-emails/${e}/sync-mailbox-status`)).data,getMailboxCredentials:async e=>(await $.get(`/stressfrei-emails/${e}/credentials`)).data,resetPassword:async e=>(await $.post(`/stressfrei-emails/${e}/reset-password`)).data,syncEmails:async(e,t=!1)=>(await $.post(`/stressfrei-emails/${e}/sync`,{},{params:{full:t}})).data,sendEmail:async(e,t)=>(await $.post(`/stressfrei-emails/${e}/send`,t)).data,getFolderCounts:async e=>(await $.get(`/stressfrei-emails/${e}/folder-counts`)).data},Pe={getForCustomer:async(e,t)=>(await $.get(`/customers/${e}/emails`,{params:t})).data,getForContract:async(e,t)=>(await $.get(`/contracts/${e}/emails`,{params:t})).data,getContractFolderCounts:async e=>(await $.get(`/contracts/${e}/emails/folder-counts`)).data,getMailboxAccounts:async e=>(await $.get(`/customers/${e}/mailbox-accounts`)).data,getById:async e=>(await $.get(`/emails/${e}`)).data,getThread:async e=>(await $.get(`/emails/${e}/thread`)).data,markAsRead:async(e,t)=>(await $.patch(`/emails/${e}/read`,{isRead:t})).data,toggleStar:async e=>(await $.post(`/emails/${e}/star`)).data,assignToContract:async(e,t)=>(await $.post(`/emails/${e}/assign`,{contractId:t})).data,unassignFromContract:async e=>(await $.delete(`/emails/${e}/assign`)).data,delete:async e=>(await $.delete(`/emails/${e}`)).data,getAttachmentUrl:(e,t,n)=>{const r=localStorage.getItem("token"),a=encodeURIComponent(t),i=n?"&view=true":"";return`${$.defaults.baseURL}/emails/${e}/attachments/${a}?token=${r}${i}`},getUnreadCount:async e=>(await $.get("/emails/unread-count",{params:e})).data,getTrash:async e=>(await $.get(`/customers/${e}/emails/trash`)).data,getTrashCount:async e=>(await $.get(`/customers/${e}/emails/trash/count`)).data,restore:async e=>(await $.post(`/emails/${e}/restore`)).data,permanentDelete:async e=>(await $.delete(`/emails/${e}/permanent`)).data,getAttachmentTargets:async e=>(await $.get(`/emails/${e}/attachment-targets`)).data,saveAttachmentTo:async(e,t,n)=>{const r=encodeURIComponent(t);return(await $.post(`/emails/${e}/attachments/${r}/save-to`,n)).data},saveEmailAsPdf:async(e,t)=>(await $.post(`/emails/${e}/save-as-pdf`,t)).data,saveEmailAsInvoice:async(e,t)=>(await $.post(`/emails/${e}/save-as-invoice`,t)).data,saveAttachmentAsInvoice:async(e,t,n)=>{const r=encodeURIComponent(t);return(await $.post(`/emails/${e}/attachments/${r}/save-as-invoice`,n)).data}},Oe={getAll:async e=>(await $.get("/contracts",{params:e})).data,getTreeForCustomer:async e=>(await $.get("/contracts",{params:{customerId:e,tree:"true"}})).data,getById:async e=>(await $.get(`/contracts/${e}`)).data,create:async e=>(await $.post("/contracts",e)).data,update:async(e,t)=>(await $.put(`/contracts/${e}`,t)).data,delete:async e=>(await $.delete(`/contracts/${e}`)).data,createFollowUp:async e=>(await $.post(`/contracts/${e}/follow-up`)).data,getPassword:async e=>(await $.get(`/contracts/${e}/password`)).data,getSimCardCredentials:async e=>(await $.get(`/contracts/simcard/${e}/credentials`)).data,getInternetCredentials:async e=>(await $.get(`/contracts/${e}/internet-credentials`)).data,getSipCredentials:async e=>(await $.get(`/contracts/phonenumber/${e}/sip-credentials`)).data,getCockpit:async()=>(await $.get("/contracts/cockpit")).data,snooze:async(e,t)=>(await $.patch(`/contracts/${e}/snooze`,t)).data},tc={getByContract:async e=>(await $.get(`/contracts/${e}/history`)).data,create:async(e,t)=>(await $.post(`/contracts/${e}/history`,t)).data,update:async(e,t,n)=>(await $.put(`/contracts/${e}/history/${t}`,n)).data,delete:async(e,t)=>(await $.delete(`/contracts/${e}/history/${t}`)).data},et={getAll:async e=>(await $.get("/tasks",{params:e})).data,getStats:async()=>(await $.get("/tasks/stats")).data,getByContract:async(e,t)=>(await $.get(`/contracts/${e}/tasks`,{params:{status:t}})).data,create:async(e,t)=>(await $.post(`/contracts/${e}/tasks`,t)).data,update:async(e,t)=>(await $.put(`/tasks/${e}`,t)).data,complete:async e=>(await $.post(`/tasks/${e}/complete`)).data,reopen:async e=>(await $.post(`/tasks/${e}/reopen`)).data,delete:async e=>(await $.delete(`/tasks/${e}`)).data,createSubtask:async(e,t)=>(await $.post(`/tasks/${e}/subtasks`,{title:t})).data,createReply:async(e,t)=>(await $.post(`/tasks/${e}/reply`,{title:t})).data,updateSubtask:async(e,t)=>(await $.put(`/subtasks/${e}`,{title:t})).data,completeSubtask:async e=>(await $.post(`/subtasks/${e}/complete`)).data,reopenSubtask:async e=>(await $.post(`/subtasks/${e}/reopen`)).data,deleteSubtask:async e=>(await $.delete(`/subtasks/${e}`)).data,createSupportTicket:async(e,t)=>(await $.post(`/contracts/${e}/support-ticket`,t)).data},Xr={getPublic:async()=>(await $.get("/settings/public")).data,getAll:async()=>(await $.get("/settings")).data,update:async e=>(await $.put("/settings",e)).data,updateOne:async(e,t)=>(await $.put(`/settings/${e}`,{value:t})).data},br={list:async()=>(await $.get("/settings/backups")).data,create:async()=>(await $.post("/settings/backup")).data,restore:async e=>(await $.post(`/settings/backup/${e}/restore`)).data,delete:async e=>(await $.delete(`/settings/backup/${e}`)).data,getDownloadUrl:e=>`/api/settings/backup/${e}/download`,upload:async e=>{const t=new FormData;return t.append("backup",e),(await $.post("/settings/backup/upload",t,{headers:{"Content-Type":"multipart/form-data"}})).data},factoryReset:async()=>(await $.post("/settings/factory-reset")).data},il={getAll:async(e=!1)=>(await $.get("/platforms",{params:{includeInactive:e}})).data,getById:async e=>(await $.get(`/platforms/${e}`)).data,create:async e=>(await $.post("/platforms",e)).data,update:async(e,t)=>(await $.put(`/platforms/${e}`,t)).data,delete:async e=>(await $.delete(`/platforms/${e}`)).data},ll={getAll:async(e=!1)=>(await $.get("/cancellation-periods",{params:{includeInactive:e}})).data,getById:async e=>(await $.get(`/cancellation-periods/${e}`)).data,create:async e=>(await $.post("/cancellation-periods",e)).data,update:async(e,t)=>(await $.put(`/cancellation-periods/${e}`,t)).data,delete:async e=>(await $.delete(`/cancellation-periods/${e}`)).data},ol={getAll:async(e=!1)=>(await $.get("/contract-durations",{params:{includeInactive:e}})).data,getById:async e=>(await $.get(`/contract-durations/${e}`)).data,create:async e=>(await $.post("/contract-durations",e)).data,update:async(e,t)=>(await $.put(`/contract-durations/${e}`,t)).data,delete:async e=>(await $.delete(`/contract-durations/${e}`)).data},cl={getAll:async(e=!1)=>(await $.get("/contract-categories",{params:{includeInactive:e}})).data,getById:async e=>(await $.get(`/contract-categories/${e}`)).data,create:async e=>(await $.post("/contract-categories",e)).data,update:async(e,t)=>(await $.put(`/contract-categories/${e}`,t)).data,delete:async e=>(await $.delete(`/contract-categories/${e}`)).data},Xa={getAll:async(e=!1)=>(await $.get("/providers",{params:{includeInactive:e}})).data,getById:async e=>(await $.get(`/providers/${e}`)).data,create:async e=>(await $.post("/providers",e)).data,update:async(e,t)=>(await $.put(`/providers/${e}`,t)).data,delete:async e=>(await $.delete(`/providers/${e}`)).data,getTariffs:async(e,t=!1)=>(await $.get(`/providers/${e}/tariffs`,{params:{includeInactive:t}})).data,createTariff:async(e,t)=>(await $.post(`/providers/${e}/tariffs`,t)).data},yv={getById:async e=>(await $.get(`/tariffs/${e}`)).data,update:async(e,t)=>(await $.put(`/tariffs/${e}`,t)).data,delete:async e=>(await $.delete(`/tariffs/${e}`)).data},ut={uploadBankCardDocument:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/bank-cards/${e}`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},uploadIdentityDocument:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/documents/${e}`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteBankCardDocument:async e=>(await $.delete(`/upload/bank-cards/${e}`)).data,deleteIdentityDocument:async e=>(await $.delete(`/upload/documents/${e}`)).data,uploadBusinessRegistration:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/customers/${e}/business-registration`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteBusinessRegistration:async e=>(await $.delete(`/upload/customers/${e}/business-registration`)).data,uploadCommercialRegister:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/customers/${e}/commercial-register`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteCommercialRegister:async e=>(await $.delete(`/upload/customers/${e}/commercial-register`)).data,uploadPrivacyPolicy:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/customers/${e}/privacy-policy`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deletePrivacyPolicy:async e=>(await $.delete(`/upload/customers/${e}/privacy-policy`)).data,uploadCancellationLetter:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/contracts/${e}/cancellation-letter`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteCancellationLetter:async e=>(await $.delete(`/upload/contracts/${e}/cancellation-letter`)).data,uploadCancellationConfirmation:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/contracts/${e}/cancellation-confirmation`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteCancellationConfirmation:async e=>(await $.delete(`/upload/contracts/${e}/cancellation-confirmation`)).data,uploadCancellationLetterOptions:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/contracts/${e}/cancellation-letter-options`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteCancellationLetterOptions:async e=>(await $.delete(`/upload/contracts/${e}/cancellation-letter-options`)).data,uploadCancellationConfirmationOptions:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/contracts/${e}/cancellation-confirmation-options`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteCancellationConfirmationOptions:async e=>(await $.delete(`/upload/contracts/${e}/cancellation-confirmation-options`)).data},Li={getAll:async e=>(await $.get("/users",{params:e})).data,getById:async e=>(await $.get(`/users/${e}`)).data,create:async e=>(await $.post("/users",e)).data,update:async(e,t)=>(await $.put(`/users/${e}`,t)).data,delete:async e=>(await $.delete(`/users/${e}`)).data,getRoles:async()=>(await $.get("/users/roles/list")).data},Ci={getSchema:async()=>(await $.get("/developer/schema")).data,getTableData:async(e,t=1,n=50)=>(await $.get(`/developer/table/${e}`,{params:{page:t,limit:n}})).data,updateRow:async(e,t,n)=>(await $.put(`/developer/table/${e}/${t}`,n)).data,deleteRow:async(e,t)=>(await $.delete(`/developer/table/${e}/${t}`)).data,getReference:async e=>(await $.get(`/developer/reference/${e}`)).data},yn={getConfigs:async()=>(await $.get("/email-providers/configs")).data,getConfig:async e=>(await $.get(`/email-providers/configs/${e}`)).data,createConfig:async e=>(await $.post("/email-providers/configs",e)).data,updateConfig:async(e,t)=>(await $.put(`/email-providers/configs/${e}`,t)).data,deleteConfig:async e=>(await $.delete(`/email-providers/configs/${e}`)).data,testConnection:async e=>{const t=e!=null&&e.testData?{...e.testData}:e!=null&&e.id?{id:e.id}:{};return(await $.post("/email-providers/test-connection",t)).data},getDomain:async()=>(await $.get("/email-providers/domain")).data,checkEmailExists:async e=>(await $.get(`/email-providers/check/${e}`)).data,provisionEmail:async(e,t)=>(await $.post("/email-providers/provision",{localPart:e,customerEmail:t})).data,deprovisionEmail:async e=>(await $.delete(`/email-providers/deprovision/${e}`)).data},vv=j.createContext(null);function b2({children:e}){const[t,n]=j.useState(null),[r,a]=j.useState(!0),[i,l]=j.useState(()=>localStorage.getItem("developerMode")==="true"),o=p=>{l(p),localStorage.setItem("developerMode",String(p))};j.useEffect(()=>{var p;console.log("useEffect check - user:",t==null?void 0:t.email,"developerMode:",i,"has developer:access:",(p=t==null?void 0:t.permissions)==null?void 0:p.includes("developer:access")),t&&i&&!t.permissions.includes("developer:access")&&(console.log("Disabling developer mode because user lacks developer:access permission"),o(!1))},[t,i]),j.useEffect(()=>{localStorage.getItem("token")?no.me().then(b=>{b.success&&b.data?n(b.data):localStorage.removeItem("token")}).catch(()=>{localStorage.removeItem("token")}).finally(()=>{a(!1)}):a(!1)},[]);const c=async(p,b)=>{const g=await no.login(p,b);if(g.success&&g.data)localStorage.setItem("token",g.data.token),n(g.data.user);else throw new Error(g.error||"Login fehlgeschlagen")},d=async(p,b)=>{const g=await no.customerLogin(p,b);if(g.success&&g.data)localStorage.setItem("token",g.data.token),n(g.data.user);else throw new Error(g.error||"Login fehlgeschlagen")},u=()=>{localStorage.removeItem("token"),n(null)},h=async()=>{var b;if(localStorage.getItem("token"))try{const g=await no.me();console.log("refreshUser response:",g),console.log("permissions:",(b=g.data)==null?void 0:b.permissions),g.success&&g.data&&n(g.data)}catch(g){console.error("refreshUser error:",g)}},x=p=>t?t.permissions.includes(p):!1,m=!!(t!=null&&t.customerId),f=!!(t!=null&&t.isCustomerPortal);return s.jsx(vv.Provider,{value:{user:t,isLoading:r,isAuthenticated:!!t,login:c,customerLogin:d,logout:u,hasPermission:x,isCustomer:m,isCustomerPortal:f,developerMode:i,setDeveloperMode:o,refreshUser:h},children:e})}function We(){const e=j.useContext(vv);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const xd={scrollToTopThreshold:.7},jv=j.createContext(void 0),ux="opencrm_app_settings";function N2({children:e}){const[t,n]=j.useState(()=>{const a=localStorage.getItem(ux);if(a)try{return{...xd,...JSON.parse(a)}}catch{return xd}return xd});j.useEffect(()=>{localStorage.setItem(ux,JSON.stringify(t))},[t]);const r=a=>{n(i=>({...i,...a}))};return s.jsx(jv.Provider,{value:{settings:t,updateSettings:r},children:e})}function bv(){const e=j.useContext(jv);if(!e)throw new Error("useAppSettings must be used within AppSettingsProvider");return e}function w2(){const{pathname:e}=Rn();return j.useEffect(()=>{window.scrollTo(0,0)},[e]),null}/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const S2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Nv=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var k2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C2=j.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:l,...o},c)=>j.createElement("svg",{ref:c,...k2,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Nv("lucide",a),...o},[...l.map(([d,u])=>j.createElement(d,u)),...Array.isArray(i)?i:[i]]));/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ne=(e,t)=>{const n=j.forwardRef(({className:r,...a},i)=>j.createElement(C2,{ref:i,iconNode:t,className:Nv(`lucide-${S2(e)}`,r),...a}));return n.displayName=`${e}`,n};/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E2=ne("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vs=ne("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wv=ne("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Sv=ne("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const D2=ne("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const A2=ne("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const P2=ne("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M2=ne("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kv=ne("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Cv=ne("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xr=ne("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dn=ne("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const T2=ne("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ft=ne("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Tc=ne("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kn=ne("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const As=ne("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mx=ne("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const No=ne("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dl=ne("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const on=ne("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Fc=ne("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oh=ne("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ch=ne("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ic=ne("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ps=ne("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dh=ne("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const It=ne("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ae=ne("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const F2=ne("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Be=ne("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const I2=ne("FileType",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ev=ne("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const R2=ne("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Dv=ne("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hx=ne("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uh=ne("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const L2=ne("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fx=ne("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const O2=ne("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Av=ne("IdCard",[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ur=ne("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ml=ne("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z2=ne("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $2=ne("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const px=ne("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _2=ne("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Pv=ne("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nn=ne("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const K2=ne("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const B2=ne("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ul=ne("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const U2=ne("Move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const q2=ne("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Rc=ne("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _e=ne("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mh=ne("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Sr=ne("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const V2=ne("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hh=ne("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Mv=ne("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Tl=ne("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Fl=ne("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Tv=ne("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fh=ne("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const He=ne("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ph=ne("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q2=ne("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const H2=ne("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ne=ne("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hs=ne("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Fv=ne("Tv",[["rect",{width:"20",height:"15",x:"2",y:"7",rx:"2",ry:"2",key:"10ag99"}],["polyline",{points:"17 2 12 7 7 2",key:"11pgbg"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Iv=ne("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Hu=ne("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W2=ne("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G2=ne("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ii=ne("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ca=ne("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xx=ne("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ea=ne("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qt=ne("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xh=ne("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Z2=ne("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const J2=ne("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function X2(){const{user:e,logout:t,hasPermission:n,isCustomer:r,developerMode:a}=We(),i=[{to:"/",icon:$2,label:"Dashboard",show:!0,end:!0},{to:"/customers",icon:Ca,label:"Kunden",show:n("customers:read")&&!r},{to:"/contracts",icon:Be,label:"Verträge",show:n("contracts:read"),end:!0},{to:"/contracts/cockpit",icon:kn,label:"Vertrags-Cockpit",show:n("contracts:read")&&!r},{to:"/tasks",icon:r?ul:dl,label:r?"Support-Anfragen":"Aufgaben",show:n("contracts:read")}],l=[{to:"/developer/database",icon:Ic,label:"Datenbankstruktur"}];return s.jsxs("aside",{className:"w-64 bg-gray-900 text-white min-h-screen flex flex-col",children:[s.jsx("div",{className:"p-4 border-b border-gray-800",children:s.jsx("h1",{className:"text-xl font-bold",children:"OpenCRM"})}),s.jsxs("nav",{className:"flex-1 p-4 overflow-y-auto",children:[s.jsx("ul",{className:"space-y-2",children:i.filter(o=>o.show).map(o=>s.jsx("li",{children:s.jsxs(md,{to:o.to,end:o.end,className:({isActive:c})=>`flex items-center gap-3 px-4 py-2 rounded-lg transition-colors ${c?"bg-blue-600 text-white":"text-gray-300 hover:bg-gray-800"}`,children:[s.jsx(o.icon,{className:"w-5 h-5"}),o.label]})},o.to))}),a&&n("developer:access")&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mt-6 mb-2 px-4",children:s.jsxs("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider flex items-center gap-2",children:[s.jsx(Fc,{className:"w-3 h-3"}),"Entwickler"]})}),s.jsx("ul",{className:"space-y-2",children:l.map(o=>s.jsx("li",{children:s.jsxs(md,{to:o.to,className:({isActive:c})=>`flex items-center gap-3 px-4 py-2 rounded-lg transition-colors ${c?"bg-purple-600 text-white":"text-purple-300 hover:bg-gray-800"}`,children:[s.jsx(o.icon,{className:"w-5 h-5"}),o.label]})},o.to))})]}),s.jsx("div",{className:"mt-6 pt-6 border-t border-gray-800",children:s.jsxs(md,{to:"/settings",className:({isActive:o})=>`flex items-center gap-3 px-4 py-2 rounded-lg transition-colors ${o?"bg-blue-600 text-white":"text-gray-300 hover:bg-gray-800"}`,children:[s.jsx(Tv,{className:"w-5 h-5"}),"Einstellungen"]})})]}),s.jsxs("div",{className:"p-4 border-t border-gray-800",children:[s.jsxs("div",{className:"mb-4 text-sm",children:[s.jsx("p",{className:"text-gray-400",children:"Angemeldet als"}),s.jsxs("p",{className:"font-medium",children:[e==null?void 0:e.firstName," ",e==null?void 0:e.lastName]})]}),s.jsxs("button",{onClick:t,className:"flex items-center gap-3 w-full px-4 py-2 text-gray-300 hover:bg-gray-800 rounded-lg transition-colors",children:[s.jsx(_2,{className:"w-5 h-5"}),"Abmelden"]})]})]})}function Y2(){const{settings:e}=bv(),[t,n]=j.useState(!1);j.useEffect(()=>{const a=()=>{window.scrollY>window.innerHeight*e.scrollToTopThreshold?n(!0):n(!1)};return window.addEventListener("scroll",a),()=>window.removeEventListener("scroll",a)},[e.scrollToTopThreshold]);const r=()=>{window.scrollTo({top:0,behavior:"smooth"})};return t?s.jsx("button",{onClick:r,className:"fixed bottom-6 right-6 p-3 bg-gray-200 hover:bg-gray-300 text-gray-600 rounded-full shadow-md transition-all duration-300 opacity-70 hover:opacity-100 z-50","aria-label":"Nach oben scrollen",title:"Nach oben",children:s.jsx(Tc,{className:"w-5 h-5"})}):null}function ek(){return s.jsxs("div",{className:"flex min-h-screen",children:[s.jsx(X2,{}),s.jsx("main",{className:"flex-1 p-8 overflow-auto",children:s.jsx(uw,{})}),s.jsx(Y2,{})]})}const T=j.forwardRef(({className:e="",variant:t="primary",size:n="md",children:r,disabled:a,...i},l)=>{const o="inline-flex items-center justify-center font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",c={primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-gray-200 text-gray-900 hover:bg-gray-300 focus:ring-gray-500",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",ghost:"bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-500"},d={sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"};return s.jsx("button",{ref:l,className:`${o} ${c[t]} ${d[n]} ${e}`,disabled:a,...i,children:r})});T.displayName="Button";const H=j.forwardRef(({className:e="",label:t,error:n,id:r,onClear:a,...i},l)=>{const o=r||i.name,c=i.type==="date",d=i.value!==void 0&&i.value!==null&&i.value!=="",u=c&&a&&d;return s.jsxs("div",{className:"w-full",children:[t&&s.jsx("label",{htmlFor:o,className:"block text-sm font-medium text-gray-700 mb-1",children:t}),s.jsxs("div",{className:u?"flex gap-2":"",children:[s.jsx("input",{ref:l,id:o,className:`block w-full px-3 py-2 border rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${n?"border-red-500":"border-gray-300"} ${e}`,...i}),u&&s.jsx("button",{type:"button",onClick:a,className:"px-3 py-2 text-gray-400 hover:text-red-500 hover:bg-red-50 border border-gray-300 rounded-lg transition-colors",title:"Datum löschen",children:s.jsx(Ne,{className:"w-4 h-4"})})]}),n&&s.jsx("p",{className:"mt-1 text-sm text-red-600",children:n})]})});H.displayName="Input";function X({children:e,className:t="",title:n,actions:r}){return s.jsxs("div",{className:`bg-white rounded-lg shadow ${t}`,children:[(n||r)&&s.jsxs("div",{className:"px-6 py-4 border-b border-gray-200 flex items-center justify-between",children:[n&&s.jsx("div",{className:"text-lg font-medium text-gray-900",children:n}),r&&s.jsx("div",{className:"flex items-center gap-2",children:r})]}),s.jsx("div",{className:"p-6",children:e})]})}function tk(){const[e,t]=j.useState(""),[n,r]=j.useState(""),[a,i]=j.useState(""),[l,o]=j.useState(!1),{login:c,customerLogin:d}=We(),u=Yt(),h=async x=>{x.preventDefault(),i(""),o(!0);try{await c(e,n),u("/");return}catch{}try{await d(e,n),u("/")}catch{i("Ungültige Anmeldedaten"),o(!1)}};return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:s.jsxs(X,{className:"w-full max-w-md",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"OpenCRM"}),s.jsx("p",{className:"text-gray-600 mt-2",children:"Melden Sie sich an"})]}),a&&s.jsx("div",{className:"mb-4 p-4 bg-red-50 border border-red-200 text-red-700 rounded-lg",children:a}),s.jsxs("form",{onSubmit:h,className:"space-y-4",children:[s.jsx(H,{label:"E-Mail",type:"email",value:e,onChange:x=>t(x.target.value),required:!0,autoComplete:"email"}),s.jsx(H,{label:"Passwort",type:"password",value:n,onChange:x=>r(x.target.value),required:!0,autoComplete:"current-password"}),s.jsx(T,{type:"submit",className:"w-full",disabled:l,children:l?"Anmeldung...":"Anmelden"})]})]})})}function qe({isOpen:e,onClose:t,title:n,children:r,size:a="md"}){if(j.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),!e)return null;const i={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"};return s.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:s.jsxs("div",{className:"flex min-h-full items-center justify-center p-4",children:[s.jsx("div",{className:"fixed inset-0 bg-black/50",onClick:t}),s.jsxs("div",{className:`relative bg-white rounded-lg shadow-xl w-full ${i[a]}`,children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b",children:[s.jsx("h2",{className:"text-lg font-semibold",children:n}),s.jsx(T,{variant:"ghost",size:"sm",onClick:t,children:s.jsx(qt,{className:"w-5 h-5"})})]}),s.jsx("div",{className:"p-6",children:r})]})]})})}function sk(){var w,S,A,O,R,q;const{user:e,isCustomer:t,isCustomerPortal:n}=We(),[r,a]=j.useState(!1),{data:i,isLoading:l}=fe({queryKey:["app-settings-public"],queryFn:()=>Xr.getPublic(),enabled:n,staleTime:0}),o=!l&&((w=i==null?void 0:i.data)==null?void 0:w.customerSupportTicketsEnabled)==="true",{data:c}=fe({queryKey:["customers-count"],queryFn:()=>At.getAll({limit:1}),enabled:!t}),{data:d}=fe({queryKey:["contracts",t?e==null?void 0:e.customerId:void 0],queryFn:()=>Oe.getAll(t?{customerId:e==null?void 0:e.customerId}:{limit:1})}),{data:u}=fe({queryKey:["contracts-active",t?e==null?void 0:e.customerId:void 0],queryFn:()=>Oe.getAll({status:"ACTIVE",...t?{customerId:e==null?void 0:e.customerId}:{limit:1}})}),{data:h}=fe({queryKey:["contracts-pending",t?e==null?void 0:e.customerId:void 0],queryFn:()=>Oe.getAll({status:"PENDING",...t?{customerId:e==null?void 0:e.customerId}:{limit:1}})}),{data:x}=fe({queryKey:["task-stats"],queryFn:()=>et.getStats()}),{data:m}=fe({queryKey:["contract-cockpit"],queryFn:()=>Oe.getCockpit(),enabled:!t,staleTime:0}),{ownContracts:f,representedContracts:p}=j.useMemo(()=>{if(!n||!(d!=null&&d.data))return{ownContracts:[],representedContracts:[]};const D=[],z={};for(const k of d.data)if(k.customerId===(e==null?void 0:e.customerId))D.push(k);else{const K=k.customerId;if(!z[K]){const B=k.customer?k.customer.companyName||`${k.customer.firstName} ${k.customer.lastName}`:`Kunde ${K}`;z[K]={customerName:B,contracts:[]}}z[K].contracts.push(k)}return{ownContracts:D,representedContracts:Object.values(z).sort((k,K)=>k.customerName.localeCompare(K.customerName))}},[d==null?void 0:d.data,n,e==null?void 0:e.customerId]),b=j.useMemo(()=>f.filter(D=>D.status==="ACTIVE").length,[f]),g=j.useMemo(()=>f.filter(D=>D.status==="PENDING").length,[f]),y=j.useMemo(()=>f.filter(D=>D.status==="EXPIRED").length,[f]),v=j.useMemo(()=>p.reduce((D,z)=>D+z.contracts.length,0),[p]),N=j.useMemo(()=>p.reduce((D,z)=>D+z.contracts.filter(k=>k.status==="ACTIVE").length,0),[p]),E=j.useMemo(()=>p.reduce((D,z)=>D+z.contracts.filter(k=>k.status==="EXPIRED").length,0),[p]),P=((S=x==null?void 0:x.data)==null?void 0:S.openCount)||0,I=D=>s.jsx(X,{className:D.link?"cursor-pointer hover:shadow-md transition-shadow":"",children:D.link?s.jsx(ke,{to:D.link,className:"block",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:`p-3 rounded-lg ${D.color}`,children:s.jsx(D.icon,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"ml-4",children:[s.jsx("p",{className:"text-sm text-gray-500",children:D.label}),s.jsx("p",{className:"text-2xl font-bold",children:D.value})]})]})}):s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:`p-3 rounded-lg ${D.color}`,children:s.jsx(D.icon,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"ml-4",children:[s.jsx("p",{className:"text-sm text-gray-500",children:D.label}),s.jsx("p",{className:"text-2xl font-bold",children:D.value})]})]})},D.label);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("h1",{className:"text-2xl font-bold",children:["Willkommen, ",e==null?void 0:e.firstName,"!"]}),n&&o&&s.jsxs(T,{onClick:()=>a(!0),children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Support-Anfrage"]})]}),n?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(ii,{className:"w-5 h-5 text-blue-600"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Meine Verträge"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[I({label:"Eigene Verträge",value:f.length,icon:Be,color:"bg-blue-500",link:"/contracts"}),I({label:"Davon aktiv",value:b,icon:As,color:"bg-green-500"}),I({label:"Davon ausstehend",value:g,icon:on,color:"bg-yellow-500"}),I({label:"Davon abgelaufen",value:y,icon:mx,color:"bg-red-500"})]})]}),v>0&&s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Ca,{className:"w-5 h-5 text-purple-600"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Fremdverträge"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[I({label:"Fremdverträge",value:v,icon:Ca,color:"bg-purple-500",link:"/contracts"}),I({label:"Davon aktiv",value:N,icon:As,color:"bg-green-500"}),s.jsx("div",{className:"hidden lg:block"}),I({label:"Davon abgelaufen",value:E,icon:mx,color:"bg-red-500"})]})]}),s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(ul,{className:"w-5 h-5 text-orange-600"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Support-Anfragen"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:I({label:"Offene Anfragen",value:P,icon:ul,color:"bg-orange-500",link:"/tasks"})})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6",children:[I({label:"Kunden",value:((A=c==null?void 0:c.pagination)==null?void 0:A.total)||0,icon:Ca,color:"bg-blue-500",link:"/customers"}),I({label:"Verträge gesamt",value:((O=d==null?void 0:d.pagination)==null?void 0:O.total)||0,icon:Be,color:"bg-purple-500",link:"/contracts"}),I({label:"Aktive Verträge",value:((R=u==null?void 0:u.pagination)==null?void 0:R.total)||0,icon:As,color:"bg-green-500"}),I({label:"Ausstehende Verträge",value:((q=h==null?void 0:h.pagination)==null?void 0:q.total)||0,icon:kn,color:"bg-yellow-500"})]}),(m==null?void 0:m.data)&&s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(kn,{className:"w-5 h-5 text-red-500"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Vertrags-Cockpit"})]}),s.jsx(ke,{to:"/contracts/cockpit",className:"text-sm text-blue-600 hover:underline",children:"Alle anzeigen"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsx(X,{className:"cursor-pointer hover:shadow-md transition-shadow",children:s.jsx(ke,{to:"/contracts/cockpit?filter=critical",className:"block",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"p-3 rounded-lg bg-red-100",children:s.jsx(kn,{className:"w-6 h-6 text-red-500"})}),s.jsxs("div",{className:"ml-4",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["Kritisch (<",m.data.thresholds.criticalDays," Tage)"]}),s.jsx("p",{className:"text-2xl font-bold text-red-600",children:m.data.summary.criticalCount})]})]})})}),s.jsx(X,{className:"cursor-pointer hover:shadow-md transition-shadow",children:s.jsx(ke,{to:"/contracts/cockpit?filter=warning",className:"block",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"p-3 rounded-lg bg-yellow-100",children:s.jsx(hs,{className:"w-6 h-6 text-yellow-500"})}),s.jsxs("div",{className:"ml-4",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["Warnung (<",m.data.thresholds.warningDays," Tage)"]}),s.jsx("p",{className:"text-2xl font-bold text-yellow-600",children:m.data.summary.warningCount})]})]})})}),s.jsx(X,{className:"cursor-pointer hover:shadow-md transition-shadow",children:s.jsx(ke,{to:"/contracts/cockpit?filter=ok",className:"block",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"p-3 rounded-lg bg-green-100",children:s.jsx(As,{className:"w-6 h-6 text-green-500"})}),s.jsxs("div",{className:"ml-4",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["OK (<",m.data.thresholds.okDays," Tage)"]}),s.jsx("p",{className:"text-2xl font-bold text-green-600",children:m.data.summary.okCount})]})]})})}),s.jsx(X,{className:"cursor-pointer hover:shadow-md transition-shadow",children:s.jsx(ke,{to:"/contracts/cockpit",className:"block",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"p-3 rounded-lg bg-gray-100",children:s.jsx(Be,{className:"w-6 h-6 text-gray-500"})}),s.jsxs("div",{className:"ml-4",children:[s.jsx("p",{className:"text-sm text-gray-500",children:"Handlungsbedarf"}),s.jsx("p",{className:"text-2xl font-bold text-gray-600",children:m.data.summary.totalContracts})]})]})})})]})]}),s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(dl,{className:"w-5 h-5 text-orange-600"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Aufgaben"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:I({label:"Offene Aufgaben",value:P,icon:dl,color:"bg-orange-500",link:"/tasks"})})]})]}),n&&s.jsx(nk,{isOpen:r,onClose:()=>a(!1)})]})}function nk({isOpen:e,onClose:t}){const{user:n}=We(),r=Yt(),a=ge(),[i,l]=j.useState("own"),[o,c]=j.useState(null),[d,u]=j.useState(""),[h,x]=j.useState(""),[m,f]=j.useState(!1),[p,b]=j.useState(""),{data:g}=fe({queryKey:["contracts",n==null?void 0:n.customerId],queryFn:()=>Oe.getAll({customerId:n==null?void 0:n.customerId}),enabled:e}),y=j.useMemo(()=>{if(!(g!=null&&g.data))return{own:[],represented:{}};const w=[],S={};for(const A of g.data)if(A.customerId===(n==null?void 0:n.customerId))w.push(A);else{if(!S[A.customerId]){const O=A.customer?A.customer.companyName||`${A.customer.firstName} ${A.customer.lastName}`:`Kunde ${A.customerId}`;S[A.customerId]={name:O,contracts:[]}}S[A.customerId].contracts.push(A)}return{own:w,represented:S}},[g==null?void 0:g.data,n==null?void 0:n.customerId]),v=Object.keys(y.represented).length>0,N=j.useMemo(()=>{var w;return i==="own"?y.own:((w=y.represented[i])==null?void 0:w.contracts)||[]},[i,y]),E=j.useMemo(()=>{if(!p)return N;const w=p.toLowerCase();return N.filter(S=>S.contractNumber.toLowerCase().includes(w)||(S.providerName||"").toLowerCase().includes(w)||(S.tariffName||"").toLowerCase().includes(w))},[N,p]),P=async()=>{if(!(!o||!d.trim())){f(!0);try{await et.createSupportTicket(o,{title:d.trim(),description:h.trim()||void 0}),a.invalidateQueries({queryKey:["task-stats"]}),a.invalidateQueries({queryKey:["all-tasks"]}),t(),u(""),x(""),c(null),l("own"),r(`/contracts/${o}`)}catch(w){console.error("Fehler beim Erstellen der Support-Anfrage:",w),alert("Fehler beim Erstellen der Support-Anfrage. Bitte versuchen Sie es erneut.")}finally{f(!1)}}},I=()=>{u(""),x(""),c(null),l("own"),b(""),t()};return s.jsx(qe,{isOpen:e,onClose:I,title:"Neue Support-Anfrage",children:s.jsxs("div",{className:"space-y-4",children:[v&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Kunde"}),s.jsxs("select",{value:i,onChange:w=>{const S=w.target.value;l(S==="own"?"own":parseInt(S)),c(null),b("")},className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:[s.jsx("option",{value:"own",children:"Eigene Verträge"}),Object.entries(y.represented).map(([w,{name:S}])=>s.jsx("option",{value:w,children:S},w))]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Vertrag *"}),s.jsx(H,{placeholder:"Vertrag suchen...",value:p,onChange:w=>b(w.target.value),className:"mb-2"}),s.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-lg",children:E.length>0?E.map(w=>s.jsxs("div",{onClick:()=>c(w.id),className:`p-3 cursor-pointer border-b last:border-b-0 hover:bg-gray-50 ${o===w.id?"bg-blue-50 border-blue-200":""}`,children:[s.jsx("div",{className:"font-medium",children:w.contractNumber}),s.jsxs("div",{className:"text-sm text-gray-500",children:[w.providerName||"Kein Anbieter",w.tariffName&&` - ${w.tariffName}`]})]},w.id)):s.jsx("div",{className:"p-3 text-gray-500 text-center",children:"Keine Verträge gefunden."})})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Titel *"}),s.jsx(H,{value:d,onChange:w=>u(w.target.value),placeholder:"Kurze Beschreibung Ihres Anliegens"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Beschreibung"}),s.jsx("textarea",{value:h,onChange:w=>x(w.target.value),placeholder:"Detaillierte Beschreibung (optional)",rows:4,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:I,children:"Abbrechen"}),s.jsx(T,{onClick:P,disabled:!o||!d.trim()||m,children:m?"Wird erstellt...":"Anfrage erstellen"})]})]})})}function ve({children:e,variant:t="default",className:n="",onClick:r}){const a={default:"bg-gray-100 text-gray-800",success:"bg-green-100 text-green-800",warning:"bg-yellow-100 text-yellow-800",danger:"bg-red-100 text-red-800",info:"bg-blue-100 text-blue-800"};return s.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${a[t]} ${n}`,onClick:r,children:e})}function rk(){const[e,t]=j.useState(""),[n,r]=j.useState(""),[a,i]=j.useState(1),{hasPermission:l}=We(),{data:o,isLoading:c}=fe({queryKey:["customers",e,n,a],queryFn:()=>At.getAll({search:e,type:n||void 0,page:a,limit:20})});return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Kunden"}),l("customers:create")&&s.jsx(ke,{to:"/customers/new",children:s.jsxs(T,{children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Neuer Kunde"]})})]}),s.jsx(X,{className:"mb-6",children:s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx(H,{placeholder:"Suchen...",value:e,onChange:d=>t(d.target.value),className:"flex-1"}),s.jsxs("select",{value:n,onChange:d=>r(d.target.value),className:"px-3 py-2 border border-gray-300 rounded-lg w-28 flex-shrink-0",children:[s.jsx("option",{value:"",children:"Alle"}),s.jsx("option",{value:"PRIVATE",children:"Privat"}),s.jsx("option",{value:"BUSINESS",children:"Firma"})]}),s.jsx(T,{variant:"secondary",className:"flex-shrink-0",children:s.jsx(Tl,{className:"w-4 h-4"})})]})}),s.jsx(X,{children:c?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):o!=null&&o.data&&o.data.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Kundennr."}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Name"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Typ"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"E-Mail"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Verträge"}),s.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsx("tbody",{children:o.data.map(d=>{var u;return s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[s.jsx("td",{className:"py-3 px-4 font-mono text-sm",children:d.customerNumber}),s.jsx("td",{className:"py-3 px-4",children:d.type==="BUSINESS"&&d.companyName?d.companyName:`${d.firstName} ${d.lastName}`}),s.jsx("td",{className:"py-3 px-4",children:s.jsx(ve,{variant:d.type==="BUSINESS"?"info":"default",children:d.type==="BUSINESS"?"Firma":"Privat"})}),s.jsx("td",{className:"py-3 px-4",children:d.email||"-"}),s.jsx("td",{className:"py-3 px-4",children:((u=d._count)==null?void 0:u.contracts)||0}),s.jsx("td",{className:"py-3 px-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ke,{to:`/customers/${d.id}`,children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Ae,{className:"w-4 h-4"})})}),l("customers:update")&&s.jsx(ke,{to:`/customers/${d.id}/edit`,children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(He,{className:"w-4 h-4"})})})]})})]},d.id)})})]})}),o.pagination&&o.pagination.totalPages>1&&s.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["Seite ",o.pagination.page," von ",o.pagination.totalPages," (",o.pagination.total," Einträge)"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>i(d=>Math.max(1,d-1)),disabled:a===1,children:"Zurück"}),s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>i(d=>d+1),disabled:a>=o.pagination.totalPages,children:"Weiter"})]})]})]}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Kunden gefunden."})})]})}function ak({emails:e,selectedEmailId:t,onSelectEmail:n,onEmailDeleted:r,isLoading:a,folder:i="INBOX",accountId:l}){const o=i==="SENT",[c,d]=j.useState(null),{hasPermission:u}=We(),h=S=>{if(o)try{const A=JSON.parse(S.toAddresses);if(A.length>0)return`An: ${A[0]}${A.length>1?` (+${A.length-1})`:""}`}catch{return"An: (Unbekannt)"}return S.fromName||S.fromAddress},x=ge(),m=G({mutationFn:S=>Pe.toggleStar(S),onSuccess:(S,A)=>{x.invalidateQueries({queryKey:["emails"]}),x.invalidateQueries({queryKey:["email",A]})}}),f=G({mutationFn:({emailId:S,isRead:A})=>Pe.markAsRead(S,A),onSuccess:(S,A)=>{x.invalidateQueries({queryKey:["emails"]}),x.invalidateQueries({queryKey:["email",A.emailId]}),l&&x.invalidateQueries({queryKey:["folder-counts",l]})}}),p=G({mutationFn:S=>Pe.delete(S),onSuccess:(S,A)=>{x.invalidateQueries({queryKey:["emails"]}),l&&x.invalidateQueries({queryKey:["folder-counts",l]}),Re.success("E-Mail in Papierkorb verschoben"),d(null),r==null||r(A)},onError:S=>{console.error("Delete error:",S),Re.error(S.message||"Fehler beim Löschen der E-Mail"),d(null)}}),b=G({mutationFn:S=>Pe.unassignFromContract(S),onSuccess:()=>{x.invalidateQueries({queryKey:["emails"]}),Re.success("Vertragszuordnung aufgehoben")},onError:S=>{console.error("Unassign error:",S),Re.error(S.message||"Fehler beim Aufheben der Zuordnung")}}),g=(S,A)=>{S.stopPropagation(),b.mutate(A)},y=(S,A)=>{S.stopPropagation(),d(A)},v=S=>{S.stopPropagation(),c&&p.mutate(c)},N=S=>{S.stopPropagation(),d(null)},E=S=>{const A=new Date(S),O=new Date;return A.toDateString()===O.toDateString()?A.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"}):A.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit"})},P=(S,A)=>{S.stopPropagation(),m.mutate(A)},I=(S,A)=>{S.stopPropagation(),f.mutate({emailId:A.id,isRead:!A.isRead})},w=S=>{S.isRead||f.mutate({emailId:S.id,isRead:!0}),n(S)};return a?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}):e.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500",children:[s.jsx(nn,{className:"w-12 h-12 mb-2 opacity-50"}),s.jsx("p",{children:"Keine E-Mails vorhanden"})]}):s.jsxs("div",{className:"divide-y divide-gray-200",children:[e.map(S=>s.jsxs("div",{onClick:()=>w(S),className:["flex items-start gap-3 p-3 cursor-pointer transition-colors",t===S.id?"bg-blue-100":["hover:bg-gray-100",S.isRead?"bg-gray-50/50":"bg-white"].join(" ")].join(" "),style:{borderLeft:t===S.id?"4px solid #2563eb":"4px solid transparent"},children:[s.jsx("button",{onClick:A=>I(A,S),className:` + flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-gray-200 + ${S.isRead?"text-gray-400":"text-blue-600"} + `,title:S.isRead?"Als ungelesen markieren":"Als gelesen markieren",children:S.isRead?s.jsx(Pv,{className:"w-4 h-4"}):s.jsx(nn,{className:"w-4 h-4"})}),s.jsx("button",{onClick:A=>P(A,S.id),className:` + flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-gray-200 + ${S.isStarred?"text-yellow-500":"text-gray-400"} + `,title:S.isStarred?"Stern entfernen":"Als wichtig markieren",children:s.jsx(ph,{className:`w-4 h-4 ${S.isStarred?"fill-current":""}`})}),u("emails:delete")&&s.jsx("button",{onClick:A=>y(A,S.id),className:"flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-red-100 text-gray-400 hover:text-red-600",title:"E-Mail löschen",children:s.jsx(Ne,{className:"w-4 h-4"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[s.jsx("span",{className:`text-sm truncate ${S.isRead?"text-gray-700":"font-semibold text-gray-900"}`,children:h(S)}),s.jsx("span",{className:"text-xs text-gray-500 flex-shrink-0",children:E(S.receivedAt)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`text-sm truncate ${S.isRead?"text-gray-600":"font-medium text-gray-900"}`,children:S.subject||"(Kein Betreff)"}),S.hasAttachments&&s.jsx(Rc,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})]}),S.contract&&s.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[s.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800",children:S.contract.contractNumber}),(i==="INBOX"||i==="SENT"&&!S.isAutoAssigned)&&s.jsx("button",{onClick:A=>g(A,S.id),className:"p-0.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded",title:"Zuordnung aufheben",disabled:b.isPending,children:s.jsx(qt,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(Ft,{className:"w-4 h-4 text-gray-400 flex-shrink-0 mt-2"})]},S.id)),c&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"E-Mail löschen?"}),s.jsx("p",{className:"text-gray-600 mb-4",children:"Die E-Mail wird in den Papierkorb verschoben."}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:N,disabled:p.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:v,disabled:p.isPending,children:p.isPending?"Löschen...":"Löschen"})]})]})})]})}const Ie=j.forwardRef(({className:e="",label:t,error:n,options:r,id:a,placeholder:i="Bitte wählen...",...l},o)=>{const c=a||l.name,d=/\bw-\d+\b|\bw-\[|\bflex-/.test(e);return s.jsxs("div",{className:d?e:"w-full",children:[t&&s.jsx("label",{htmlFor:c,className:"block text-sm font-medium text-gray-700 mb-1",children:t}),s.jsxs("select",{ref:o,id:c,className:`block w-full px-3 py-2 border rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${n?"border-red-500":"border-gray-300"}`,...l,children:[s.jsx("option",{value:"",children:i}),r.map(u=>s.jsx("option",{value:u.value,children:u.label},u.value))]}),n&&s.jsx("p",{className:"mt-1 text-sm text-red-600",children:n})]})});Ie.displayName="Select";function ik({isOpen:e,onClose:t,emailId:n,attachmentFilename:r,onSuccess:a}){var O,R,q;const[i,l]=j.useState(null),[o,c]=j.useState(new Set(["customer"])),[d,u]=j.useState("document"),[h,x]=j.useState({invoiceDate:new Date().toISOString().split("T")[0],invoiceType:"INTERIM",notes:""}),m=ge(),{data:f,isLoading:p,error:b}=fe({queryKey:["attachment-targets",n],queryFn:()=>Pe.getAttachmentTargets(n),enabled:e}),g=f==null?void 0:f.data,y=((O=g==null?void 0:g.contract)==null?void 0:O.type)==="ELECTRICITY"||((R=g==null?void 0:g.contract)==null?void 0:R.type)==="GAS",v=G({mutationFn:()=>{if(!i)throw new Error("Kein Ziel ausgewählt");return Pe.saveAttachmentTo(n,r,{entityType:i.entityType,entityId:i.entityId,targetKey:i.targetKey})},onSuccess:()=>{var D,z;Re.success("Anhang gespeichert"),m.invalidateQueries({queryKey:["attachment-targets",n]}),m.invalidateQueries({queryKey:["customers"]}),m.invalidateQueries({queryKey:["contracts"]}),(D=g==null?void 0:g.customer)!=null&&D.id&&m.invalidateQueries({queryKey:["customer",g.customer.id.toString()]}),(z=g==null?void 0:g.contract)!=null&&z.id&&m.invalidateQueries({queryKey:["contract",g.contract.id.toString()]}),a==null||a(),E()},onError:D=>{Re.error(D.message||"Fehler beim Speichern")}}),N=G({mutationFn:()=>Pe.saveAttachmentAsInvoice(n,r,{invoiceDate:h.invoiceDate,invoiceType:h.invoiceType,notes:h.notes||void 0}),onSuccess:()=>{var D;Re.success("Anhang als Rechnung gespeichert"),m.invalidateQueries({queryKey:["attachment-targets",n]}),m.invalidateQueries({queryKey:["customers"]}),m.invalidateQueries({queryKey:["contracts"]}),(D=g==null?void 0:g.contract)!=null&&D.id&&m.invalidateQueries({queryKey:["contract",g.contract.id.toString()]}),a==null||a(),E()},onError:D=>{Re.error(D.message||"Fehler beim Speichern der Rechnung")}}),E=()=>{l(null),u("document"),x({invoiceDate:new Date().toISOString().split("T")[0],invoiceType:"INTERIM",notes:""}),t()},P=D=>{const z=new Set(o);z.has(D)?z.delete(D):z.add(D),c(z)},I=(D,z,k,K)=>{l({entityType:D,entityId:k,targetKey:z.key,hasDocument:z.hasDocument,label:K?`${K} → ${z.label}`:z.label})},w=(D,z,k,K)=>D.map(B=>{const _=(i==null?void 0:i.entityType)===z&&(i==null?void 0:i.entityId)===k&&(i==null?void 0:i.targetKey)===B.key;return s.jsxs("div",{onClick:()=>I(z,B,k,K),className:` + flex items-center gap-3 p-3 cursor-pointer transition-colors rounded-lg ml-4 + ${_?"bg-blue-100 ring-2 ring-blue-500":"hover:bg-gray-100"} + `,children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-gray-900",children:B.label}),B.hasDocument&&s.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 text-xs rounded-full bg-yellow-100 text-yellow-800",children:[s.jsx(hs,{className:"w-3 h-3"}),"Vorhanden"]})]})}),_&&s.jsx(xr,{className:"w-5 h-5 text-blue-600"})]},B.key)}),S=(D,z)=>s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-sm font-medium text-gray-700 px-3 py-1 bg-gray-50 rounded",children:D.label}),w(D.slots,z,D.id,D.label)]},D.id),A=(D,z,k,K,B=!1)=>{const _=o.has(z);return s.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[s.jsxs("button",{onClick:()=>P(z),className:"w-full flex items-center gap-2 p-3 bg-gray-50 hover:bg-gray-100 transition-colors",children:[_?s.jsx(dn,{className:"w-4 h-4 text-gray-500"}):s.jsx(Ft,{className:"w-4 h-4 text-gray-500"}),k,s.jsx("span",{className:"font-medium text-gray-900",children:D})]}),_&&s.jsx("div",{className:"p-2",children:B?s.jsx("p",{className:"text-sm text-gray-500 text-center py-4",children:"Keine Einträge vorhanden"}):K})]})};return s.jsx(qe,{isOpen:e,onClose:E,title:"Anhang speichern unter",size:"lg",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"p-3 bg-gray-50 rounded-lg",children:s.jsxs("p",{className:"text-sm text-gray-600",children:[s.jsx("span",{className:"font-medium",children:"Datei:"})," ",r]})}),p&&s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"})}),b&&s.jsx("div",{className:"p-4 bg-red-50 text-red-700 rounded-lg",children:"Fehler beim Laden der Dokumentziele"}),g&&s.jsxs(s.Fragment,{children:[y&&s.jsxs("div",{className:"flex gap-2 p-1 bg-gray-100 rounded-lg",children:[s.jsxs("button",{onClick:()=>u("document"),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors ${d==="document"?"bg-white text-blue-600 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Be,{className:"w-4 h-4"}),"Als Dokument"]}),s.jsxs("button",{onClick:()=>u("invoice"),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors ${d==="invoice"?"bg-white text-green-600 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(mh,{className:"w-4 h-4"}),"Als Rechnung"]})]}),d==="document"&&s.jsxs("div",{className:"space-y-3 max-h-96 overflow-auto",children:[A(`Kunde: ${g.customer.name}`,"customer",s.jsx(ii,{className:"w-4 h-4 text-blue-600"}),w(g.customer.slots,"customer"),g.customer.slots.length===0),A("Ausweisdokumente","identityDocuments",s.jsx(Av,{className:"w-4 h-4 text-green-600"}),g.identityDocuments.map(D=>S(D,"identityDocument")),g.identityDocuments.length===0),A("Bankkarten","bankCards",s.jsx(ch,{className:"w-4 h-4 text-purple-600"}),g.bankCards.map(D=>S(D,"bankCard")),g.bankCards.length===0),g.contract&&A(`Vertrag: ${g.contract.contractNumber}`,"contract",s.jsx(Be,{className:"w-4 h-4 text-orange-600"}),w(g.contract.slots,"contract"),g.contract.slots.length===0),!g.contract&&s.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg text-sm text-gray-600",children:[s.jsx(Be,{className:"w-4 h-4 inline-block mr-2 text-gray-400"}),"E-Mail ist keinem Vertrag zugeordnet. Ordnen Sie die E-Mail einem Vertrag zu, um Vertragsdokumente als Ziel auswählen zu können."]})]}),d==="invoice"&&y&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"p-3 bg-green-50 rounded-lg",children:s.jsxs("p",{className:"text-sm text-green-700",children:["Der Anhang wird als Rechnung für den Vertrag ",s.jsx("strong",{children:(q=g.contract)==null?void 0:q.contractNumber})," gespeichert."]})}),s.jsx(H,{label:"Rechnungsdatum",type:"date",value:h.invoiceDate,onChange:D=>x({...h,invoiceDate:D.target.value}),required:!0}),s.jsx(Ie,{label:"Rechnungstyp",value:h.invoiceType,onChange:D=>x({...h,invoiceType:D.target.value}),options:[{value:"INTERIM",label:"Zwischenrechnung"},{value:"FINAL",label:"Schlussrechnung"}]}),s.jsx(H,{label:"Notizen (optional)",value:h.notes,onChange:D=>x({...h,notes:D.target.value}),placeholder:"Optionale Anmerkungen..."})]})]}),d==="document"&&(i==null?void 0:i.hasDocument)&&s.jsxs("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg flex items-start gap-2",children:[s.jsx(hs,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm text-yellow-800",children:[s.jsx("strong",{children:"Achtung:"})," An diesem Feld ist bereits ein Dokument hinterlegt. Das vorhandene Dokument wird durch den neuen Anhang ersetzt."]})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:E,children:"Abbrechen"}),d==="document"?s.jsx(T,{onClick:()=>v.mutate(),disabled:!i||v.isPending||N.isPending,children:v.isPending?"Wird gespeichert...":"Speichern"}):s.jsx(T,{onClick:()=>N.mutate(),disabled:!h.invoiceDate||v.isPending||N.isPending,children:N.isPending?"Wird gespeichert...":"Als Rechnung speichern"})]})]})})}function lk({isOpen:e,onClose:t,emailId:n,onSuccess:r}){var O,R,q;const[a,i]=j.useState(null),[l,o]=j.useState(new Set(["customer"])),[c,d]=j.useState("document"),[u,h]=j.useState({invoiceDate:new Date().toISOString().split("T")[0],invoiceType:"INTERIM",notes:""}),x=ge(),{data:m,isLoading:f,error:p}=fe({queryKey:["attachment-targets",n],queryFn:()=>Pe.getAttachmentTargets(n),enabled:e}),b=m==null?void 0:m.data,g=((O=b==null?void 0:b.contract)==null?void 0:O.type)==="ELECTRICITY"||((R=b==null?void 0:b.contract)==null?void 0:R.type)==="GAS",y=G({mutationFn:()=>{if(!a)throw new Error("Kein Ziel ausgewählt");return Pe.saveEmailAsPdf(n,{entityType:a.entityType,entityId:a.entityId,targetKey:a.targetKey})},onSuccess:()=>{var D,z;Re.success("E-Mail als PDF gespeichert"),x.invalidateQueries({queryKey:["attachment-targets",n]}),x.invalidateQueries({queryKey:["customers"]}),x.invalidateQueries({queryKey:["contracts"]}),(D=b==null?void 0:b.customer)!=null&&D.id&&x.invalidateQueries({queryKey:["customer",b.customer.id.toString()]}),(z=b==null?void 0:b.contract)!=null&&z.id&&x.invalidateQueries({queryKey:["contract",b.contract.id.toString()]}),r==null||r(),N()},onError:D=>{Re.error(D.message||"Fehler beim Speichern")}}),v=G({mutationFn:()=>Pe.saveEmailAsInvoice(n,{invoiceDate:u.invoiceDate,invoiceType:u.invoiceType,notes:u.notes||void 0}),onSuccess:()=>{var D;Re.success("E-Mail als Rechnung gespeichert"),x.invalidateQueries({queryKey:["attachment-targets",n]}),x.invalidateQueries({queryKey:["customers"]}),x.invalidateQueries({queryKey:["contracts"]}),(D=b==null?void 0:b.contract)!=null&&D.id&&x.invalidateQueries({queryKey:["contract",b.contract.id.toString()]}),r==null||r(),N()},onError:D=>{Re.error(D.message||"Fehler beim Speichern der Rechnung")}}),N=()=>{i(null),d("document"),h({invoiceDate:new Date().toISOString().split("T")[0],invoiceType:"INTERIM",notes:""}),t()},E=D=>{const z=new Set(l);z.has(D)?z.delete(D):z.add(D),o(z)},P=(D,z,k,K)=>{i({entityType:D,entityId:k,targetKey:z.key,hasDocument:z.hasDocument,label:K?`${K} → ${z.label}`:z.label})},I=(D,z,k,K)=>D.map(B=>{const _=(a==null?void 0:a.entityType)===z&&(a==null?void 0:a.entityId)===k&&(a==null?void 0:a.targetKey)===B.key;return s.jsxs("div",{onClick:()=>P(z,B,k,K),className:` + flex items-center gap-3 p-3 cursor-pointer transition-colors rounded-lg ml-4 + ${_?"bg-blue-100 ring-2 ring-blue-500":"hover:bg-gray-100"} + `,children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-gray-900",children:B.label}),B.hasDocument&&s.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 text-xs rounded-full bg-yellow-100 text-yellow-800",children:[s.jsx(hs,{className:"w-3 h-3"}),"Vorhanden"]})]})}),_&&s.jsx(xr,{className:"w-5 h-5 text-blue-600"})]},B.key)}),w=(D,z)=>s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-sm font-medium text-gray-700 px-3 py-1 bg-gray-50 rounded",children:D.label}),I(D.slots,z,D.id,D.label)]},D.id),S=(D,z,k,K,B=!1)=>{const _=l.has(z);return s.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[s.jsxs("button",{onClick:()=>E(z),className:"w-full flex items-center gap-2 p-3 bg-gray-50 hover:bg-gray-100 transition-colors",children:[_?s.jsx(dn,{className:"w-4 h-4 text-gray-500"}):s.jsx(Ft,{className:"w-4 h-4 text-gray-500"}),k,s.jsx("span",{className:"font-medium text-gray-900",children:D})]}),_&&s.jsx("div",{className:"p-2",children:B?s.jsx("p",{className:"text-sm text-gray-500 text-center py-4",children:"Keine Einträge vorhanden"}):K})]})},A=y.isPending||v.isPending;return s.jsx(qe,{isOpen:e,onClose:N,title:"E-Mail als PDF speichern",size:"lg",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"p-3 bg-blue-50 rounded-lg",children:s.jsx("p",{className:"text-sm text-blue-700",children:"Die E-Mail wird als PDF exportiert (inkl. Absender, Empfänger, Datum und Inhalt) und im gewählten Dokumentenfeld gespeichert."})}),f&&s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"})}),p&&s.jsx("div",{className:"p-4 bg-red-50 text-red-700 rounded-lg",children:"Fehler beim Laden der Dokumentziele"}),b&&s.jsxs(s.Fragment,{children:[g&&s.jsxs("div",{className:"flex gap-2 p-1 bg-gray-100 rounded-lg",children:[s.jsxs("button",{onClick:()=>d("document"),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors ${c==="document"?"bg-white text-blue-600 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Be,{className:"w-4 h-4"}),"Als Dokument"]}),s.jsxs("button",{onClick:()=>d("invoice"),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors ${c==="invoice"?"bg-white text-green-600 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(mh,{className:"w-4 h-4"}),"Als Rechnung"]})]}),c==="document"&&s.jsxs("div",{className:"space-y-3 max-h-96 overflow-auto",children:[S(`Kunde: ${b.customer.name}`,"customer",s.jsx(ii,{className:"w-4 h-4 text-blue-600"}),I(b.customer.slots,"customer"),b.customer.slots.length===0),S("Ausweisdokumente","identityDocuments",s.jsx(Av,{className:"w-4 h-4 text-green-600"}),b.identityDocuments.map(D=>w(D,"identityDocument")),b.identityDocuments.length===0),S("Bankkarten","bankCards",s.jsx(ch,{className:"w-4 h-4 text-purple-600"}),b.bankCards.map(D=>w(D,"bankCard")),b.bankCards.length===0),b.contract&&S(`Vertrag: ${b.contract.contractNumber}`,"contract",s.jsx(Be,{className:"w-4 h-4 text-orange-600"}),I(b.contract.slots,"contract"),b.contract.slots.length===0),!b.contract&&s.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg text-sm text-gray-600",children:[s.jsx(Be,{className:"w-4 h-4 inline-block mr-2 text-gray-400"}),"E-Mail ist keinem Vertrag zugeordnet. Ordnen Sie die E-Mail einem Vertrag zu, um Vertragsdokumente als Ziel auswählen zu können."]})]}),c==="invoice"&&g&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"p-3 bg-green-50 rounded-lg",children:s.jsxs("p",{className:"text-sm text-green-700",children:["Die E-Mail wird als Rechnung für den Vertrag ",s.jsx("strong",{children:(q=b.contract)==null?void 0:q.contractNumber})," gespeichert."]})}),s.jsx(H,{label:"Rechnungsdatum",type:"date",value:u.invoiceDate,onChange:D=>h({...u,invoiceDate:D.target.value}),required:!0}),s.jsx(Ie,{label:"Rechnungstyp",value:u.invoiceType,onChange:D=>h({...u,invoiceType:D.target.value}),options:[{value:"INTERIM",label:"Zwischenrechnung"},{value:"FINAL",label:"Schlussrechnung"}]}),s.jsx(H,{label:"Notizen (optional)",value:u.notes,onChange:D=>h({...u,notes:D.target.value}),placeholder:"Optionale Anmerkungen..."})]})]}),c==="document"&&(a==null?void 0:a.hasDocument)&&s.jsxs("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg flex items-start gap-2",children:[s.jsx(hs,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm text-yellow-800",children:[s.jsx("strong",{children:"Achtung:"})," An diesem Feld ist bereits ein Dokument hinterlegt. Das vorhandene Dokument wird durch die PDF ersetzt."]})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:N,children:"Abbrechen"}),c==="document"?s.jsx(T,{onClick:()=>y.mutate(),disabled:!a||A,children:A?"Wird erstellt...":"Als PDF speichern"}):s.jsx(T,{onClick:()=>v.mutate(),disabled:!u.invoiceDate||A,children:A?"Wird erstellt...":"Als Rechnung speichern"})]})]})})}function Rv({email:e,onReply:t,onAssignContract:n,onDeleted:r,isSentFolder:a=!1,isContractView:i=!1,isTrashView:l=!1,onRestored:o,accountId:c}){const[d,u]=j.useState(!0),[h,x]=j.useState(e.isStarred),[m,f]=j.useState(!1),[p,b]=j.useState(!1),[g,y]=j.useState(!1),[v,N]=j.useState(null),[E,P]=j.useState(!1),I=ge(),{hasPermission:w}=We();j.useEffect(()=>{x(e.isStarred)},[e.id,e.isStarred]);const S=G({mutationFn:()=>Pe.toggleStar(e.id),onMutate:()=>{x(Q=>!Q)},onSuccess:()=>{I.invalidateQueries({queryKey:["emails"]}),I.invalidateQueries({queryKey:["email",e.id]})},onError:()=>{x(e.isStarred)}}),A=G({mutationFn:()=>Pe.unassignFromContract(e.id),onSuccess:()=>{I.invalidateQueries({queryKey:["emails"]}),I.invalidateQueries({queryKey:["email",e.id]}),e.contractId&&I.invalidateQueries({queryKey:["contract-folder-counts",e.contractId]}),Re.success("Vertragszuordnung aufgehoben")},onError:Q=>{console.error("Unassign error:",Q),Re.error(Q.message||"Fehler beim Aufheben der Zuordnung")}}),O=G({mutationFn:()=>Pe.delete(e.id),onSuccess:()=>{I.invalidateQueries({queryKey:["emails"]}),c&&I.invalidateQueries({queryKey:["folder-counts",c]}),e.contractId&&I.invalidateQueries({queryKey:["contract-folder-counts",e.contractId]}),Re.success("E-Mail in Papierkorb verschoben"),f(!1),r==null||r()},onError:Q=>{console.error("Delete error:",Q),Re.error(Q.message||"Fehler beim Löschen der E-Mail"),f(!1)}}),R=G({mutationFn:()=>Pe.restore(e.id),onSuccess:()=>{I.invalidateQueries({queryKey:["emails"]}),c&&I.invalidateQueries({queryKey:["folder-counts",c]}),e.contractId&&I.invalidateQueries({queryKey:["contract-folder-counts",e.contractId]}),Re.success("E-Mail wiederhergestellt"),b(!1),o==null||o()},onError:Q=>{console.error("Restore error:",Q),Re.error(Q.message||"Fehler beim Wiederherstellen der E-Mail"),b(!1)}}),q=G({mutationFn:()=>Pe.permanentDelete(e.id),onSuccess:()=>{I.invalidateQueries({queryKey:["emails"]}),c&&I.invalidateQueries({queryKey:["folder-counts",c]}),Re.success("E-Mail endgültig gelöscht"),y(!1),r==null||r()},onError:Q=>{console.error("Permanent delete error:",Q),Re.error(Q.message||"Fehler beim endgültigen Löschen der E-Mail"),y(!1)}}),D=Q=>new Date(Q).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),z=Q=>{try{return JSON.parse(Q)}catch{return[]}},k=Q=>{if(!Q)return[];try{return JSON.parse(Q)}catch{return[]}},K=z(e.toAddresses),B=e.ccAddresses?z(e.ccAddresses):[],_=k(e.attachmentNames);return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"p-4 border-b border-gray-200 space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:e.subject||"(Kein Betreff)"}),s.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:l?s.jsxs(s.Fragment,{children:[s.jsxs(T,{variant:"secondary",size:"sm",onClick:()=>b(!0),title:"Wiederherstellen",children:[s.jsx(Iv,{className:"w-4 h-4 mr-1"}),"Wiederherstellen"]}),s.jsxs(T,{variant:"danger",size:"sm",onClick:()=>y(!0),title:"Endgültig löschen",children:[s.jsx(Ne,{className:"w-4 h-4 mr-1"}),"Endgültig löschen"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>S.mutate(),className:`p-2 rounded-lg hover:bg-gray-100 ${h?"text-yellow-500":"text-gray-400"}`,title:h?"Stern entfernen":"Als wichtig markieren",children:s.jsx(ph,{className:`w-5 h-5 ${h?"fill-current":""}`})}),s.jsxs(T,{variant:"secondary",size:"sm",onClick:t,children:[s.jsx(V2,{className:"w-4 h-4 mr-1"}),"Antworten"]}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>P(!0),title:"E-Mail als PDF speichern",children:s.jsx(F2,{className:"w-4 h-4"})}),w("emails:delete")&&s.jsx(T,{variant:"danger",size:"sm",onClick:()=>f(!0),title:"E-Mail löschen",children:s.jsx(Ne,{className:"w-4 h-4"})})]})})]}),s.jsxs("div",{className:"text-sm space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-500 w-12",children:"Von:"}),s.jsxs("span",{className:"font-medium text-gray-900",children:[e.fromName&&`${e.fromName} `,s.jsxs("span",{className:"text-gray-600",children:["<",e.fromAddress,">"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-500 w-12",children:"An:"}),s.jsx("span",{className:"text-gray-700",children:K.join(", ")})]}),B.length>0&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-500 w-12",children:"CC:"}),s.jsx("span",{className:"text-gray-700",children:B.join(", ")})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-500 w-12",children:"Am:"}),s.jsx("span",{className:"text-gray-700",children:D(e.receivedAt)})]})]}),s.jsx("div",{className:"flex items-center gap-2 pt-2",children:e.contract?s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-green-50 border border-green-200 rounded-lg",children:[s.jsx(px,{className:"w-4 h-4 text-green-600"}),s.jsxs("span",{className:"text-sm text-green-800",children:["Zugeordnet zu:"," ",s.jsx(ke,{to:`/contracts/${e.contract.id}`,className:"font-medium hover:underline",children:e.contract.contractNumber})]}),!e.isAutoAssigned&&s.jsx("button",{onClick:()=>A.mutate(),className:"ml-2 p-1 hover:bg-green-100 rounded",title:"Zuordnung aufheben",children:s.jsx(qt,{className:"w-4 h-4 text-green-600"})})]}):!i&&s.jsxs(T,{variant:"secondary",size:"sm",onClick:n,children:[s.jsx(px,{className:"w-4 h-4 mr-1"}),"Vertrag zuordnen"]})}),_.length>0&&s.jsxs("div",{className:"pt-2",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(Rc,{className:"w-4 h-4 text-gray-400"}),s.jsxs("span",{className:"text-sm text-gray-500",children:[_.length," Anhang",_.length>1?"e":""]})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:_.map((Q,le)=>s.jsxs("div",{className:"inline-flex items-center gap-1 px-3 py-2 bg-gray-100 rounded-lg text-sm text-gray-700",children:[s.jsx("span",{className:"max-w-[200px] truncate mr-1",children:Q}),s.jsx("a",{href:Pe.getAttachmentUrl(e.id,Q,!0),target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-gray-200 rounded transition-colors",title:`${Q} öffnen`,children:s.jsx(dh,{className:"w-4 h-4 text-gray-500"})}),s.jsx("a",{href:Pe.getAttachmentUrl(e.id,Q),download:Q,className:"p-1 hover:bg-gray-200 rounded transition-colors",title:`${Q} herunterladen`,children:s.jsx(Ps,{className:"w-4 h-4 text-gray-500"})}),!l&&s.jsx("button",{onClick:()=>N(Q),className:"p-1 hover:bg-blue-100 rounded transition-colors",title:`${Q} speichern unter...`,children:s.jsx(Mv,{className:"w-4 h-4 text-blue-500"})})]},le))})]})]}),e.htmlBody&&e.textBody&&s.jsxs("div",{className:"px-4 py-2 border-b border-gray-200 flex items-center gap-2",children:[s.jsx("button",{onClick:()=>u(!0),className:`px-3 py-1 text-sm rounded ${d?"bg-blue-100 text-blue-700":"text-gray-600 hover:bg-gray-100"}`,children:"HTML"}),s.jsx("button",{onClick:()=>u(!1),className:`px-3 py-1 text-sm rounded ${d?"text-gray-600 hover:bg-gray-100":"bg-blue-100 text-blue-700"}`,children:"Text"})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:d&&e.htmlBody?s.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:e.htmlBody}}):s.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-700 font-sans",children:e.textBody||"Kein Inhalt"})}),m&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"E-Mail löschen?"}),s.jsx("p",{className:"text-gray-600 mb-4",children:"Die E-Mail wird in den Papierkorb verschoben."}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:()=>f(!1),disabled:O.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:()=>O.mutate(),disabled:O.isPending,children:O.isPending?"Löschen...":"Löschen"})]})]})}),p&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"E-Mail wiederherstellen?"}),s.jsxs("p",{className:"text-gray-600 mb-4",children:["Die E-Mail wird wieder in den ursprünglichen Ordner (",e.folder==="SENT"?"Gesendet":"Posteingang",") verschoben."]}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:()=>b(!1),disabled:R.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"primary",onClick:()=>R.mutate(),disabled:R.isPending,children:R.isPending?"Wird wiederhergestellt...":"Wiederherstellen"})]})]})}),g&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"E-Mail endgültig löschen?"}),s.jsx("p",{className:"text-gray-600 mb-4",children:"Diese Aktion kann nicht rückgängig gemacht werden. Die E-Mail wird unwiderruflich gelöscht."}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:()=>y(!1),disabled:q.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:()=>q.mutate(),disabled:q.isPending,children:q.isPending?"Wird gelöscht...":"Endgültig löschen"})]})]})}),v&&s.jsx(ik,{isOpen:!0,onClose:()=>N(null),emailId:e.id,attachmentFilename:v}),E&&s.jsx(lk,{isOpen:!0,onClose:()=>P(!1),emailId:e.id})]})}function Lv({isOpen:e,onClose:t,account:n,replyTo:r,onSuccess:a,contractId:i}){const[l,o]=j.useState(""),[c,d]=j.useState(""),[u,h]=j.useState(""),[x,m]=j.useState(""),[f,p]=j.useState([]),[b,g]=j.useState(null),y=j.useRef(null);j.useEffect(()=>{if(e){if(r){o(r.fromAddress||"");const R=r.subject||"",q=/^(Re|Aw|Fwd|Wg):\s*/i.test(R);h(q?R:`Re: ${R}`);const D=new Date(r.receivedAt).toLocaleString("de-DE"),z=r.textBody?` + +--- Ursprüngliche Nachricht --- +Von: ${r.fromName||r.fromAddress} +Am: ${D} + +${r.textBody}`:"";m(z)}else o(""),h(""),m("");d(""),p([]),g(null)}},[e,r]);const v=10*1024*1024,N=25*1024*1024,E=R=>new Promise((q,D)=>{const z=new FileReader;z.readAsDataURL(R),z.onload=()=>{const K=z.result.split(",")[1];q(K)},z.onerror=D}),P=async R=>{const q=R.target.files;if(!q)return;const D=[];let z=f.reduce((k,K)=>k+K.content.length*.75,0);for(const k of Array.from(q)){if(k.size>v){g(`Datei "${k.name}" ist zu groß (max. 10 MB)`);continue}if(z+k.size>N){g("Maximale Gesamtgröße der Anhänge erreicht (25 MB)");break}try{const K=await E(k);D.push({filename:k.name,content:K,contentType:k.type||"application/octet-stream"}),z+=k.size}catch{g(`Fehler beim Lesen von "${k.name}"`)}}D.length>0&&p(k=>[...k,...D]),y.current&&(y.current.value="")},I=R=>{p(q=>q.filter((D,z)=>z!==R))},w=R=>{const q=R.length*.75;return q<1024?`${Math.round(q)} B`:q<1024*1024?`${(q/1024).toFixed(1)} KB`:`${(q/(1024*1024)).toFixed(1)} MB`},S=G({mutationFn:()=>xs.sendEmail(n.id,{to:l.split(",").map(R=>R.trim()).filter(Boolean),cc:c?c.split(",").map(R=>R.trim()).filter(Boolean):void 0,subject:u,text:x,inReplyTo:r==null?void 0:r.messageId,references:r!=null&&r.messageId?[r.messageId]:void 0,attachments:f.length>0?f:void 0,contractId:i}),onSuccess:()=>{a==null||a(),A()},onError:R=>{g(R instanceof Error?R.message:"Fehler beim Senden")}}),A=()=>{t()},O=()=>{if(!l.trim()){g("Bitte Empfänger angeben");return}if(!u.trim()){g("Bitte Betreff angeben");return}g(null),S.mutate()};return s.jsx(qe,{isOpen:e,onClose:A,title:r?"Antworten":"Neue E-Mail",size:"lg",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Von"}),s.jsx("div",{className:"px-3 py-2 bg-gray-100 rounded-lg text-sm text-gray-700",children:n.email})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["An ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",value:l,onChange:R=>o(R.target.value),placeholder:"empfaenger@example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),s.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Mehrere Empfänger mit Komma trennen"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"CC"}),s.jsx("input",{type:"text",value:c,onChange:R=>d(R.target.value),placeholder:"cc@example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["Betreff ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",value:u,onChange:R=>h(R.target.value),placeholder:"Betreff eingeben",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Nachricht"}),s.jsx("textarea",{value:x,onChange:R=>m(R.target.value),rows:10,placeholder:"Ihre Nachricht...",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Anhänge"}),s.jsx("input",{type:"file",ref:y,onChange:P,multiple:!0,className:"hidden"}),s.jsxs("button",{type:"button",onClick:()=>{var R;return(R=y.current)==null?void 0:R.click()},className:"inline-flex items-center px-3 py-2 text-sm border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:[s.jsx(Rc,{className:"w-4 h-4 mr-2"}),"Datei anhängen"]}),f.length>0&&s.jsx("div",{className:"mt-2 space-y-2",children:f.map((R,q)=>s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-50 rounded-lg",children:[s.jsxs("div",{className:"flex items-center min-w-0",children:[s.jsx(Be,{className:"w-4 h-4 text-gray-500 mr-2 flex-shrink-0"}),s.jsx("span",{className:"text-sm text-gray-700 truncate",children:R.filename}),s.jsxs("span",{className:"ml-2 text-xs text-gray-500 flex-shrink-0",children:["(",w(R.content),")"]})]}),s.jsx("button",{type:"button",onClick:()=>I(q),className:"ml-2 p-1 text-gray-400 hover:text-red-500 transition-colors",title:"Anhang entfernen",children:s.jsx(qt,{className:"w-4 h-4"})})]},q))}),s.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Max. 10 MB pro Datei, 25 MB gesamt"})]}),b&&s.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:b}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:A,children:"Abbrechen"}),s.jsxs(T,{onClick:O,disabled:S.isPending,children:[s.jsx(Fl,{className:"w-4 h-4 mr-2"}),S.isPending?"Wird gesendet...":"Senden"]})]})]})})}function ok({isOpen:e,onClose:t,email:n,customerId:r,onSuccess:a}){const[i,l]=j.useState(""),[o,c]=j.useState(null),d=ge(),{data:u,isLoading:h}=fe({queryKey:["contracts","customer",r],queryFn:()=>Oe.getAll({customerId:r}),enabled:e}),m=((u==null?void 0:u.data)||[]).filter(y=>{var N,E,P,I;if(!i)return!0;const v=i.toLowerCase();return y.contractNumber.toLowerCase().includes(v)||((E=(N=y.contractCategory)==null?void 0:N.name)==null?void 0:E.toLowerCase().includes(v))||((I=(P=y.provider)==null?void 0:P.name)==null?void 0:I.toLowerCase().includes(v))}),f=G({mutationFn:y=>Pe.assignToContract(n.id,y),onSuccess:(y,v)=>{d.invalidateQueries({queryKey:["emails"]}),d.invalidateQueries({queryKey:["email",n.id]}),d.invalidateQueries({queryKey:["contract-folder-counts",v]}),a==null||a(),p()}}),p=()=>{l(""),c(null),t()},b=()=>{o&&f.mutate(o)},g=y=>y?new Date(y).toLocaleDateString("de-DE"):"-";return s.jsx(qe,{isOpen:e,onClose:p,title:"E-Mail Vertrag zuordnen",size:"lg",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg",children:[s.jsxs("p",{className:"text-sm text-gray-600",children:[s.jsx("span",{className:"font-medium",children:"Betreff:"})," ",n.subject||"(Kein Betreff)"]}),s.jsxs("p",{className:"text-sm text-gray-600",children:[s.jsx("span",{className:"font-medium",children:"Von:"})," ",n.fromAddress]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Tl,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx("input",{type:"text",value:i,onChange:y=>l(y.target.value),placeholder:"Vertrag suchen...",className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),s.jsx("div",{className:"border border-gray-200 rounded-lg max-h-80 overflow-auto",children:h?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"})}):m.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-gray-500",children:[s.jsx(Be,{className:"w-8 h-8 mb-2 opacity-50"}),s.jsx("p",{className:"text-sm",children:"Keine Verträge gefunden"})]}):s.jsx("div",{className:"divide-y divide-gray-200",children:m.map(y=>{var v;return s.jsx("div",{onClick:()=>c(y.id),className:` + flex items-center gap-3 p-3 cursor-pointer transition-colors + ${o===y.id?"bg-blue-50 border-l-2 border-l-blue-500":"hover:bg-gray-50"} + `,children:s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-medium text-gray-900",children:y.contractNumber}),s.jsx("span",{className:` + px-2 py-0.5 text-xs rounded-full + ${y.status==="ACTIVE"?"bg-green-100 text-green-800":y.status==="PENDING"?"bg-yellow-100 text-yellow-800":y.status==="CANCELLED"?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"} + `,children:y.status})]}),s.jsxs("div",{className:"text-sm text-gray-600 truncate",children:[(v=y.contractCategory)==null?void 0:v.name,y.provider&&` - ${y.provider.name}`]}),s.jsxs("div",{className:"text-xs text-gray-500",children:["Start: ",g(y.startDate)]})]})},y.id)})})}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:p,children:"Abbrechen"}),s.jsx(T,{onClick:b,disabled:!o||f.isPending,children:f.isPending?"Wird zugeordnet...":"Zuordnen"})]})]})})}function Ov({emails:e,selectedEmailId:t,onSelectEmail:n,onEmailRestored:r,onEmailDeleted:a,isLoading:i}){const[l,o]=j.useState(null),[c,d]=j.useState(null),u=ge(),h=P=>{if(P.folder==="SENT")try{const I=JSON.parse(P.toAddresses);if(I.length>0)return`An: ${I[0]}${I.length>1?` (+${I.length-1})`:""}`}catch{return"An: (Unbekannt)"}return P.fromName||P.fromAddress},x=G({mutationFn:P=>Pe.restore(P),onSuccess:(P,I)=>{u.invalidateQueries({queryKey:["emails"]}),Re.success("E-Mail wiederhergestellt"),o(null),d(null),r==null||r(I)},onError:P=>{console.error("Restore error:",P),Re.error(P.message||"Fehler beim Wiederherstellen"),o(null),d(null)}}),m=G({mutationFn:P=>Pe.permanentDelete(P),onSuccess:(P,I)=>{u.invalidateQueries({queryKey:["emails"]}),Re.success("E-Mail endgültig gelöscht"),o(null),d(null),a==null||a(I)},onError:P=>{console.error("Permanent delete error:",P),Re.error(P.message||"Fehler beim endgültigen Löschen"),o(null),d(null)}}),f=G({mutationFn:P=>Pe.unassignFromContract(P),onSuccess:()=>{u.invalidateQueries({queryKey:["emails"]}),Re.success("Vertragszuordnung aufgehoben")},onError:P=>{console.error("Unassign error:",P),Re.error(P.message||"Fehler beim Aufheben der Zuordnung")}}),p=(P,I)=>{P.stopPropagation(),f.mutate(I)},b=(P,I)=>{P.stopPropagation(),o(I),d("restore")},g=(P,I)=>{P.stopPropagation(),o(I),d("delete")},y=P=>{P.stopPropagation(),l&&c&&(c==="restore"?x.mutate(l):m.mutate(l))},v=P=>{P.stopPropagation(),o(null),d(null)},N=P=>new Date(P).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit"}),E=P=>{if(!P)return"";const I=new Date(P),w=new Date;return I.toDateString()===w.toDateString()?`Gelöscht um ${I.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"})}`:`Gelöscht am ${I.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit"})}`};return i?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-red-600"})}):e.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500",children:[s.jsx(Ne,{className:"w-12 h-12 mb-2 opacity-50"}),s.jsx("p",{children:"Papierkorb ist leer"})]}):s.jsxs("div",{className:"divide-y divide-gray-200",children:[e.map(P=>s.jsxs("div",{onClick:()=>n(P),className:["flex items-start gap-3 p-3 cursor-pointer transition-colors",t===P.id?"bg-red-100":"hover:bg-gray-100 bg-gray-50/50"].join(" "),style:{borderLeft:t===P.id?"4px solid #dc2626":"4px solid transparent"},children:[s.jsx("div",{className:"flex-shrink-0 mt-1 p-1 -ml-1 text-gray-400",title:P.folder==="SENT"?"Aus Gesendet":"Aus Posteingang",children:P.folder==="SENT"?s.jsx(Fl,{className:"w-4 h-4"}):s.jsx(Ur,{className:"w-4 h-4"})}),s.jsx("button",{onClick:I=>b(I,P.id),className:"flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-green-100 text-gray-400 hover:text-green-600",title:"Wiederherstellen",children:s.jsx(Iv,{className:"w-4 h-4"})}),s.jsx("button",{onClick:I=>g(I,P.id),className:"flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-red-100 text-gray-400 hover:text-red-600",title:"Endgültig löschen",children:s.jsx(Ne,{className:"w-4 h-4"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[s.jsx("span",{className:"text-sm truncate text-gray-700",children:h(P)}),s.jsx("span",{className:"text-xs text-gray-500 flex-shrink-0",children:N(P.receivedAt)})]}),s.jsx("div",{className:"text-sm truncate text-gray-600",children:P.subject||"(Kein Betreff)"}),s.jsx("div",{className:"text-xs text-red-500 mt-1",children:E(P.deletedAt)}),P.contract&&s.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[s.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800",children:P.contract.contractNumber}),(P.folder==="INBOX"||P.folder==="SENT"&&!P.isAutoAssigned)&&s.jsx("button",{onClick:I=>p(I,P.id),className:"p-0.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded",title:"Zuordnung aufheben",disabled:f.isPending,children:s.jsx(qt,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(Ft,{className:"w-4 h-4 text-gray-400 flex-shrink-0 mt-2"})]},P.id)),l&&c&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:c==="restore"?"E-Mail wiederherstellen?":"E-Mail endgültig löschen?"}),s.jsx("p",{className:"text-gray-600 mb-4",children:c==="restore"?"Die E-Mail wird wieder in den ursprünglichen Ordner verschoben.":"Die E-Mail wird unwiderruflich gelöscht. Diese Aktion kann nicht rückgängig gemacht werden."}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:v,disabled:x.isPending||m.isPending,children:"Abbrechen"}),s.jsx(T,{variant:c==="restore"?"primary":"danger",onClick:y,disabled:x.isPending||m.isPending,children:x.isPending||m.isPending?"Wird ausgeführt...":c==="restore"?"Wiederherstellen":"Endgültig löschen"})]})]})})]})}function ck({customerId:e}){const[t,n]=j.useState(null),[r,a]=j.useState("INBOX"),[i,l]=j.useState(null),[o,c]=j.useState(!1),[d,u]=j.useState(!1),[h,x]=j.useState(null),m=ge(),{hasPermission:f}=We(),p=f("emails:delete"),{data:b,isLoading:g}=fe({queryKey:["mailbox-accounts",e],queryFn:()=>Pe.getMailboxAccounts(e)}),y=(b==null?void 0:b.data)||[];j.useEffect(()=>{y.length>0&&!t&&n(y[0].id)},[y,t]);const v=y.find(de=>de.id===t),{data:N,isLoading:E,refetch:P}=fe({queryKey:["emails","customer",e,t,r],queryFn:()=>Pe.getForCustomer(e,{accountId:t||void 0,folder:r}),enabled:!!t&&r!=="TRASH"}),I=(N==null?void 0:N.data)||[],{data:w,isLoading:S}=fe({queryKey:["emails","trash",e],queryFn:()=>Pe.getTrash(e),enabled:r==="TRASH"&&p}),A=(w==null?void 0:w.data)||[],{data:O}=fe({queryKey:["folder-counts",t],queryFn:()=>xs.getFolderCounts(t),enabled:!!t}),R=(O==null?void 0:O.data)||{inbox:0,inboxUnread:0,sent:0,sentUnread:0,trash:0,trashUnread:0},{data:q}=fe({queryKey:["email",i==null?void 0:i.id],queryFn:()=>Pe.getById(i.id),enabled:!!(i!=null&&i.id)}),D=(q==null?void 0:q.data)||i,z=G({mutationFn:de=>xs.syncEmails(de),onSuccess:()=>{m.invalidateQueries({queryKey:["emails"]}),m.invalidateQueries({queryKey:["folder-counts",t]}),m.invalidateQueries({queryKey:["mailbox-accounts",e]})}}),k=()=>{t&&z.mutate(t)},K=de=>{l(de)},B=()=>{x(D||null),c(!0)},_=()=>{x(null),c(!0)},Q=()=>{u(!0)};if(!g&&y.length===0)return s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(nn,{className:"w-16 h-16 mb-4 opacity-30"}),s.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Keine E-Mail-Konten vorhanden"}),s.jsx("p",{className:"text-sm text-center max-w-md",children:"Erstellen Sie eine Stressfrei-Wechseln E-Mail-Adresse mit aktivierter Mailbox, um E-Mails hier empfangen und versenden zu können."})]});const le=de=>{a(de),l(null)};return s.jsxs("div",{className:"flex flex-col h-full",style:{minHeight:"600px"},children:[s.jsxs("div",{className:"flex items-center justify-between gap-4 p-4 border-b border-gray-200 bg-gray-50",children:[y.length>1?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ur,{className:"w-5 h-5 text-gray-500"}),s.jsx("select",{value:t||"",onChange:de=>{n(Number(de.target.value)),l(null)},className:"px-3 py-2 border border-gray-300 rounded-lg bg-white focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm",children:y.map(de=>s.jsx("option",{value:de.id,children:de.email},de.id))})]}):s.jsxs("div",{className:"flex items-center gap-3 text-sm text-gray-600",children:[s.jsx(Ur,{className:"w-5 h-5 text-gray-500"}),s.jsx("span",{children:v==null?void 0:v.email})]}),s.jsxs("div",{className:"flex items-center gap-1 bg-gray-200 rounded-lg p-1",children:[s.jsxs("button",{onClick:()=>le("INBOX"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors ${r==="INBOX"?"bg-white text-blue-600 shadow-sm font-medium":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Ur,{className:"w-4 h-4"}),"Posteingang",R.inbox>0&&s.jsx("span",{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full cursor-help ${R.inboxUnread>0?"bg-blue-100 text-blue-600 font-medium":"bg-gray-100 text-gray-500"}`,title:`${R.inboxUnread} ungelesen / ${R.inbox} gesamt`,children:R.inboxUnread>0?`${R.inboxUnread}/${R.inbox}`:R.inbox})]}),s.jsxs("button",{onClick:()=>le("SENT"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors ${r==="SENT"?"bg-white text-blue-600 shadow-sm font-medium":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Fl,{className:"w-4 h-4"}),"Gesendet",R.sent>0&&s.jsx("span",{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full cursor-help ${R.sentUnread>0?"bg-blue-100 text-blue-600 font-medium":"bg-gray-100 text-gray-500"}`,title:`${R.sentUnread} ungelesen / ${R.sent} gesamt`,children:R.sentUnread>0?`${R.sentUnread}/${R.sent}`:R.sent})]}),p&&s.jsxs("button",{onClick:()=>le("TRASH"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors ${r==="TRASH"?"bg-white text-red-600 shadow-sm font-medium":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Ne,{className:"w-4 h-4"}),"Papierkorb",R.trash>0&&s.jsx("span",{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full cursor-help ${R.trashUnread>0?"bg-red-100 text-red-600 font-medium":"bg-gray-100 text-gray-500"}`,title:`${R.trashUnread} ungelesen / ${R.trash} gesamt`,children:R.trashUnread>0?`${R.trashUnread}/${R.trash}`:R.trash})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[r!=="TRASH"&&s.jsxs(T,{variant:"secondary",size:"sm",onClick:k,disabled:z.isPending||!t,children:[s.jsx(Sr,{className:`w-4 h-4 mr-1 ${z.isPending?"animate-spin":""}`}),z.isPending?"Sync...":"Synchronisieren"]}),s.jsxs(T,{size:"sm",onClick:_,disabled:!v,children:[s.jsx(_e,{className:"w-4 h-4 mr-1"}),"Neue E-Mail"]})]})]}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsx("div",{className:"w-1/3 border-r border-gray-200 overflow-auto",children:r==="TRASH"?s.jsx(Ov,{emails:A,selectedEmailId:i==null?void 0:i.id,onSelectEmail:K,onEmailRestored:de=>{(i==null?void 0:i.id)===de&&l(null),m.invalidateQueries({queryKey:["emails"]}),m.invalidateQueries({queryKey:["folder-counts",t]})},onEmailDeleted:de=>{(i==null?void 0:i.id)===de&&l(null),m.invalidateQueries({queryKey:["emails","trash"]}),m.invalidateQueries({queryKey:["folder-counts",t]})},isLoading:S}):s.jsx(ak,{emails:I,selectedEmailId:i==null?void 0:i.id,onSelectEmail:K,onEmailDeleted:de=>{(i==null?void 0:i.id)===de&&l(null),m.invalidateQueries({queryKey:["folder-counts",t]})},isLoading:E,folder:r,accountId:t})}),s.jsx("div",{className:"flex-1 overflow-auto",children:D?s.jsx(Rv,{email:D,onReply:B,onAssignContract:Q,onDeleted:()=>{l(null),m.invalidateQueries({queryKey:["emails"]}),m.invalidateQueries({queryKey:["folder-counts",t]})},isSentFolder:r==="SENT",isTrashView:r==="TRASH",onRestored:()=>{l(null),m.invalidateQueries({queryKey:["emails"]}),m.invalidateQueries({queryKey:["folder-counts",t]})},accountId:t||void 0}):s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-500",children:[s.jsx(nn,{className:"w-12 h-12 mb-2 opacity-30"}),s.jsx("p",{children:"Wählen Sie eine E-Mail aus"})]})})]}),v&&s.jsx(Lv,{isOpen:o,onClose:()=>{c(!1),x(null)},account:v,replyTo:h||void 0,onSuccess:()=>{m.invalidateQueries({queryKey:["emails","customer",e,t,"SENT"]}),m.invalidateQueries({queryKey:["folder-counts",t]}),r==="SENT"&&P()}}),D&&s.jsx(ok,{isOpen:d,onClose:()=>u(!1),email:D,customerId:e,onSuccess:()=>{P()}})]})}function dk({contractId:e,customerId:t}){const[n,r]=j.useState(null),[a,i]=j.useState("INBOX"),[l,o]=j.useState(null),[c,d]=j.useState(!1),[u,h]=j.useState(null),[x,m]=j.useState(null),f=ge(),{hasPermission:p}=We(),b=p("emails:delete"),{data:g,isLoading:y}=fe({queryKey:["mailbox-accounts",t],queryFn:()=>Pe.getMailboxAccounts(t)}),v=(g==null?void 0:g.data)||[];j.useEffect(()=>{v.length>0&&!n&&r(v[0].id)},[v,n]);const N=v.find(J=>J.id===n),{data:E,isLoading:P,refetch:I}=fe({queryKey:["emails","contract",e,a],queryFn:()=>Pe.getForContract(e,{folder:a}),enabled:a!=="TRASH"}),w=(E==null?void 0:E.data)||[],{data:S,isLoading:A}=fe({queryKey:["emails","trash",t],queryFn:()=>Pe.getTrash(t),enabled:a==="TRASH"&&b}),O=(S==null?void 0:S.data)||[],{data:R}=fe({queryKey:["contract-folder-counts",e],queryFn:()=>Pe.getContractFolderCounts(e)}),q=(R==null?void 0:R.data)||{inbox:0,inboxUnread:0,sent:0,sentUnread:0},{data:D}=fe({queryKey:["folder-counts",n],queryFn:()=>xs.getFolderCounts(n),enabled:!!n&&b}),z=(D==null?void 0:D.data)||{trash:0,trashUnread:0},{data:k}=fe({queryKey:["email",l==null?void 0:l.id],queryFn:()=>Pe.getById(l.id),enabled:!!(l!=null&&l.id)}),K=(k==null?void 0:k.data)||l,B=G({mutationFn:J=>xs.syncEmails(J),onSuccess:()=>{f.invalidateQueries({queryKey:["emails"]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),n&&f.invalidateQueries({queryKey:["folder-counts",n]}),Re.success("Synchronisation abgeschlossen")},onError:J=>{Re.error(J.message||"Synchronisation fehlgeschlagen")}}),_=G({mutationFn:J=>Pe.toggleStar(J),onSuccess:(J,ue)=>{f.invalidateQueries({queryKey:["emails","contract",e]}),f.invalidateQueries({queryKey:["email",ue]})}}),Q=G({mutationFn:({emailId:J,isRead:ue})=>Pe.markAsRead(J,ue),onSuccess:(J,ue)=>{f.invalidateQueries({queryKey:["emails","contract",e]}),f.invalidateQueries({queryKey:["email",ue.emailId]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),n&&f.invalidateQueries({queryKey:["folder-counts",n]})}}),le=G({mutationFn:J=>Pe.unassignFromContract(J),onSuccess:()=>{f.invalidateQueries({queryKey:["emails","contract",e]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),o(null),Re.success("Zuordnung aufgehoben")},onError:J=>{Re.error(J.message||"Fehler beim Aufheben der Zuordnung")}}),de=G({mutationFn:J=>Pe.delete(J),onSuccess:(J,ue)=>{f.invalidateQueries({queryKey:["emails"]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),n&&f.invalidateQueries({queryKey:["folder-counts",n]}),Re.success("E-Mail in Papierkorb verschoben"),m(null),(l==null?void 0:l.id)===ue&&o(null)},onError:J=>{Re.error(J.message||"Fehler beim Löschen der E-Mail"),m(null)}}),Ke=()=>{n&&B.mutate(n)},Ve=J=>{const ue=new Date(J),ts=new Date;return ue.toDateString()===ts.toDateString()?ue.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"}):ue.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit"})},st=(J,ue)=>{J.stopPropagation(),_.mutate(ue)},C=(J,ue)=>{J.stopPropagation(),Q.mutate({emailId:ue.id,isRead:!ue.isRead})},nt=J=>{J.isRead||Q.mutate({emailId:J.id,isRead:!0}),o(J)},es=()=>{h(K||null),d(!0)},Vt=()=>{h(null),d(!0)},ae=(J,ue)=>{J.stopPropagation(),(l==null?void 0:l.id)===ue&&o(null),le.mutate(ue)},Ge=(J,ue)=>{J.stopPropagation(),m(ue)},xt=J=>{J.stopPropagation(),x&&de.mutate(x)},Z=J=>{J.stopPropagation(),m(null)},Fe=J=>{i(J),o(null)},Xe=J=>{if(a==="SENT")try{const ue=JSON.parse(J.toAddresses);if(ue.length>0)return`An: ${ue[0]}${ue.length>1?` (+${ue.length-1})`:""}`}catch{return"An: (Unbekannt)"}return J.fromName||J.fromAddress};return!y&&v.length===0?s.jsx(X,{title:"E-Mails",children:s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-gray-500",children:[s.jsx(nn,{className:"w-10 h-10 mb-2 opacity-30"}),s.jsx("p",{className:"text-sm",children:"Keine E-Mail-Konten vorhanden"}),s.jsx("p",{className:"text-xs mt-1",children:"Erstellen Sie eine E-Mail-Adresse beim Kunden mit aktivierter Mailbox"})]})}):s.jsxs(X,{title:s.jsx("div",{className:"flex items-center gap-4",children:s.jsx("span",{children:"E-Mails"})}),actions:s.jsxs("div",{className:"flex items-center gap-2",children:[a!=="TRASH"&&s.jsxs(T,{variant:"secondary",size:"sm",onClick:Ke,disabled:B.isPending||!n,children:[s.jsx(Sr,{className:`w-4 h-4 mr-1 ${B.isPending?"animate-spin":""}`}),B.isPending?"Sync...":"Sync"]}),N&&s.jsxs(T,{size:"sm",onClick:Vt,children:[s.jsx(_e,{className:"w-4 h-4 mr-1"}),"Neue E-Mail"]})]}),children:[s.jsxs("div",{className:"flex items-center justify-between gap-4 pb-4 border-b border-gray-200 -mt-2",children:[v.length>1?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ur,{className:"w-4 h-4 text-gray-500"}),s.jsx("select",{value:n||"",onChange:J=>{r(Number(J.target.value)),o(null)},className:"px-2 py-1.5 border border-gray-300 rounded-lg bg-white focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm",children:v.map(J=>s.jsx("option",{value:J.id,children:J.email},J.id))})]}):s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[s.jsx(Ur,{className:"w-4 h-4 text-gray-500"}),s.jsx("span",{children:N==null?void 0:N.email})]}),s.jsxs("div",{className:"flex items-center gap-1 bg-gray-200 rounded-lg p-1",children:[s.jsxs("button",{onClick:()=>Fe("INBOX"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors ${a==="INBOX"?"bg-white text-blue-600 shadow-sm font-medium":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Ur,{className:"w-4 h-4"}),"Posteingang",q.inbox>0&&s.jsx("span",{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full cursor-help ${q.inboxUnread>0?"bg-blue-100 text-blue-600 font-medium":"bg-gray-100 text-gray-500"}`,title:`${q.inboxUnread} ungelesen / ${q.inbox} gesamt`,children:q.inboxUnread>0?`${q.inboxUnread}/${q.inbox}`:q.inbox})]}),s.jsxs("button",{onClick:()=>Fe("SENT"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors ${a==="SENT"?"bg-white text-blue-600 shadow-sm font-medium":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Fl,{className:"w-4 h-4"}),"Gesendet",q.sent>0&&s.jsx("span",{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full cursor-help ${q.sentUnread>0?"bg-blue-100 text-blue-600 font-medium":"bg-gray-100 text-gray-500"}`,title:`${q.sentUnread} ungelesen / ${q.sent} gesamt`,children:q.sentUnread>0?`${q.sentUnread}/${q.sent}`:q.sent})]}),b&&s.jsxs("button",{onClick:()=>Fe("TRASH"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors ${a==="TRASH"?"bg-white text-red-600 shadow-sm font-medium":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Ne,{className:"w-4 h-4"}),"Papierkorb",z.trash>0&&s.jsx("span",{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full cursor-help ${z.trashUnread>0?"bg-red-100 text-red-600 font-medium":"bg-gray-100 text-gray-500"}`,title:`${z.trashUnread} ungelesen / ${z.trash} gesamt`,children:z.trashUnread>0?`${z.trashUnread}/${z.trash}`:z.trash})]})]})]}),(a==="TRASH"?A:P)?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"})}):(a==="TRASH"?O.length===0:w.length===0)?s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-gray-500",children:[s.jsx(nn,{className:"w-10 h-10 mb-2 opacity-30"}),s.jsx("p",{className:"text-sm",children:a==="INBOX"?"Keine E-Mails zugeordnet":a==="SENT"?"Keine E-Mails über diesen Vertrag gesendet":"Papierkorb ist leer"}),a==="INBOX"&&s.jsx("p",{className:"text-xs mt-1",children:"E-Mails können im E-Mail-Tab des Kunden zugeordnet werden"})]}):s.jsxs("div",{className:"flex -mx-6 -mb-6",style:{minHeight:"400px"},children:[s.jsx("div",{className:"w-1/3 border-r border-gray-200 overflow-auto",children:a==="TRASH"?s.jsx(Ov,{emails:O,selectedEmailId:l==null?void 0:l.id,onSelectEmail:nt,onEmailRestored:J=>{(l==null?void 0:l.id)===J&&o(null),f.invalidateQueries({queryKey:["emails"]}),f.invalidateQueries({queryKey:["folder-counts",n]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]})},onEmailDeleted:J=>{(l==null?void 0:l.id)===J&&o(null),f.invalidateQueries({queryKey:["emails","trash"]}),f.invalidateQueries({queryKey:["folder-counts",n]})},isLoading:A}):s.jsx("div",{className:"divide-y divide-gray-200",children:w.map(J=>s.jsxs("div",{onClick:()=>nt(J),className:["flex items-start gap-2 p-3 cursor-pointer transition-colors",(l==null?void 0:l.id)===J.id?"bg-blue-100":["hover:bg-gray-100",J.isRead?"bg-gray-50/50":"bg-white"].join(" ")].join(" "),style:{borderLeft:(l==null?void 0:l.id)===J.id?"4px solid #2563eb":"4px solid transparent"},children:[s.jsx("button",{onClick:ue=>C(ue,J),className:` + flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-gray-200 + ${J.isRead?"text-gray-400":"text-blue-600"} + `,title:J.isRead?"Als ungelesen markieren":"Als gelesen markieren",children:J.isRead?s.jsx(Pv,{className:"w-4 h-4"}):s.jsx(nn,{className:"w-4 h-4"})}),s.jsx("button",{onClick:ue=>st(ue,J.id),className:` + flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-gray-200 + ${J.isStarred?"text-yellow-500":"text-gray-400"} + `,title:J.isStarred?"Stern entfernen":"Als wichtig markieren",children:s.jsx(ph,{className:`w-4 h-4 ${J.isStarred?"fill-current":""}`})}),p("emails:delete")&&s.jsx("button",{onClick:ue=>Ge(ue,J.id),className:"flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-red-100 text-gray-400 hover:text-red-600",title:"E-Mail löschen",children:s.jsx(Ne,{className:"w-4 h-4"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[s.jsx("span",{className:`text-sm truncate ${J.isRead?"text-gray-700":"font-semibold text-gray-900"}`,children:Xe(J)}),s.jsx("span",{className:"text-xs text-gray-500 flex-shrink-0",children:Ve(J.receivedAt)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`text-sm truncate ${J.isRead?"text-gray-600":"font-medium text-gray-900"}`,children:J.subject||"(Kein Betreff)"}),J.hasAttachments&&s.jsx(Rc,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})]}),J.contract&&s.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[s.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800",children:J.contract.contractNumber}),(a==="INBOX"||a==="SENT"&&!J.isAutoAssigned)&&s.jsx("button",{onClick:ue=>ae(ue,J.id),className:"p-0.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded",title:"Zuordnung aufheben",disabled:le.isPending,children:s.jsx(qt,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(Ft,{className:"w-4 h-4 text-gray-400 flex-shrink-0 mt-2"})]},J.id))})}),s.jsx("div",{className:"flex-1 overflow-auto",children:K&&l?s.jsx(Rv,{email:K,onReply:es,onAssignContract:()=>{},onDeleted:()=>{o(null),f.invalidateQueries({queryKey:["emails"]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),n&&f.invalidateQueries({queryKey:["folder-counts",n]})},isSentFolder:a==="SENT",isContractView:a!=="TRASH",isTrashView:a==="TRASH",onRestored:()=>{o(null),f.invalidateQueries({queryKey:["emails"]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),n&&f.invalidateQueries({queryKey:["folder-counts",n]})},accountId:K==null?void 0:K.stressfreiEmailId}):s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-500",children:[s.jsx(nn,{className:"w-12 h-12 mb-2 opacity-30"}),s.jsx("p",{children:"Wählen Sie eine E-Mail aus"})]})})]}),x&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"E-Mail löschen?"}),s.jsx("p",{className:"text-gray-600 mb-4",children:"Die E-Mail wird in den Papierkorb verschoben."}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:Z,disabled:de.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:xt,disabled:de.isPending,children:de.isPending?"Löschen...":"Löschen"})]})]})}),N&&s.jsx(Lv,{isOpen:c,onClose:()=>{d(!1),h(null)},account:N,replyTo:u||void 0,contractId:e,onSuccess:()=>{f.invalidateQueries({queryKey:["emails","contract",e,"SENT"]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),a==="SENT"&&I()}})]})}function uk({tabs:e,defaultTab:t}){var a,i;const[n,r]=j.useState(t||((a=e[0])==null?void 0:a.id));return s.jsxs("div",{children:[s.jsx("div",{className:"border-b border-gray-200",children:s.jsx("nav",{className:"flex -mb-px space-x-8",children:e.map(l=>s.jsx("button",{onClick:()=>r(l.id),className:`py-4 px-1 border-b-2 font-medium text-sm whitespace-nowrap ${n===l.id?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:l.label},l.id))})}),s.jsx("div",{className:"mt-4",children:(i=e.find(l=>l.id===n))==null?void 0:i.content})]})}function Dt({onUpload:e,existingFile:t,accept:n=".pdf,.jpg,.jpeg,.png",label:r="Dokument hochladen",disabled:a=!1}){const i=j.useRef(null),[l,o]=j.useState(!1),[c,d]=j.useState(!1),u=async p=>{if(p){o(!0);try{await e(p)}catch(b){console.error("Upload failed:",b),alert("Upload fehlgeschlagen")}finally{o(!1)}}},h=p=>{var g;const b=(g=p.target.files)==null?void 0:g[0];b&&u(b)},x=p=>{var g;p.preventDefault(),d(!1);const b=(g=p.dataTransfer.files)==null?void 0:g[0];b&&u(b)},m=p=>{p.preventDefault(),d(!0)},f=()=>{d(!1)};return s.jsxs("div",{className:"space-y-2",children:[t?!a&&s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>{var p;return(p=i.current)==null?void 0:p.click()},disabled:l,children:l?"Wird hochgeladen...":"Ersetzen"}):s.jsx("div",{className:`border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors ${c?"border-blue-500 bg-blue-50":"border-gray-300 hover:border-gray-400"} ${a?"opacity-50 cursor-not-allowed":""}`,onClick:()=>{var p;return!a&&((p=i.current)==null?void 0:p.click())},onDrop:a?void 0:x,onDragOver:a?void 0:m,onDragLeave:a?void 0:f,children:l?s.jsxs("div",{className:"text-gray-500",children:[s.jsx("div",{className:"animate-spin w-6 h-6 border-2 border-blue-500 border-t-transparent rounded-full mx-auto mb-2"}),"Wird hochgeladen..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Hu,{className:"w-6 h-6 text-gray-400 mx-auto mb-2"}),s.jsx("p",{className:"text-sm text-gray-600",children:r}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"PDF, JPG oder PNG (max. 10MB)"})]})}),s.jsx("input",{ref:i,type:"file",accept:n,onChange:h,className:"hidden",disabled:a||l})]})}function oe({value:e,className:t="",size:n="sm",title:r="In Zwischenablage kopieren"}){const[a,i]=j.useState(!1),l=async c=>{c.preventDefault(),c.stopPropagation();try{await navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),1500)}catch(d){console.error("Failed to copy:",d)}},o=n==="sm"?"w-3.5 h-3.5":"w-4 h-4";return s.jsx("button",{type:"button",onClick:l,className:`inline-flex items-center justify-center p-1 rounded transition-colors ${a?"text-green-600 bg-green-50":"text-gray-400 hover:text-blue-600 hover:bg-blue-50"} ${t}`,title:a?"Kopiert!":r,children:a?s.jsx(xr,{className:o}):s.jsx(oh,{className:o})})}function Wu({values:e,separator:t=` +`,children:n,className:r=""}){const a=e.filter(i=>i!=null&&i!=="").map(String).join(t);return a?s.jsxs("div",{className:`relative group ${r}`,children:[n,s.jsx(oe,{value:a,className:"absolute top-0 right-0 opacity-60 group-hover:opacity-100",title:"Alles kopieren"})]}):s.jsx(s.Fragment,{children:n})}function mk(){var B,_;const{id:e}=Nc(),t=Yt(),n=ge(),{hasPermission:r}=We(),[a]=Sc(),i=parseInt(e),l=a.get("tab")||"addresses",[o,c]=j.useState(!1),[d,u]=j.useState(!1),[h,x]=j.useState(!1),[m,f]=j.useState(!1),[p,b]=j.useState(!1),[g,y]=j.useState(!1),[v,N]=j.useState(null),[E,P]=j.useState(null),[I,w]=j.useState(null),[S,A]=j.useState(null),[O,R]=j.useState(null),{data:q,isLoading:D}=fe({queryKey:["customer",e],queryFn:()=>At.getById(i)}),z=G({mutationFn:()=>At.delete(i),onSuccess:()=>{t("/customers")}});if(D)return s.jsx("div",{className:"text-center py-8",children:"Laden..."});if(!(q!=null&&q.data))return s.jsx("div",{className:"text-center py-8 text-red-600",children:"Kunde nicht gefunden"});const k=q.data,K=[{id:"addresses",label:"Adressen",content:s.jsx(pk,{customerId:i,addresses:k.addresses||[],canEdit:r("customers:update"),onAdd:()=>c(!0),onEdit:Q=>w(Q)})},{id:"bankcards",label:"Bankkarten",content:s.jsx(xk,{customerId:i,bankCards:k.bankCards||[],canEdit:r("customers:update"),showInactive:g,onToggleInactive:()=>y(!g),onAdd:()=>u(!0),onEdit:Q=>N(Q)})},{id:"documents",label:"Ausweise",content:s.jsx(gk,{customerId:i,documents:k.identityDocuments||[],canEdit:r("customers:update"),showInactive:g,onToggleInactive:()=>y(!g),onAdd:()=>x(!0),onEdit:Q=>P(Q)})},{id:"meters",label:"Zähler",content:s.jsx(yk,{customerId:i,meters:k.meters||[],canEdit:r("customers:update"),showInactive:g,onToggleInactive:()=>y(!g),onAdd:()=>f(!0),onEdit:Q=>A(Q)})},{id:"stressfrei",label:"Stressfrei-Wechseln",content:s.jsx(Nk,{customerId:i,emails:k.stressfreiEmails||[],canEdit:r("customers:update"),showInactive:g,onToggleInactive:()=>y(!g),onAdd:()=>b(!0),onEdit:Q=>R(Q)})},{id:"emails",label:"E-Mail-Postfach",content:s.jsx(ck,{customerId:i})},{id:"contracts",label:"Verträge",content:s.jsx(vk,{customerId:i})},...r("customers:update")?[{id:"portal",label:"Portal",content:s.jsx(bk,{customerId:i,canEdit:r("customers:update")})}]:[]];return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold",children:k.type==="BUSINESS"&&k.companyName?k.companyName:`${k.firstName} ${k.lastName}`}),s.jsxs("p",{className:"text-gray-500 font-mono flex items-center gap-1",children:[k.customerNumber,s.jsx(oe,{value:k.customerNumber})]})]}),s.jsxs("div",{className:"flex gap-2",children:[r("customers:update")&&s.jsx(ke,{to:`/customers/${e}/edit`,children:s.jsxs(T,{variant:"secondary",children:[s.jsx(He,{className:"w-4 h-4 mr-2"}),"Bearbeiten"]})}),r("customers:delete")&&s.jsxs(T,{variant:"danger",onClick:()=>{confirm("Kunde wirklich löschen?")&&z.mutate()},children:[s.jsx(Ne,{className:"w-4 h-4 mr-2"}),"Löschen"]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6",children:[s.jsx(X,{title:"Stammdaten",className:"lg:col-span-2",children:s.jsxs("dl",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Typ"}),s.jsx("dd",{children:s.jsx(ve,{variant:k.type==="BUSINESS"?"info":"default",children:k.type==="BUSINESS"?"Geschäftskunde":"Privatkunde"})})]}),k.salutation&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Anrede"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[k.salutation,s.jsx(oe,{value:k.salutation})]})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vorname"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[k.firstName,s.jsx(oe,{value:k.firstName})]})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Nachname"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[k.lastName,s.jsx(oe,{value:k.lastName})]})]}),k.companyName&&s.jsxs("div",{className:"col-span-2",children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Firma"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[k.companyName,s.jsx(oe,{value:k.companyName})]})]}),k.foundingDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Gründungsdatum"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[new Date(k.foundingDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),s.jsx(oe,{value:new Date(k.foundingDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]})]}),k.birthDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Geburtsdatum"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[new Date(k.birthDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),s.jsx(oe,{value:new Date(k.birthDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]})]}),k.birthPlace&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Geburtsort"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[k.birthPlace,s.jsx(oe,{value:k.birthPlace})]})]})]})}),s.jsx(X,{title:"Kontakt",children:s.jsxs("dl",{className:"space-y-3",children:[k.email&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"E-Mail"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[s.jsx("a",{href:`mailto:${k.email}`,className:"text-blue-600 hover:underline",children:k.email}),s.jsx(oe,{value:k.email})]})]}),k.phone&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Telefon"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[s.jsx("a",{href:`tel:${k.phone}`,className:"text-blue-600 hover:underline",children:k.phone}),s.jsx(oe,{value:k.phone})]})]}),k.mobile&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Mobil"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[s.jsx("a",{href:`tel:${k.mobile}`,className:"text-blue-600 hover:underline",children:k.mobile}),s.jsx(oe,{value:k.mobile})]})]})]})})]}),k.type==="BUSINESS"&&s.jsx(hk,{customer:k,canEdit:r("customers:update"),onUpdate:()=>n.invalidateQueries({queryKey:["customer",e]})}),s.jsx(fk,{customer:k,canEdit:r("customers:update"),onUpdate:()=>n.invalidateQueries({queryKey:["customer",e]})}),k.notes&&s.jsx(X,{title:"Notizen",className:"mb-6",children:s.jsx("p",{className:"whitespace-pre-wrap",children:k.notes})}),s.jsx(X,{children:s.jsx(uk,{tabs:K,defaultTab:l})}),s.jsx(gx,{isOpen:o,onClose:()=>c(!1),customerId:i}),s.jsx(gx,{isOpen:!!I,onClose:()=>w(null),customerId:i,address:I}),s.jsx(yx,{isOpen:d,onClose:()=>u(!1),customerId:i}),s.jsx(yx,{isOpen:!!v,onClose:()=>N(null),customerId:i,bankCard:v}),s.jsx(vx,{isOpen:h,onClose:()=>x(!1),customerId:i}),s.jsx(vx,{isOpen:!!E,onClose:()=>P(null),customerId:i,document:E}),s.jsx(jx,{isOpen:m,onClose:()=>f(!1),customerId:i}),s.jsx(jx,{isOpen:!!S,onClose:()=>A(null),customerId:i,meter:S}),s.jsx(Nx,{isOpen:p,onClose:()=>b(!1),customerId:i,customerEmail:(B=q==null?void 0:q.data)==null?void 0:B.email}),s.jsx(Nx,{isOpen:!!O,onClose:()=>R(null),customerId:i,email:O,customerEmail:(_=q==null?void 0:q.data)==null?void 0:_.email})]})}function hk({customer:e,canEdit:t,onUpdate:n}){const r=async c=>{try{await ut.uploadBusinessRegistration(e.id,c),n()}catch(d){console.error("Upload fehlgeschlagen:",d),alert("Upload fehlgeschlagen")}},a=async()=>{if(confirm("Gewerbeanmeldung wirklich löschen?"))try{await ut.deleteBusinessRegistration(e.id),n()}catch(c){console.error("Löschen fehlgeschlagen:",c),alert("Löschen fehlgeschlagen")}},i=async c=>{try{await ut.uploadCommercialRegister(e.id,c),n()}catch(d){console.error("Upload fehlgeschlagen:",d),alert("Upload fehlgeschlagen")}},l=async()=>{if(confirm("Handelsregisterauszug wirklich löschen?"))try{await ut.deleteCommercialRegister(e.id),n()}catch(c){console.error("Löschen fehlgeschlagen:",c),alert("Löschen fehlgeschlagen")}};return!(e.taxNumber||e.commercialRegisterNumber||e.businessRegistrationPath||e.commercialRegisterPath)&&!t?null:s.jsxs(X,{title:"Geschäftsdaten",className:"mb-6",children:[s.jsxs("dl",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.taxNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Steuernummer"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[e.taxNumber,s.jsx(oe,{value:e.taxNumber})]})]}),e.commercialRegisterNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Handelsregisternummer"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[e.commercialRegisterNumber,s.jsx(oe,{value:e.commercialRegisterNumber})]})]})]}),s.jsxs("div",{className:"mt-4 pt-4 border-t grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Gewerbeanmeldung"}),e.businessRegistrationPath?s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("a",{href:`/api${e.businessRegistrationPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ae,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${e.businessRegistrationPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ps,{className:"w-4 h-4"}),"Download"]}),t&&s.jsxs(s.Fragment,{children:[s.jsx(Dt,{onUpload:r,existingFile:e.businessRegistrationPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:a,className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]})]}):t?s.jsx(Dt,{onUpload:r,accept:".pdf",label:"PDF hochladen"}):s.jsx("p",{className:"text-sm text-gray-400",children:"Nicht vorhanden"})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Handelsregisterauszug"}),e.commercialRegisterPath?s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("a",{href:`/api${e.commercialRegisterPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ae,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${e.commercialRegisterPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ps,{className:"w-4 h-4"}),"Download"]}),t&&s.jsxs(s.Fragment,{children:[s.jsx(Dt,{onUpload:i,existingFile:e.commercialRegisterPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:l,className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]})]}):t?s.jsx(Dt,{onUpload:i,accept:".pdf",label:"PDF hochladen"}):s.jsx("p",{className:"text-sm text-gray-400",children:"Nicht vorhanden"})]})]})]})}function fk({customer:e,canEdit:t,onUpdate:n}){const r=async i=>{try{await ut.uploadPrivacyPolicy(e.id,i),n()}catch(l){console.error("Upload fehlgeschlagen:",l),alert("Upload fehlgeschlagen")}},a=async()=>{if(confirm("Datenschutzerklärung wirklich löschen?"))try{await ut.deletePrivacyPolicy(e.id),n()}catch(i){console.error("Löschen fehlgeschlagen:",i),alert("Löschen fehlgeschlagen")}};return!e.privacyPolicyPath&&!t?null:s.jsx(X,{title:"Dokumente",className:"mb-6",children:s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Datenschutzerklärung"}),e.privacyPolicyPath?s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("a",{href:`/api${e.privacyPolicyPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ae,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${e.privacyPolicyPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ps,{className:"w-4 h-4"}),"Download"]}),t&&s.jsxs(s.Fragment,{children:[s.jsx(Dt,{onUpload:r,existingFile:e.privacyPolicyPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:a,className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]})]}):t?s.jsx(Dt,{onUpload:r,accept:".pdf",label:"PDF hochladen"}):s.jsx("p",{className:"text-sm text-gray-400",children:"Nicht vorhanden"})]})})}function pk({customerId:e,addresses:t,canEdit:n,onAdd:r,onEdit:a}){const i=ge(),l=G({mutationFn:Qu.delete,onSuccess:()=>i.invalidateQueries({queryKey:["customer",e.toString()]})});return s.jsxs("div",{children:[n&&s.jsx("div",{className:"mb-4",children:s.jsxs(T,{size:"sm",onClick:r,children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Adresse hinzufügen"]})}),t.length>0?s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:t.map(o=>s.jsxs("div",{className:"border rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(K2,{className:"w-4 h-4 text-gray-400"}),s.jsx(ve,{variant:o.type==="BILLING"?"info":"default",children:o.type==="BILLING"?"Rechnung":"Liefer-/Meldeadresse"}),o.isDefault&&s.jsx(ve,{variant:"success",children:"Standard"})]}),n&&s.jsxs("div",{className:"flex gap-1",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>a(o),title:"Bearbeiten",children:s.jsx(He,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Adresse wirklich löschen?")&&l.mutate(o.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]}),s.jsxs(Wu,{values:[`${o.street} ${o.houseNumber}`,`${o.postalCode} ${o.city}`,o.country],children:[s.jsxs("p",{children:[o.street," ",o.houseNumber]}),s.jsxs("p",{children:[o.postalCode," ",o.city]}),s.jsx("p",{className:"text-gray-500",children:o.country})]})]},o.id))}):s.jsx("p",{className:"text-gray-500",children:"Keine Adressen vorhanden."})]})}function xk({customerId:e,bankCards:t,canEdit:n,showInactive:r,onToggleInactive:a,onAdd:i,onEdit:l}){const o=ge(),c=G({mutationFn:({id:m,data:f})=>Yo.update(m,f),onSuccess:()=>o.invalidateQueries({queryKey:["customer",e.toString()]})}),d=G({mutationFn:Yo.delete,onSuccess:()=>o.invalidateQueries({queryKey:["customer",e.toString()]})}),u=async(m,f)=>{try{await ut.uploadBankCardDocument(m,f),o.invalidateQueries({queryKey:["customer",e.toString()]})}catch(p){console.error("Upload fehlgeschlagen:",p),alert("Upload fehlgeschlagen")}},h=async m=>{if(confirm("Dokument wirklich löschen?"))try{await ut.deleteBankCardDocument(m),o.invalidateQueries({queryKey:["customer",e.toString()]})}catch(f){console.error("Löschen fehlgeschlagen:",f),alert("Löschen fehlgeschlagen")}},x=r?t:t.filter(m=>m.isActive);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[n&&s.jsxs(T,{size:"sm",onClick:i,children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Bankkarte hinzufügen"]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:a,className:"rounded"}),"Inaktive anzeigen"]})]}),x.length>0?s.jsx("div",{className:"space-y-4",children:x.map(m=>s.jsxs("div",{className:`border rounded-lg p-4 ${m.isActive?"":"opacity-50 bg-gray-50"}`,children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(ch,{className:"w-4 h-4 text-gray-400"}),!m.isActive&&s.jsx(ve,{variant:"danger",children:"Inaktiv"}),m.expiryDate&&new Date(m.expiryDate)l(m),title:"Bearbeiten",children:s.jsx(He,{className:"w-4 h-4"})}),m.isActive?s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Bankkarte deaktivieren?")&&c.mutate({id:m.id,data:{isActive:!1}})},title:"Deaktivieren",children:s.jsx(It,{className:"w-4 h-4"})}):s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Bankkarte wieder aktivieren?")&&c.mutate({id:m.id,data:{isActive:!0}})},title:"Aktivieren",children:s.jsx(Ae,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Bankkarte wirklich löschen?")&&d.mutate(m.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]}),s.jsxs("p",{className:"font-medium flex items-center gap-1",children:[m.accountHolder,s.jsx(oe,{value:m.accountHolder})]}),s.jsxs("p",{className:"font-mono flex items-center gap-1",children:[m.iban,s.jsx(oe,{value:m.iban})]}),m.bic&&s.jsxs("p",{className:"text-sm text-gray-500 flex items-center gap-1",children:["BIC: ",m.bic,s.jsx(oe,{value:m.bic})]}),m.bankName&&s.jsxs("p",{className:"text-sm text-gray-500 flex items-center gap-1",children:[m.bankName,s.jsx(oe,{value:m.bankName})]}),m.expiryDate&&s.jsxs("p",{className:"text-sm text-gray-500",children:["Gültig bis: ",new Date(m.expiryDate).toLocaleDateString("de-DE")]}),s.jsx("div",{className:"mt-3 pt-3 border-t",children:m.documentPath?s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("a",{href:`/api${m.documentPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ae,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${m.documentPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ps,{className:"w-4 h-4"}),"Download"]}),n&&s.jsxs(s.Fragment,{children:[s.jsx(Dt,{onUpload:f=>u(m.id,f),existingFile:m.documentPath,accept:".pdf",label:"Ersetzen",disabled:!m.isActive}),s.jsxs("button",{onClick:()=>h(m.id),className:"text-red-600 hover:underline text-sm flex items-center gap-1",title:"Dokument löschen",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]})]}):n&&m.isActive&&s.jsx(Dt,{onUpload:f=>u(m.id,f),accept:".pdf",label:"PDF hochladen"})})]},m.id))}):s.jsx("p",{className:"text-gray-500",children:"Keine Bankkarten vorhanden."})]})}function gk({customerId:e,documents:t,canEdit:n,showInactive:r,onToggleInactive:a,onAdd:i,onEdit:l}){const o=ge(),c=G({mutationFn:({id:f,data:p})=>ec.update(f,p),onSuccess:()=>o.invalidateQueries({queryKey:["customer",e.toString()]})}),d=G({mutationFn:ec.delete,onSuccess:()=>o.invalidateQueries({queryKey:["customer",e.toString()]})}),u=async(f,p)=>{try{await ut.uploadIdentityDocument(f,p),o.invalidateQueries({queryKey:["customer",e.toString()]})}catch(b){console.error("Upload fehlgeschlagen:",b),alert("Upload fehlgeschlagen")}},h=async f=>{if(confirm("Dokument wirklich löschen?"))try{await ut.deleteIdentityDocument(f),o.invalidateQueries({queryKey:["customer",e.toString()]})}catch(p){console.error("Löschen fehlgeschlagen:",p),alert("Löschen fehlgeschlagen")}},x=r?t:t.filter(f=>f.isActive),m={ID_CARD:"Personalausweis",PASSPORT:"Reisepass",DRIVERS_LICENSE:"Führerschein",OTHER:"Sonstiges"};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[n&&s.jsxs(T,{size:"sm",onClick:i,children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Ausweis hinzufügen"]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:a,className:"rounded"}),"Inaktive anzeigen"]})]}),x.length>0?s.jsx("div",{className:"space-y-4",children:x.map(f=>s.jsxs("div",{className:`border rounded-lg p-4 ${f.isActive?"":"opacity-50 bg-gray-50"}`,children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(Be,{className:"w-4 h-4 text-gray-400"}),s.jsx(ve,{children:m[f.type]}),!f.isActive&&s.jsx(ve,{variant:"danger",children:"Inaktiv"}),f.expiryDate&&new Date(f.expiryDate)l(f),title:"Bearbeiten",children:s.jsx(He,{className:"w-4 h-4"})}),f.isActive?s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Ausweis deaktivieren?")&&c.mutate({id:f.id,data:{isActive:!1}})},title:"Deaktivieren",children:s.jsx(It,{className:"w-4 h-4"})}):s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Ausweis wieder aktivieren?")&&c.mutate({id:f.id,data:{isActive:!0}})},title:"Aktivieren",children:s.jsx(Ae,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Ausweis wirklich löschen?")&&d.mutate(f.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]}),s.jsxs("p",{className:"font-mono flex items-center gap-1",children:[f.documentNumber,s.jsx(oe,{value:f.documentNumber})]}),f.issuingAuthority&&s.jsxs("p",{className:"text-sm text-gray-500 flex items-center gap-1",children:["Ausgestellt von: ",f.issuingAuthority,s.jsx(oe,{value:f.issuingAuthority})]}),f.expiryDate&&s.jsxs("p",{className:"text-sm text-gray-500",children:["Gültig bis: ",new Date(f.expiryDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})]}),f.type==="DRIVERS_LICENSE"&&f.licenseClasses&&s.jsxs("p",{className:"text-sm text-gray-500 flex items-center gap-1",children:["Klassen: ",f.licenseClasses,s.jsx(oe,{value:f.licenseClasses})]}),f.type==="DRIVERS_LICENSE"&&f.licenseIssueDate&&s.jsxs("p",{className:"text-sm text-gray-500",children:["Klasse B seit: ",new Date(f.licenseIssueDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})]}),s.jsx("div",{className:"mt-3 pt-3 border-t",children:f.documentPath?s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("a",{href:`/api${f.documentPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ae,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${f.documentPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ps,{className:"w-4 h-4"}),"Download"]}),n&&s.jsxs(s.Fragment,{children:[s.jsx(Dt,{onUpload:p=>u(f.id,p),existingFile:f.documentPath,accept:".pdf",label:"Ersetzen",disabled:!f.isActive}),s.jsxs("button",{onClick:()=>h(f.id),className:"text-red-600 hover:underline text-sm flex items-center gap-1",title:"Dokument löschen",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]})]}):n&&f.isActive&&s.jsx(Dt,{onUpload:p=>u(f.id,p),accept:".pdf",label:"PDF hochladen"})})]},f.id))}):s.jsx("p",{className:"text-gray-500",children:"Keine Ausweise vorhanden."})]})}function yk({customerId:e,meters:t,canEdit:n,showInactive:r,onToggleInactive:a,onAdd:i,onEdit:l}){const[o,c]=j.useState(null),[d,u]=j.useState(null),[h,x]=j.useState(null),m=ge(),f=G({mutationFn:({id:v,data:N})=>ln.update(v,N),onSuccess:()=>m.invalidateQueries({queryKey:["customer",e.toString()]})}),p=G({mutationFn:ln.delete,onSuccess:()=>m.invalidateQueries({queryKey:["customer",e.toString()]})}),b=G({mutationFn:({meterId:v,readingId:N})=>ln.deleteReading(v,N),onSuccess:()=>m.invalidateQueries({queryKey:["customer",e.toString()]})}),g=r?t:t.filter(v=>v.isActive),y=v=>v?[...v].sort((N,E)=>new Date(E.readingDate).getTime()-new Date(N.readingDate).getTime()):[];return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[n&&s.jsxs(T,{size:"sm",onClick:i,children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Zähler hinzufügen"]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:a,className:"rounded"}),"Inaktive anzeigen"]})]}),g.length>0?s.jsx("div",{className:"space-y-4",children:g.map(v=>{const N=y(v.readings),E=d===v.id;return s.jsxs("div",{className:`border rounded-lg p-4 ${v.isActive?"":"opacity-50 bg-gray-50"}`,children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(Dv,{className:"w-4 h-4 text-gray-400"}),s.jsx(ve,{variant:v.type==="ELECTRICITY"?"warning":"info",children:v.type==="ELECTRICITY"?"Strom":"Gas"}),!v.isActive&&s.jsx(ve,{variant:"danger",children:"Inaktiv"})]}),n&&s.jsxs("div",{className:"flex gap-1",children:[v.isActive&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>c({meterId:v.id,meterType:v.type}),title:"Zählerstand hinzufügen",children:s.jsx(_e,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>l(v),title:"Bearbeiten",children:s.jsx(He,{className:"w-4 h-4"})}),v.isActive?s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Zähler deaktivieren?")&&f.mutate({id:v.id,data:{isActive:!1}})},title:"Deaktivieren",children:s.jsx(It,{className:"w-4 h-4"})}):s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Zähler wieder aktivieren?")&&f.mutate({id:v.id,data:{isActive:!0}})},title:"Aktivieren",children:s.jsx(Ae,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Zähler wirklich löschen? Alle Zählerstände werden ebenfalls gelöscht.")&&p.mutate(v.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]}),s.jsxs("p",{className:"font-mono text-lg flex items-center gap-1",children:[v.meterNumber,s.jsx(oe,{value:v.meterNumber})]}),v.location&&s.jsxs("p",{className:"text-sm text-gray-500 flex items-center gap-1",children:["Standort: ",v.location,s.jsx(oe,{value:v.location})]}),N.length>0&&s.jsxs("div",{className:"mt-3 pt-3 border-t",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:"text-sm font-medium",children:"Zählerstände:"}),N.length>3&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>u(E?null:v.id),children:E?"Weniger anzeigen":`Alle ${N.length} anzeigen`})]}),s.jsx("div",{className:"space-y-1",children:(E?N:N.slice(0,3)).map(P=>s.jsxs("div",{className:"flex justify-between items-center text-sm group",children:[s.jsxs("span",{className:"text-gray-500 flex items-center gap-1",children:[new Date(P.readingDate).toLocaleDateString("de-DE"),s.jsx(oe,{value:new Date(P.readingDate).toLocaleDateString("de-DE")})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"font-mono flex items-center gap-1",children:[P.value.toLocaleString("de-DE")," ",P.unit,s.jsx(oe,{value:P.value.toString(),title:"Nur Wert kopieren"}),s.jsx(oe,{value:`${P.value.toLocaleString("de-DE")} ${P.unit}`,title:"Mit Einheit kopieren"})]}),n&&s.jsxs("div",{className:"opacity-0 group-hover:opacity-100 flex gap-1",children:[s.jsx("button",{onClick:()=>x({meterId:v.id,meterType:v.type,reading:P}),className:"text-gray-400 hover:text-blue-600",title:"Bearbeiten",children:s.jsx(He,{className:"w-3 h-3"})}),s.jsx("button",{onClick:()=>{confirm("Zählerstand wirklich löschen?")&&b.mutate({meterId:v.id,readingId:P.id})},className:"text-gray-400 hover:text-red-600",title:"Löschen",children:s.jsx(Ne,{className:"w-3 h-3"})})]})]})]},P.id))})]})]},v.id)})}):s.jsx("p",{className:"text-gray-500",children:"Keine Zähler vorhanden."}),o&&s.jsx(bx,{isOpen:!0,onClose:()=>c(null),meterId:o.meterId,meterType:o.meterType,customerId:e}),h&&s.jsx(bx,{isOpen:!0,onClose:()=>x(null),meterId:h.meterId,meterType:h.meterType,customerId:e,reading:h.reading})]})}function vk({customerId:e}){const{hasPermission:t}=We(),n=Yt(),r=ge(),[a,i]=j.useState(new Set),[l,o]=j.useState(!1),{data:c,isLoading:d}=fe({queryKey:["contract-tree",e],queryFn:()=>Oe.getTreeForCustomer(e)}),u=(c==null?void 0:c.data)||[],h=G({mutationFn:Oe.delete,onSuccess:()=>{r.invalidateQueries({queryKey:["customer",e.toString()]}),r.invalidateQueries({queryKey:["customers"]}),r.invalidateQueries({queryKey:["contracts"]}),r.invalidateQueries({queryKey:["contract-tree",e]})},onError:y=>{alert((y==null?void 0:y.message)||"Fehler beim Löschen des Vertrags")}}),x={ELECTRICITY:"Strom",GAS:"Gas",DSL:"DSL",FIBER:"Glasfaser",MOBILE:"Mobilfunk",TV:"TV",CAR_INSURANCE:"KFZ-Versicherung"},m={ACTIVE:"success",PENDING:"warning",CANCELLED:"danger",EXPIRED:"danger",DRAFT:"default",DEACTIVATED:"default"},f=[{status:"DRAFT",label:"Entwurf",description:"Vertrag wird noch vorbereitet",color:"text-gray-600"},{status:"PENDING",label:"Ausstehend",description:"Wartet auf Aktivierung",color:"text-yellow-600"},{status:"ACTIVE",label:"Aktiv",description:"Vertrag läuft normal",color:"text-green-600"},{status:"EXPIRED",label:"Abgelaufen",description:"Laufzeit vorbei, läuft aber ohne Kündigung weiter",color:"text-orange-600"},{status:"CANCELLED",label:"Gekündigt",description:"Aktive Kündigung eingereicht, Vertrag endet",color:"text-red-600"},{status:"DEACTIVATED",label:"Deaktiviert",description:"Manuell beendet/archiviert",color:"text-gray-500"}],p=y=>{i(v=>{const N=new Set(v);return N.has(y)?N.delete(y):N.add(y),N})},b=(y,v)=>y.map(N=>s.jsx("div",{children:g(N,v)},N.contract.id)),g=(y,v=0)=>{var S,A,O,R,q,D,z;const{contract:N,predecessors:E,hasHistory:P}=y,I=a.has(N.id),w=v>0;return s.jsxs("div",{children:[s.jsxs("div",{className:` + border rounded-lg p-4 transition-colors + ${w?"ml-6 border-l-4 border-l-gray-300 bg-gray-50":"hover:bg-gray-50"} + `,children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[!w&&P?s.jsx("button",{onClick:()=>p(N.id),className:"p-1 hover:bg-gray-200 rounded transition-colors",title:I?"Einklappen":"Vorgänger anzeigen",children:I?s.jsx(dn,{className:"w-4 h-4 text-gray-500"}):s.jsx(Ft,{className:"w-4 h-4 text-gray-500"})}):w?null:s.jsx("div",{className:"w-6"}),s.jsxs("span",{className:"font-mono flex items-center gap-1",children:[N.contractNumber,s.jsx(oe,{value:N.contractNumber})]}),s.jsx(ve,{children:x[N.type]||N.type}),s.jsx(ve,{variant:m[N.status]||"default",children:N.status}),v===0&&!w&&s.jsx("button",{onClick:k=>{k.stopPropagation(),o(!0)},className:"text-gray-400 hover:text-blue-600 transition-colors",title:"Status-Erklärung",children:s.jsx(Ml,{className:"w-4 h-4"})}),w&&s.jsx("span",{className:"text-xs text-gray-500 ml-2",children:"(Vorgänger)"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>n(`/contracts/${N.id}`,{state:{from:"customer",customerId:e.toString()}}),title:"Ansehen",children:s.jsx(Ae,{className:"w-4 h-4"})}),t("contracts:update")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>n(`/contracts/${N.id}/edit`),title:"Bearbeiten",children:s.jsx(He,{className:"w-4 h-4"})}),t("contracts:delete")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Vertrag wirklich löschen?")&&h.mutate(N.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]}),(N.providerName||((S=N.provider)==null?void 0:S.name))&&s.jsxs("p",{className:`flex items-center gap-1 ${w?"ml-6":""}`,children:[N.providerName||((A=N.provider)==null?void 0:A.name),(N.tariffName||((O=N.tariff)==null?void 0:O.name))&&` - ${N.tariffName||((R=N.tariff)==null?void 0:R.name)}`,s.jsx(oe,{value:(N.providerName||((q=N.provider)==null?void 0:q.name)||"")+(N.tariffName||(D=N.tariff)!=null&&D.name?` - ${N.tariffName||((z=N.tariff)==null?void 0:z.name)}`:"")})]}),N.startDate&&s.jsxs("p",{className:`text-sm text-gray-500 ${w?"ml-6":""}`,children:["Beginn: ",new Date(N.startDate).toLocaleDateString("de-DE"),N.endDate&&` | Ende: ${new Date(N.endDate).toLocaleDateString("de-DE")}`]})]}),(v===0&&I||v>0)&&E.length>0&&s.jsx("div",{className:"mt-2",children:b(E,v+1)})]},N.id)};return d?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"})}):s.jsxs("div",{children:[t("contracts:create")&&s.jsx("div",{className:"mb-4",children:s.jsx(ke,{to:`/contracts/new?customerId=${e}`,children:s.jsxs(T,{size:"sm",children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Vertrag anlegen"]})})}),u.length>0?s.jsx("div",{className:"space-y-4",children:u.map(y=>g(y,0))}):s.jsx("p",{className:"text-gray-500",children:"Keine Verträge vorhanden."}),l&&s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[s.jsx("div",{className:"fixed inset-0 bg-black/20",onClick:()=>o(!1)}),s.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl p-4 max-w-sm w-full mx-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Vertragsstatus-Übersicht"}),s.jsx("button",{onClick:()=>o(!1),className:"text-gray-400 hover:text-gray-600",children:s.jsx(qt,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"space-y-2",children:f.map(({status:y,label:v,description:N,color:E})=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:`font-medium text-sm min-w-[90px] ${E}`,children:v}),s.jsx("span",{className:"text-sm text-gray-600",children:N})]},y))})]})]})]})}function jk({customerId:e}){const[t,n]=j.useState(!1),[r,a]=j.useState(null),[i,l]=j.useState(!1),o=async()=>{var c;if(t){n(!1);return}l(!0);try{const d=await At.getPortalPassword(e);a(((c=d.data)==null?void 0:c.password)||null),n(!0)}catch(d){console.error("Fehler beim Laden des Passworts:",d),alert("Fehler beim Laden des Passworts")}finally{l(!1)}};return s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsx("p",{className:"text-xs text-green-600",children:"Passwort ist gesetzt"}),s.jsx("button",{type:"button",onClick:o,className:"text-xs text-blue-600 hover:underline flex items-center gap-1",disabled:i,children:i?"Laden...":t?s.jsxs(s.Fragment,{children:[s.jsx(It,{className:"w-3 h-3"}),"Verbergen"]}):s.jsxs(s.Fragment,{children:[s.jsx(Ae,{className:"w-3 h-3"}),"Anzeigen"]})}),t&&r&&s.jsxs("span",{className:"text-xs font-mono bg-gray-100 px-2 py-1 rounded flex items-center gap-1",children:[r,s.jsx(oe,{value:r})]}),t&&!r&&s.jsx("span",{className:"text-xs text-gray-500",children:"(Passwort nicht verfügbar)"})]})}function bk({customerId:e,canEdit:t}){const n=ge(),[r,a]=j.useState(!1),[i,l]=j.useState(""),[o,c]=j.useState(""),[d,u]=j.useState([]),[h,x]=j.useState(!1),{data:m,isLoading:f}=fe({queryKey:["customer-portal",e],queryFn:()=>At.getPortalSettings(e)}),{data:p,isLoading:b}=fe({queryKey:["customer-representatives",e],queryFn:()=>At.getRepresentatives(e)}),g=G({mutationFn:w=>At.updatePortalSettings(e,w),onSuccess:()=>{n.invalidateQueries({queryKey:["customer-portal",e]})}}),y=G({mutationFn:w=>At.setPortalPassword(e,w),onSuccess:()=>{l(""),n.invalidateQueries({queryKey:["customer-portal",e]}),alert("Passwort wurde gesetzt")},onError:w=>{alert(w.message)}}),v=G({mutationFn:w=>At.addRepresentative(e,w),onSuccess:()=>{n.invalidateQueries({queryKey:["customer-representatives",e]}),c(""),u([])},onError:w=>{alert(w.message)}}),N=G({mutationFn:w=>At.removeRepresentative(e,w),onSuccess:()=>{n.invalidateQueries({queryKey:["customer-representatives",e]})}}),E=async()=>{if(!(o.length<2)){x(!0);try{const w=await At.searchForRepresentative(e,o);u(w.data||[])}catch(w){console.error("Suche fehlgeschlagen:",w)}finally{x(!1)}}};if(f||b)return s.jsx("div",{className:"text-center py-4 text-gray-500",children:"Laden..."});const P=m==null?void 0:m.data,I=(p==null?void 0:p.data)||[];return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"border rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsx(uh,{className:"w-5 h-5 text-gray-400"}),s.jsx("h3",{className:"font-medium",children:"Portal-Zugang"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("label",{className:"flex items-center gap-3",children:[s.jsx("input",{type:"checkbox",checked:(P==null?void 0:P.portalEnabled)||!1,onChange:w=>g.mutate({portalEnabled:w.target.checked}),className:"rounded w-5 h-5",disabled:!t}),s.jsx("span",{children:"Portal aktiviert"}),(P==null?void 0:P.portalEnabled)&&s.jsx(ve,{variant:"success",children:"Aktiv"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Portal E-Mail"}),s.jsx("div",{className:"flex gap-2",children:s.jsx(H,{value:(P==null?void 0:P.portalEmail)||"",onChange:w=>g.mutate({portalEmail:w.target.value||null}),placeholder:"portal@example.com",disabled:!t||!(P!=null&&P.portalEnabled),className:"flex-1"})}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Diese E-Mail wird für den Login ins Kundenportal verwendet."})]}),(P==null?void 0:P.portalEnabled)&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:P!=null&&P.hasPassword?"Neues Passwort setzen":"Passwort setzen"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(H,{type:r?"text":"password",value:i,onChange:w=>l(w.target.value),placeholder:"Mindestens 6 Zeichen",disabled:!t}),s.jsx("button",{type:"button",onClick:()=>a(!r),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400",children:r?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Ae,{className:"w-4 h-4"})})]}),s.jsx(T,{onClick:()=>y.mutate(i),disabled:!t||i.length<6||y.isPending,children:y.isPending?"Speichern...":"Setzen"})]}),(P==null?void 0:P.hasPassword)&&s.jsx(jk,{customerId:e})]}),(P==null?void 0:P.portalLastLogin)&&s.jsxs("p",{className:"text-sm text-gray-500",children:["Letzte Anmeldung: ",new Date(P.portalLastLogin).toLocaleString("de-DE")]})]})]}),s.jsxs("div",{className:"border rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsx(G2,{className:"w-5 h-5 text-gray-400"}),s.jsx("h3",{className:"font-medium",children:"Vertreter (können Verträge einsehen)"})]}),s.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Hier können Sie anderen Kunden erlauben, die Verträge dieses Kunden einzusehen. Beispiel: Der Sohn kann die Verträge seiner Mutter einsehen."}),t&&s.jsxs("div",{className:"mb-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(H,{value:o,onChange:w=>c(w.target.value),placeholder:"Kunden suchen (Name, Kundennummer)...",onKeyDown:w=>w.key==="Enter"&&E(),className:"flex-1"}),s.jsx(T,{variant:"secondary",onClick:E,disabled:o.length<2||h,children:s.jsx(Tl,{className:"w-4 h-4"})})]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Nur Kunden mit aktiviertem Portal können als Vertreter hinzugefügt werden."}),d.length>0&&s.jsx("div",{className:"mt-2 border rounded-lg divide-y",children:d.map(w=>s.jsxs("div",{className:"flex items-center justify-between p-3 hover:bg-gray-50",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:w.companyName||`${w.firstName} ${w.lastName}`}),s.jsx("p",{className:"text-sm text-gray-500",children:w.customerNumber})]}),s.jsxs(T,{size:"sm",onClick:()=>v.mutate(w.id),disabled:v.isPending,children:[s.jsx(_e,{className:"w-4 h-4 mr-1"}),"Hinzufügen"]})]},w.id))})]}),I.length>0?s.jsx("div",{className:"space-y-2",children:I.map(w=>{var S,A,O,R;return s.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:((S=w.representative)==null?void 0:S.companyName)||`${(A=w.representative)==null?void 0:A.firstName} ${(O=w.representative)==null?void 0:O.lastName}`}),s.jsx("p",{className:"text-sm text-gray-500",children:(R=w.representative)==null?void 0:R.customerNumber})]}),t&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Vertreter wirklich entfernen?")&&N.mutate(w.representativeId)},children:s.jsx(qt,{className:"w-4 h-4 text-red-500"})})]},w.id)})}):s.jsx("p",{className:"text-gray-500 text-sm",children:"Keine Vertreter konfiguriert."})]})]})}function gx({isOpen:e,onClose:t,customerId:n,address:r}){const a=ge(),i=!!r,l=()=>({type:(r==null?void 0:r.type)||"DELIVERY_RESIDENCE",street:(r==null?void 0:r.street)||"",houseNumber:(r==null?void 0:r.houseNumber)||"",postalCode:(r==null?void 0:r.postalCode)||"",city:(r==null?void 0:r.city)||"",country:(r==null?void 0:r.country)||"Deutschland",isDefault:(r==null?void 0:r.isDefault)||!1}),[o,c]=j.useState(l),d=G({mutationFn:m=>Qu.create(n,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t(),c({type:"DELIVERY_RESIDENCE",street:"",houseNumber:"",postalCode:"",city:"",country:"Deutschland",isDefault:!1})}}),u=G({mutationFn:m=>Qu.update(r.id,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t()}}),h=m=>{m.preventDefault(),i?u.mutate(o):d.mutate(o)},x=d.isPending||u.isPending;return i&&o.street!==r.street&&c(l()),s.jsx(qe,{isOpen:e,onClose:t,title:i?"Adresse bearbeiten":"Adresse hinzufügen",children:s.jsxs("form",{onSubmit:h,className:"space-y-4",children:[s.jsx(Ie,{label:"Adresstyp",value:o.type,onChange:m=>c({...o,type:m.target.value}),options:[{value:"DELIVERY_RESIDENCE",label:"Liefer-/Meldeadresse"},{value:"BILLING",label:"Rechnungsadresse"}]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx("div",{className:"col-span-2",children:s.jsx(H,{label:"Straße",value:o.street,onChange:m=>c({...o,street:m.target.value}),required:!0})}),s.jsx(H,{label:"Hausnr.",value:o.houseNumber,onChange:m=>c({...o,houseNumber:m.target.value}),required:!0})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx(H,{label:"PLZ",value:o.postalCode,onChange:m=>c({...o,postalCode:m.target.value}),required:!0}),s.jsx("div",{className:"col-span-2",children:s.jsx(H,{label:"Ort",value:o.city,onChange:m=>c({...o,city:m.target.value}),required:!0})})]}),s.jsx(H,{label:"Land",value:o.country,onChange:m=>c({...o,country:m.target.value})}),s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:o.isDefault,onChange:m=>c({...o,isDefault:m.target.checked}),className:"rounded"}),"Als Standard setzen"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:x,children:x?"Speichern...":"Speichern"})]})]})})}function yx({isOpen:e,onClose:t,customerId:n,bankCard:r}){const a=ge(),i=!!r,l=()=>({accountHolder:(r==null?void 0:r.accountHolder)||"",iban:(r==null?void 0:r.iban)||"",bic:(r==null?void 0:r.bic)||"",bankName:(r==null?void 0:r.bankName)||"",expiryDate:r!=null&&r.expiryDate?new Date(r.expiryDate).toISOString().split("T")[0]:"",isActive:(r==null?void 0:r.isActive)??!0}),[o,c]=j.useState(l);j.useState(()=>{c(l())});const d=G({mutationFn:m=>Yo.create(n,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t(),c({accountHolder:"",iban:"",bic:"",bankName:"",expiryDate:"",isActive:!0})}}),u=G({mutationFn:m=>Yo.update(r.id,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t()}}),h=m=>{m.preventDefault();const f={...o,expiryDate:o.expiryDate?new Date(o.expiryDate):void 0};i?u.mutate(f):d.mutate(f)},x=d.isPending||u.isPending;return i&&o.iban!==r.iban&&c(l()),s.jsx(qe,{isOpen:e,onClose:t,title:i?"Bankkarte bearbeiten":"Bankkarte hinzufügen",children:s.jsxs("form",{onSubmit:h,className:"space-y-4",children:[s.jsx(H,{label:"Kontoinhaber",value:o.accountHolder,onChange:m=>c({...o,accountHolder:m.target.value}),required:!0}),s.jsx(H,{label:"IBAN",value:o.iban,onChange:m=>c({...o,iban:m.target.value}),required:!0}),s.jsx(H,{label:"BIC",value:o.bic,onChange:m=>c({...o,bic:m.target.value})}),s.jsx(H,{label:"Bank",value:o.bankName,onChange:m=>c({...o,bankName:m.target.value})}),s.jsx(H,{label:"Ablaufdatum",type:"date",value:o.expiryDate,onChange:m=>c({...o,expiryDate:m.target.value}),onClear:()=>c({...o,expiryDate:""})}),i&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:o.isActive,onChange:m=>c({...o,isActive:m.target.checked}),className:"rounded"}),"Aktiv"]}),!i&&s.jsx("p",{className:"text-sm text-gray-500 bg-gray-50 p-3 rounded",children:"Dokument-Upload ist nach dem Speichern in der Übersicht möglich."}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:x,children:x?"Speichern...":"Speichern"})]})]})})}function vx({isOpen:e,onClose:t,customerId:n,document:r}){const a=ge(),i=!!r,l=()=>({type:(r==null?void 0:r.type)||"ID_CARD",documentNumber:(r==null?void 0:r.documentNumber)||"",issuingAuthority:(r==null?void 0:r.issuingAuthority)||"",issueDate:r!=null&&r.issueDate?new Date(r.issueDate).toISOString().split("T")[0]:"",expiryDate:r!=null&&r.expiryDate?new Date(r.expiryDate).toISOString().split("T")[0]:"",isActive:(r==null?void 0:r.isActive)??!0,licenseClasses:(r==null?void 0:r.licenseClasses)||"",licenseIssueDate:r!=null&&r.licenseIssueDate?new Date(r.licenseIssueDate).toISOString().split("T")[0]:""}),[o,c]=j.useState(l),d=G({mutationFn:m=>ec.create(n,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t(),c({type:"ID_CARD",documentNumber:"",issuingAuthority:"",issueDate:"",expiryDate:"",isActive:!0,licenseClasses:"",licenseIssueDate:""})}}),u=G({mutationFn:m=>ec.update(r.id,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t()}}),h=m=>{m.preventDefault();const f={...o,issueDate:o.issueDate?new Date(o.issueDate):void 0,expiryDate:o.expiryDate?new Date(o.expiryDate):void 0};o.type==="DRIVERS_LICENSE"?(f.licenseClasses=o.licenseClasses||void 0,f.licenseIssueDate=o.licenseIssueDate?new Date(o.licenseIssueDate):void 0):(delete f.licenseClasses,delete f.licenseIssueDate),i?u.mutate(f):d.mutate(f)},x=d.isPending||u.isPending;return i&&o.documentNumber!==r.documentNumber&&c(l()),s.jsx(qe,{isOpen:e,onClose:t,title:i?"Ausweis bearbeiten":"Ausweis hinzufügen",children:s.jsxs("form",{onSubmit:h,className:"space-y-4",children:[s.jsx(Ie,{label:"Ausweistyp",value:o.type,onChange:m=>c({...o,type:m.target.value}),options:[{value:"ID_CARD",label:"Personalausweis"},{value:"PASSPORT",label:"Reisepass"},{value:"DRIVERS_LICENSE",label:"Führerschein"},{value:"OTHER",label:"Sonstiges"}]}),s.jsx(H,{label:"Ausweisnummer",value:o.documentNumber,onChange:m=>c({...o,documentNumber:m.target.value}),required:!0}),s.jsx(H,{label:"Ausstellende Behörde",value:o.issuingAuthority,onChange:m=>c({...o,issuingAuthority:m.target.value})}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(H,{label:"Ausstellungsdatum",type:"date",value:o.issueDate,onChange:m=>c({...o,issueDate:m.target.value}),onClear:()=>c({...o,issueDate:""})}),s.jsx(H,{label:"Ablaufdatum",type:"date",value:o.expiryDate,onChange:m=>c({...o,expiryDate:m.target.value}),onClear:()=>c({...o,expiryDate:""})})]}),o.type==="DRIVERS_LICENSE"&&s.jsxs(s.Fragment,{children:[s.jsx(H,{label:"Führerscheinklassen",value:o.licenseClasses,onChange:m=>c({...o,licenseClasses:m.target.value}),placeholder:"z.B. B, BE, AM, L"}),s.jsx(H,{label:"Erwerb Klasse B (Pkw)",type:"date",value:o.licenseIssueDate,onChange:m=>c({...o,licenseIssueDate:m.target.value}),onClear:()=>c({...o,licenseIssueDate:""})})]}),i&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:o.isActive,onChange:m=>c({...o,isActive:m.target.checked}),className:"rounded"}),"Aktiv"]}),!i&&s.jsx("p",{className:"text-sm text-gray-500 bg-gray-50 p-3 rounded",children:"Dokument-Upload ist nach dem Speichern in der Übersicht möglich."}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:x,children:x?"Speichern...":"Speichern"})]})]})})}function jx({isOpen:e,onClose:t,customerId:n,meter:r}){const a=ge(),i=!!r,l=()=>({meterNumber:(r==null?void 0:r.meterNumber)||"",type:(r==null?void 0:r.type)||"ELECTRICITY",location:(r==null?void 0:r.location)||"",isActive:(r==null?void 0:r.isActive)??!0}),[o,c]=j.useState(l),d=G({mutationFn:m=>ln.create(n,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t(),c({meterNumber:"",type:"ELECTRICITY",location:"",isActive:!0})}}),u=G({mutationFn:m=>ln.update(r.id,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t()}}),h=m=>{m.preventDefault(),i?u.mutate(o):d.mutate(o)},x=d.isPending||u.isPending;return i&&o.meterNumber!==r.meterNumber&&c(l()),s.jsx(qe,{isOpen:e,onClose:t,title:i?"Zähler bearbeiten":"Zähler hinzufügen",children:s.jsxs("form",{onSubmit:h,className:"space-y-4",children:[s.jsx(H,{label:"Zählernummer",value:o.meterNumber,onChange:m=>c({...o,meterNumber:m.target.value}),required:!0}),s.jsx(Ie,{label:"Zählertyp",value:o.type,onChange:m=>c({...o,type:m.target.value}),options:[{value:"ELECTRICITY",label:"Strom"},{value:"GAS",label:"Gas"}]}),s.jsx(H,{label:"Standort",value:o.location,onChange:m=>c({...o,location:m.target.value}),placeholder:"z.B. Keller, Wohnung"}),i&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:o.isActive,onChange:m=>c({...o,isActive:m.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:x,children:x?"Speichern...":"Speichern"})]})]})})}function bx({isOpen:e,onClose:t,meterId:n,meterType:r,customerId:a,reading:i}){const l=ge(),o=!!i,c=r==="ELECTRICITY"?"kWh":"m³",d=()=>{var b;return{readingDate:i!=null&&i.readingDate?new Date(i.readingDate).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],value:((b=i==null?void 0:i.value)==null?void 0:b.toString())||"",notes:(i==null?void 0:i.notes)||""}},[u,h]=j.useState(d),x=G({mutationFn:b=>ln.addReading(n,b),onSuccess:()=>{l.invalidateQueries({queryKey:["customer",a.toString()]}),t()}}),m=G({mutationFn:b=>ln.updateReading(n,i.id,b),onSuccess:()=>{l.invalidateQueries({queryKey:["customer",a.toString()]}),t()}}),f=b=>{b.preventDefault();const g={readingDate:new Date(u.readingDate),value:parseFloat(u.value),unit:c,notes:u.notes||void 0};o?m.mutate(g):x.mutate(g)},p=x.isPending||m.isPending;return o&&u.value!==i.value.toString()&&h(d()),s.jsx(qe,{isOpen:e,onClose:t,title:o?"Zählerstand bearbeiten":"Zählerstand erfassen",children:s.jsxs("form",{onSubmit:f,className:"space-y-4",children:[s.jsx(H,{label:"Ablesedatum",type:"date",value:u.readingDate,onChange:b=>h({...u,readingDate:b.target.value}),required:!0}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx("div",{className:"col-span-2",children:s.jsx(H,{label:"Zählerstand",type:"number",step:"0.01",value:u.value,onChange:b=>h({...u,value:b.target.value}),required:!0})}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Einheit"}),s.jsx("div",{className:"h-10 flex items-center px-3 bg-gray-100 border border-gray-300 rounded-md text-gray-700",children:c})]})]}),s.jsx(H,{label:"Notizen",value:u.notes,onChange:b=>h({...u,notes:b.target.value}),placeholder:"Optionale Notizen..."}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:p,children:p?"Speichern...":"Speichern"})]})]})})}const gd="@stressfrei-wechseln.de";function Nk({customerId:e,emails:t,canEdit:n,showInactive:r,onToggleInactive:a,onAdd:i,onEdit:l}){const o=ge(),c=G({mutationFn:({id:h,data:x})=>xs.update(h,x),onSuccess:()=>o.invalidateQueries({queryKey:["customer",e.toString()]})}),d=G({mutationFn:xs.delete,onSuccess:()=>o.invalidateQueries({queryKey:["customer",e.toString()]})}),u=r?t:t.filter(h=>h.isActive);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[n&&s.jsxs(T,{size:"sm",onClick:i,children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Adresse hinzufügen"]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:a,className:"rounded"}),"Inaktive anzeigen"]})]}),s.jsxs("p",{className:"text-sm text-gray-500 mb-4 bg-blue-50 border border-blue-200 rounded-lg p-3",children:[s.jsx("strong",{children:"Hinweis:"})," Hier werden E-Mail-Weiterleitungsadressen verwaltet, die für die Registrierung bei Anbietern verwendet werden. E-Mails an diese Adressen werden sowohl an den Kunden als auch an Sie weitergeleitet."]}),u.length>0?s.jsx("div",{className:"space-y-3",children:u.map(h=>s.jsx("div",{className:`border rounded-lg p-4 ${h.isActive?"":"opacity-50 bg-gray-50"}`,children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(nn,{className:"w-4 h-4 text-gray-400"}),s.jsx("span",{className:"font-mono text-sm",children:h.email}),s.jsx(oe,{value:h.email}),!h.isActive&&s.jsx(ve,{variant:"danger",children:"Inaktiv"})]}),h.notes&&s.jsxs("div",{className:"flex items-center gap-2 mt-1 text-sm text-gray-500",children:[s.jsx(Be,{className:"w-4 h-4 flex-shrink-0"}),s.jsx("span",{children:h.notes})]})]}),n&&s.jsxs("div",{className:"flex gap-1",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>l(h),title:"Bearbeiten",children:s.jsx(He,{className:"w-4 h-4"})}),h.isActive?s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Adresse deaktivieren?")&&c.mutate({id:h.id,data:{isActive:!1}})},title:"Deaktivieren",children:s.jsx(It,{className:"w-4 h-4"})}):s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Adresse wieder aktivieren?")&&c.mutate({id:h.id,data:{isActive:!0}})},title:"Aktivieren",children:s.jsx(Ae,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Adresse wirklich löschen?")&&d.mutate(h.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]})},h.id))}):s.jsx("p",{className:"text-gray-500",children:"Keine Stressfrei-Wechseln Adressen vorhanden."})]})}function wk({credentials:e,onHide:t,onResetPassword:n,isResettingPassword:r}){const[a,i]=j.useState(null),l=async(u,h)=>{try{await navigator.clipboard.writeText(u),i(h),setTimeout(()=>i(null),2e3)}catch{const x=document.createElement("textarea");x.value=u,document.body.appendChild(x),x.select(),document.execCommand("copy"),document.body.removeChild(x),i(h),setTimeout(()=>i(null),2e3)}},o=({text:u,fieldName:h})=>s.jsx("button",{type:"button",onClick:()=>l(u,h),className:"p-1.5 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors",title:"In Zwischenablage kopieren",children:a===h?s.jsx(xr,{className:"w-4 h-4 text-green-600"}):s.jsx(oh,{className:"w-4 h-4"})}),c=e.imap?`${e.imap.server}:${e.imap.port}`:"",d=e.smtp?`${e.smtp.server}:${e.smtp.port}`:"";return s.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4 space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Zugangsdaten"}),s.jsx("button",{type:"button",onClick:t,className:"text-gray-400 hover:text-gray-600 p-1 hover:bg-gray-200 rounded",title:"Zugangsdaten ausblenden",children:s.jsx(It,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"bg-white rounded-lg p-3 border border-gray-100",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Benutzername"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"text-sm text-gray-900 font-mono flex-1 break-all",children:e.email}),s.jsx(o,{text:e.email,fieldName:"email"})]})]}),s.jsxs("div",{className:"bg-white rounded-lg p-3 border border-gray-100",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Passwort"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"text-sm text-gray-900 font-mono flex-1 break-all",children:e.password}),s.jsx(o,{text:e.password,fieldName:"password"})]}),s.jsx("button",{type:"button",onClick:n,disabled:r,className:"mt-2 text-xs text-blue-600 hover:text-blue-800 disabled:opacity-50",children:r?"Generiere...":"Neu generieren"})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.imap&&s.jsxs("div",{className:"bg-white rounded-lg p-3 border border-gray-100",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"IMAP (Empfang)"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"text-sm text-gray-900 font-mono flex-1",children:c}),s.jsx(o,{text:c,fieldName:"imap"})]}),s.jsx("span",{className:"text-xs text-gray-400 mt-1 block",children:e.imap.encryption})]}),e.smtp&&s.jsxs("div",{className:"bg-white rounded-lg p-3 border border-gray-100",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"SMTP (Versand)"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"text-sm text-gray-900 font-mono flex-1",children:d}),s.jsx(o,{text:d,fieldName:"smtp"})]}),s.jsx("span",{className:"text-xs text-gray-400 mt-1 block",children:e.smtp.encryption})]})]})]})}function Nx({isOpen:e,onClose:t,customerId:n,email:r,customerEmail:a}){const[i,l]=j.useState(""),[o,c]=j.useState(""),[d,u]=j.useState(!1),[h,x]=j.useState(!1),[m,f]=j.useState(null),[p,b]=j.useState("idle"),[g,y]=j.useState(!1),[v,N]=j.useState(!1),[E,P]=j.useState(!1),[I,w]=j.useState(!1),[S,A]=j.useState(null),[O,R]=j.useState(!1),[q,D]=j.useState(!1),z=ge(),k=!!r,{data:K}=fe({queryKey:["email-provider-configs"],queryFn:()=>yn.getConfigs(),enabled:e}),B=((K==null?void 0:K.data)||[]).some(ae=>ae.isActive&&ae.isDefault),_=ae=>{if(!ae)return"";const Ge=ae.indexOf("@");return Ge>0?ae.substring(0,Ge):ae},Q=async ae=>{var Ge;if(!(!B||!ae)){b("checking");try{const xt=await yn.checkEmailExists(ae);b((Ge=xt.data)!=null&&Ge.exists?"exists":"not_exists")}catch{b("error")}}},le=async()=>{var ae,Ge;if(!(!a||!i)){y(!0),f(null);try{const xt=await yn.provisionEmail(i,a);(ae=xt.data)!=null&&ae.success?b("exists"):f(((Ge=xt.data)==null?void 0:Ge.error)||"Provisionierung fehlgeschlagen")}catch(xt){f(xt instanceof Error?xt.message:"Fehler bei der Provisionierung")}finally{y(!1)}}},de=async()=>{if(r){N(!0),f(null);try{const ae=await xs.enableMailbox(r.id);ae.success?(P(!0),z.invalidateQueries({queryKey:["customer",n.toString()]}),z.invalidateQueries({queryKey:["mailbox-accounts",n]})):f(ae.error||"Mailbox-Aktivierung fehlgeschlagen")}catch(ae){f(ae instanceof Error?ae.message:"Fehler bei der Mailbox-Aktivierung")}finally{N(!1)}}},Ke=async()=>{if(r)try{const ae=await xs.syncMailboxStatus(r.id);ae.success&&ae.data&&(P(ae.data.hasMailbox),ae.data.wasUpdated&&z.invalidateQueries({queryKey:["customer",n.toString()]}))}catch(ae){console.error("Fehler beim Synchronisieren des Mailbox-Status:",ae)}},Ve=async()=>{if(r){R(!0);try{const ae=await xs.getMailboxCredentials(r.id);ae.success&&ae.data&&(A(ae.data),w(!0))}catch(ae){console.error("Fehler beim Laden der Zugangsdaten:",ae)}finally{R(!1)}}},st=async()=>{if(r&&confirm("Neues Passwort generieren? Das alte Passwort wird ungültig.")){D(!0);try{const ae=await xs.resetPassword(r.id);ae.success&&ae.data?(S&&A({...S,password:ae.data.password}),alert("Passwort wurde erfolgreich zurückgesetzt.")):alert(ae.error||"Fehler beim Zurücksetzen des Passworts")}catch(ae){console.error("Fehler beim Zurücksetzen des Passworts:",ae),alert(ae instanceof Error?ae.message:"Fehler beim Zurücksetzen des Passworts")}finally{D(!1)}}};j.useEffect(()=>{if(e){if(r){const ae=_(r.email);l(ae),c(r.notes||""),b("idle"),P(r.hasMailbox||!1),B&&(Q(ae),Ke())}else l(""),c(""),u(!1),x(!1),b("idle"),P(!1);f(null),w(!1),A(null)}},[e,r,B]);const C=G({mutationFn:async ae=>xs.create(n,{email:ae.email,notes:ae.notes,provisionAtProvider:ae.provision,createMailbox:ae.createMailbox}),onSuccess:()=>{z.invalidateQueries({queryKey:["customer",n.toString()]}),z.invalidateQueries({queryKey:["mailbox-accounts",n]}),l(""),c(""),u(!1),x(!1),t()},onError:ae=>{f(ae instanceof Error?ae.message:"Fehler bei der Provisionierung")}}),nt=G({mutationFn:ae=>xs.update(r.id,ae),onSuccess:()=>{z.invalidateQueries({queryKey:["customer",n.toString()]}),t()}}),es=ae=>{ae.preventDefault(),f(null);const Ge=i+gd;k?nt.mutate({email:Ge,notes:o||void 0}):C.mutate({email:Ge,notes:o||void 0,provision:d,createMailbox:d&&h})},Vt=C.isPending||nt.isPending;return s.jsx(qe,{isOpen:e,onClose:t,title:k?"Adresse bearbeiten":"Adresse hinzufügen",children:s.jsxs("form",{onSubmit:es,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"E-Mail-Adresse"}),s.jsxs("div",{className:"flex",children:[s.jsx("input",{type:"text",value:i,onChange:ae=>l(ae.target.value.toLowerCase().replace(/[^a-z0-9._-]/g,"")),placeholder:"kunde-freenet",required:!0,className:"block w-full px-3 py-2 border border-gray-300 rounded-l-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("span",{className:"inline-flex items-center px-3 py-2 border border-l-0 border-gray-300 bg-gray-100 text-gray-600 rounded-r-lg text-sm",children:gd})]}),s.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Vollständige Adresse: ",s.jsxs("span",{className:"font-mono",children:[i||"...",gd]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Notizen (optional)"}),s.jsx("textarea",{value:o,onChange:ae=>c(ae.target.value),rows:3,className:"block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"z.B. für Freenet-Konten, für Klarmobil..."})]}),B&&a&&s.jsx("div",{className:"bg-blue-50 p-3 rounded-lg",children:k?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-medium text-gray-700",children:"E-Mail-Provider Status"}),p==="checking"&&s.jsx("span",{className:"text-xs text-gray-500",children:"Prüfe..."}),p==="exists"&&s.jsxs("span",{className:"text-xs text-green-600 flex items-center gap-1",children:[s.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),"Beim Provider vorhanden"]}),p==="not_exists"&&s.jsx("span",{className:"text-xs text-orange-600",children:"Nicht beim Provider angelegt"}),p==="error"&&s.jsx("span",{className:"text-xs text-red-600",children:"Status konnte nicht geprüft werden"})]}),p==="not_exists"&&s.jsxs("div",{className:"pt-2 border-t border-blue-100",children:[s.jsxs("p",{className:"text-xs text-gray-500 mb-2",children:["Die E-Mail-Weiterleitung ist noch nicht auf dem Server eingerichtet. Weiterleitungsziel: ",a]}),s.jsx(T,{type:"button",size:"sm",onClick:le,disabled:g,children:g?"Wird angelegt...":"Jetzt beim Provider anlegen"})]}),p==="error"&&s.jsx(T,{type:"button",size:"sm",variant:"secondary",onClick:()=>Q(i),children:"Erneut prüfen"}),p==="exists"&&s.jsxs("div",{className:"pt-3 mt-3 border-t border-blue-100",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Mailbox (IMAP/SMTP)"}),E?s.jsxs("span",{className:"text-xs text-green-600 flex items-center gap-1",children:[s.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),"Mailbox aktiv"]}):s.jsx("span",{className:"text-xs text-orange-600",children:"Keine Mailbox"})]}),!E&&s.jsxs("div",{className:"mt-2",children:[s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"Aktiviere eine echte Mailbox um E-Mails direkt im CRM zu empfangen und zu versenden."}),s.jsx(T,{type:"button",size:"sm",onClick:de,disabled:v,children:v?"Wird aktiviert...":"Mailbox aktivieren"})]}),E&&s.jsx("div",{className:"mt-3",children:I?S&&s.jsx(wk,{credentials:S,onHide:()=>w(!1),onResetPassword:st,isResettingPassword:q}):s.jsx(T,{type:"button",size:"sm",variant:"secondary",onClick:Ve,disabled:O,children:O?"Laden...":s.jsxs(s.Fragment,{children:[s.jsx(Ae,{className:"w-4 h-4 mr-1"}),"Zugangsdaten anzeigen"]})})})]})]}):s.jsxs("div",{className:"space-y-3",children:[s.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:d,onChange:ae=>{u(ae.target.checked),ae.target.checked||x(!1)},className:"mt-1 rounded border-gray-300"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Beim E-Mail-Provider anlegen"}),s.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Die E-Mail-Weiterleitung wird automatisch auf dem konfigurierten Server erstellt. Weiterleitungsziel: ",a]})]})]}),d&&s.jsxs("label",{className:"flex items-start gap-2 cursor-pointer ml-6",children:[s.jsx("input",{type:"checkbox",checked:h,onChange:ae=>x(ae.target.checked),className:"mt-1 rounded border-gray-300"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Echte Mailbox erstellen (IMAP/SMTP-Zugang)"}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Ermöglicht E-Mails direkt im CRM zu empfangen und zu versenden."})]})]})]})}),m&&s.jsx("div",{className:"bg-red-50 p-3 rounded-lg text-red-700 text-sm",children:m}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:Vt||!i,children:Vt?"Speichern...":"Speichern"})]})]})})}var Il=e=>e.type==="checkbox",Pr=e=>e instanceof Date,as=e=>e==null;const zv=e=>typeof e=="object";var jt=e=>!as(e)&&!Array.isArray(e)&&zv(e)&&!Pr(e),Sk=e=>jt(e)&&e.target?Il(e.target)?e.target.checked:e.target.value:e,kk=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Ck=(e,t)=>e.has(kk(t)),Ek=e=>{const t=e.constructor&&e.constructor.prototype;return jt(t)&&t.hasOwnProperty("isPrototypeOf")},gh=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function bt(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(gh&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(jt(e)&&Ek(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=bt(e[a]));return r}var Lc=e=>/^\w*$/.test(e),rt=e=>e===void 0,yh=e=>Array.isArray(e)?e.filter(Boolean):[],vh=e=>yh(e.replace(/["|']|\]/g,"").split(/\.|\[/)),xe=(e,t,n)=>{if(!t||!jt(e))return n;const r=(Lc(t)?[t]:vh(t)).reduce((a,i)=>as(a)?a:a[i],e);return rt(r)||r===e?rt(e[t])?n:e[t]:r},Js=e=>typeof e=="boolean",_s=e=>typeof e=="function",Ye=(e,t,n)=>{let r=-1;const a=Lc(t)?[t]:vh(t),i=a.length,l=i-1;for(;++r{const a={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(a,i,{get:()=>{const l=i;return t._proxyFormState[l]!==Ks.all&&(t._proxyFormState[l]=!r||Ks.all),e[l]}});return a};const Pk=typeof window<"u"?Tt.useLayoutEffect:Tt.useEffect;var gs=e=>typeof e=="string",Mk=(e,t,n,r,a)=>gs(e)?(r&&t.watch.add(e),xe(n,e,a)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),xe(n,i))):(r&&(t.watchAll=!0),n),Gu=e=>as(e)||!zv(e);function qn(e,t,n=new WeakSet){if(Gu(e)||Gu(t))return Object.is(e,t);if(Pr(e)&&Pr(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const i of r){const l=e[i];if(!a.includes(i))return!1;if(i!=="ref"){const o=t[i];if(Pr(l)&&Pr(o)||jt(l)&&jt(o)||Array.isArray(l)&&Array.isArray(o)?!qn(l,o,n):!Object.is(l,o))return!1}}return!0}const Tk=Tt.createContext(null);Tk.displayName="HookFormContext";var Fk=(e,t,n,r,a)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:a||!0}}:{},Oi=e=>Array.isArray(e)?e:[e],Sx=()=>{let e=[];return{get observers(){return e},next:a=>{for(const i of e)i.next&&i.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(i=>i!==a)}}),unsubscribe:()=>{e=[]}}};function $v(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const a=e[r],i=t[r];if(a&&jt(a)&&i){const l=$v(a,i);jt(l)&&(n[r]=l)}else e[r]&&(n[r]=i)}return n}var Wt=e=>jt(e)&&!Object.keys(e).length,jh=e=>e.type==="file",sc=e=>{if(!gh)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},_v=e=>e.type==="select-multiple",bh=e=>e.type==="radio",Ik=e=>bh(e)||Il(e),yd=e=>sc(e)&&e.isConnected;function Rk(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{for(const t in e)if(_s(e[t]))return!0;return!1};function Kv(e){return Array.isArray(e)||jt(e)&&!Ok(e)}function Zu(e,t={}){for(const n in e){const r=e[n];Kv(r)?(t[n]=Array.isArray(r)?[]:{},Zu(r,t[n])):rt(r)||(t[n]=!0)}return t}function ia(e,t,n){n||(n=Zu(t));for(const r in e){const a=e[r];if(Kv(a))rt(t)||Gu(n[r])?n[r]=Zu(a,Array.isArray(a)?[]:{}):ia(a,as(t)?{}:t[r],n[r]);else{const i=t[r];n[r]=!qn(a,i)}}return n}const kx={value:!1,isValid:!1},Cx={value:!0,isValid:!0};var Bv=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!rt(e[0].attributes.value)?rt(e[0].value)||e[0].value===""?Cx:{value:e[0].value,isValid:!0}:Cx:kx}return kx},Uv=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>rt(e)?e:t?e===""?NaN:e&&+e:n&&gs(e)?new Date(e):r?r(e):e;const Ex={isValid:!1,value:null};var qv=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Ex):Ex;function Dx(e){const t=e.ref;return jh(t)?t.files:bh(t)?qv(e.refs).value:_v(t)?[...t.selectedOptions].map(({value:n})=>n):Il(t)?Bv(e.refs).value:Uv(rt(t.value)?e.ref.value:t.value,e)}var zk=(e,t,n,r)=>{const a={};for(const i of e){const l=xe(t,i);l&&Ye(a,i,l._f)}return{criteriaMode:n,names:[...e],fields:a,shouldUseNativeValidation:r}},nc=e=>e instanceof RegExp,ji=e=>rt(e)?e:nc(e)?e.source:jt(e)?nc(e.value)?e.value.source:e.value:e,Ax=e=>({isOnSubmit:!e||e===Ks.onSubmit,isOnBlur:e===Ks.onBlur,isOnChange:e===Ks.onChange,isOnAll:e===Ks.all,isOnTouch:e===Ks.onTouched});const Px="AsyncFunction";var $k=e=>!!e&&!!e.validate&&!!(_s(e.validate)&&e.validate.constructor.name===Px||jt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Px)),_k=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Mx=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const zi=(e,t,n,r)=>{for(const a of n||Object.keys(e)){const i=xe(e,a);if(i){const{_f:l,...o}=i;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],a)&&!r)return!0;if(l.ref&&t(l.ref,l.name)&&!r)return!0;if(zi(o,t))break}else if(jt(o)&&zi(o,t))break}}};function Tx(e,t,n){const r=xe(e,n);if(r||Lc(n))return{error:r,name:n};const a=n.split(".");for(;a.length;){const i=a.join("."),l=xe(t,i),o=xe(e,i);if(l&&!Array.isArray(l)&&n!==i)return{name:n};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};a.pop()}return{name:n}}var Kk=(e,t,n,r)=>{n(e);const{name:a,...i}=e;return Wt(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(l=>t[l]===(!r||Ks.all))},Bk=(e,t,n)=>!e||!t||e===t||Oi(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),Uk=(e,t,n,r,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(t||e):(n?r.isOnBlur:a.isOnBlur)?!e:(n?r.isOnChange:a.isOnChange)?e:!0,qk=(e,t)=>!yh(xe(e,t)).length&&yt(e,t),Vk=(e,t,n)=>{const r=Oi(xe(e,n));return Ye(r,"root",t[n]),Ye(e,n,r),e};function Fx(e,t,n="validate"){if(gs(e)||Array.isArray(e)&&e.every(gs)||Js(e)&&!e)return{type:n,message:gs(e)?e:"",ref:t}}var ra=e=>jt(e)&&!nc(e)?e:{value:e,message:""},Ix=async(e,t,n,r,a,i)=>{const{ref:l,refs:o,required:c,maxLength:d,minLength:u,min:h,max:x,pattern:m,validate:f,name:p,valueAsNumber:b,mount:g}=e._f,y=xe(n,p);if(!g||t.has(p))return{};const v=o?o[0]:l,N=R=>{a&&v.reportValidity&&(v.setCustomValidity(Js(R)?"":R||""),v.reportValidity())},E={},P=bh(l),I=Il(l),w=P||I,S=(b||jh(l))&&rt(l.value)&&rt(y)||sc(l)&&l.value===""||y===""||Array.isArray(y)&&!y.length,A=Fk.bind(null,p,r,E),O=(R,q,D,z=fn.maxLength,k=fn.minLength)=>{const K=R?q:D;E[p]={type:R?z:k,message:K,ref:l,...A(R?z:k,K)}};if(i?!Array.isArray(y)||!y.length:c&&(!w&&(S||as(y))||Js(y)&&!y||I&&!Bv(o).isValid||P&&!qv(o).isValid)){const{value:R,message:q}=gs(c)?{value:!!c,message:c}:ra(c);if(R&&(E[p]={type:fn.required,message:q,ref:v,...A(fn.required,q)},!r))return N(q),E}if(!S&&(!as(h)||!as(x))){let R,q;const D=ra(x),z=ra(h);if(!as(y)&&!isNaN(y)){const k=l.valueAsNumber||y&&+y;as(D.value)||(R=k>D.value),as(z.value)||(q=knew Date(new Date().toDateString()+" "+Q),B=l.type=="time",_=l.type=="week";gs(D.value)&&y&&(R=B?K(y)>K(D.value):_?y>D.value:k>new Date(D.value)),gs(z.value)&&y&&(q=B?K(y)+R.value,z=!as(q.value)&&y.length<+q.value;if((D||z)&&(O(D,R.message,q.message),!r))return N(E[p].message),E}if(m&&!S&&gs(y)){const{value:R,message:q}=ra(m);if(nc(R)&&!y.match(R)&&(E[p]={type:fn.pattern,message:q,ref:l,...A(fn.pattern,q)},!r))return N(q),E}if(f){if(_s(f)){const R=await f(y,n),q=Fx(R,v);if(q&&(E[p]={...q,...A(fn.validate,q.message)},!r))return N(q.message),E}else if(jt(f)){let R={};for(const q in f){if(!Wt(R)&&!r)break;const D=Fx(await f[q](y,n),v,q);D&&(R={...D,...A(q,D.message)},N(D.message),r&&(E[p]=R))}if(!Wt(R)&&(E[p]={ref:v,...R},!r))return E}}return N(!0),E};const Qk={mode:Ks.onSubmit,reValidateMode:Ks.onChange,shouldFocusError:!0};function Hk(e={}){let t={...Qk,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:_s(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},a=jt(t.defaultValues)||jt(t.values)?bt(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:bt(a),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={...u};let x={...h};const m={array:Sx(),state:Sx()},f=t.criteriaMode===Ks.all,p=L=>U=>{clearTimeout(d),d=setTimeout(L,U)},b=async L=>{if(!l.keepIsValid&&!t.disabled&&(h.isValid||x.isValid||L)){let U;t.resolver?(U=Wt((await w()).errors),g()):U=await A(r,!0),U!==n.isValid&&m.state.next({isValid:U})}},g=(L,U)=>{!t.disabled&&(h.isValidating||h.validatingFields||x.isValidating||x.validatingFields)&&((L||Array.from(o.mount)).forEach(W=>{W&&(U?Ye(n.validatingFields,W,U):yt(n.validatingFields,W))}),m.state.next({validatingFields:n.validatingFields,isValidating:!Wt(n.validatingFields)}))},y=(L,U=[],W,ce,se=!0,ee=!0)=>{if(ce&&W&&!t.disabled){if(l.action=!0,ee&&Array.isArray(xe(r,L))){const ye=W(xe(r,L),ce.argA,ce.argB);se&&Ye(r,L,ye)}if(ee&&Array.isArray(xe(n.errors,L))){const ye=W(xe(n.errors,L),ce.argA,ce.argB);se&&Ye(n.errors,L,ye),qk(n.errors,L)}if((h.touchedFields||x.touchedFields)&&ee&&Array.isArray(xe(n.touchedFields,L))){const ye=W(xe(n.touchedFields,L),ce.argA,ce.argB);se&&Ye(n.touchedFields,L,ye)}(h.dirtyFields||x.dirtyFields)&&(n.dirtyFields=ia(a,i)),m.state.next({name:L,isDirty:R(L,U),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Ye(i,L,U)},v=(L,U)=>{Ye(n.errors,L,U),m.state.next({errors:n.errors})},N=L=>{n.errors=L,m.state.next({errors:n.errors,isValid:!1})},E=(L,U,W,ce)=>{const se=xe(r,L);if(se){const ee=xe(i,L,rt(W)?xe(a,L):W);rt(ee)||ce&&ce.defaultChecked||U?Ye(i,L,U?ee:Dx(se._f)):z(L,ee),l.mount&&!l.action&&b()}},P=(L,U,W,ce,se)=>{let ee=!1,ye=!1;const Le={name:L};if(!t.disabled){if(!W||ce){(h.isDirty||x.isDirty)&&(ye=n.isDirty,n.isDirty=Le.isDirty=R(),ee=ye!==Le.isDirty);const Me=qn(xe(a,L),U);ye=!!xe(n.dirtyFields,L),Me?yt(n.dirtyFields,L):Ye(n.dirtyFields,L,!0),Le.dirtyFields=n.dirtyFields,ee=ee||(h.dirtyFields||x.dirtyFields)&&ye!==!Me}if(W){const Me=xe(n.touchedFields,L);Me||(Ye(n.touchedFields,L,W),Le.touchedFields=n.touchedFields,ee=ee||(h.touchedFields||x.touchedFields)&&Me!==W)}ee&&se&&m.state.next(Le)}return ee?Le:{}},I=(L,U,W,ce)=>{const se=xe(n.errors,L),ee=(h.isValid||x.isValid)&&Js(U)&&n.isValid!==U;if(t.delayError&&W?(c=p(()=>v(L,W)),c(t.delayError)):(clearTimeout(d),c=null,W?Ye(n.errors,L,W):yt(n.errors,L)),(W?!qn(se,W):se)||!Wt(ce)||ee){const ye={...ce,...ee&&Js(U)?{isValid:U}:{},errors:n.errors,name:L};n={...n,...ye},m.state.next(ye)}},w=async L=>(g(L,!0),await t.resolver(i,t.context,zk(L||o.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),S=async L=>{const{errors:U}=await w(L);if(g(L),L)for(const W of L){const ce=xe(U,W);ce?Ye(n.errors,W,ce):yt(n.errors,W)}else n.errors=U;return U},A=async(L,U,W={valid:!0})=>{for(const ce in L){const se=L[ce];if(se){const{_f:ee,...ye}=se;if(ee){const Le=o.array.has(ee.name),Me=se._f&&$k(se._f);Me&&h.validatingFields&&g([ee.name],!0);const kt=await Ix(se,o.disabled,i,f,t.shouldUseNativeValidation&&!U,Le);if(Me&&h.validatingFields&&g([ee.name]),kt[ee.name]&&(W.valid=!1,U||e.shouldUseNativeValidation))break;!U&&(xe(kt,ee.name)?Le?Vk(n.errors,kt,ee.name):Ye(n.errors,ee.name,kt[ee.name]):yt(n.errors,ee.name))}!Wt(ye)&&await A(ye,U,W)}}return W.valid},O=()=>{for(const L of o.unMount){const U=xe(r,L);U&&(U._f.refs?U._f.refs.every(W=>!yd(W)):!yd(U._f.ref))&&es(L)}o.unMount=new Set},R=(L,U)=>!t.disabled&&(L&&U&&Ye(i,L,U),!qn(le(),a)),q=(L,U,W)=>Mk(L,o,{...l.mount?i:rt(U)?a:gs(L)?{[L]:U}:U},W,U),D=L=>yh(xe(l.mount?i:a,L,t.shouldUnregister?xe(a,L,[]):[])),z=(L,U,W={})=>{const ce=xe(r,L);let se=U;if(ce){const ee=ce._f;ee&&(!ee.disabled&&Ye(i,L,Uv(U,ee)),se=sc(ee.ref)&&as(U)?"":U,_v(ee.ref)?[...ee.ref.options].forEach(ye=>ye.selected=se.includes(ye.value)):ee.refs?Il(ee.ref)?ee.refs.forEach(ye=>{(!ye.defaultChecked||!ye.disabled)&&(Array.isArray(se)?ye.checked=!!se.find(Le=>Le===ye.value):ye.checked=se===ye.value||!!se)}):ee.refs.forEach(ye=>ye.checked=ye.value===se):jh(ee.ref)?ee.ref.value="":(ee.ref.value=se,ee.ref.type||m.state.next({name:L,values:bt(i)})))}(W.shouldDirty||W.shouldTouch)&&P(L,se,W.shouldTouch,W.shouldDirty,!0),W.shouldValidate&&Q(L)},k=(L,U,W)=>{for(const ce in U){if(!U.hasOwnProperty(ce))return;const se=U[ce],ee=L+"."+ce,ye=xe(r,ee);(o.array.has(L)||jt(se)||ye&&!ye._f)&&!Pr(se)?k(ee,se,W):z(ee,se,W)}},K=(L,U,W={})=>{const ce=xe(r,L),se=o.array.has(L),ee=bt(U);Ye(i,L,ee),se?(m.array.next({name:L,values:bt(i)}),(h.isDirty||h.dirtyFields||x.isDirty||x.dirtyFields)&&W.shouldDirty&&m.state.next({name:L,dirtyFields:ia(a,i),isDirty:R(L,ee)})):ce&&!ce._f&&!as(ee)?k(L,ee,W):z(L,ee,W),Mx(L,o)?m.state.next({...n,name:L,values:bt(i)}):m.state.next({name:l.mount?L:void 0,values:bt(i)})},B=async L=>{l.mount=!0;const U=L.target;let W=U.name,ce=!0;const se=xe(r,W),ee=Me=>{ce=Number.isNaN(Me)||Pr(Me)&&isNaN(Me.getTime())||qn(Me,xe(i,W,Me))},ye=Ax(t.mode),Le=Ax(t.reValidateMode);if(se){let Me,kt;const mn=U.type?Dx(se._f):Sk(L),Hs=L.type===wx.BLUR||L.type===wx.FOCUS_OUT,Ln=!_k(se._f)&&!t.resolver&&!xe(n.errors,W)&&!se._f.deps||Uk(Hs,xe(n.touchedFields,W),n.isSubmitted,Le,ye),li=Mx(W,o,Hs);Ye(i,W,mn),Hs?(!U||!U.readOnly)&&(se._f.onBlur&&se._f.onBlur(L),c&&c(0)):se._f.onChange&&se._f.onChange(L);const sa=P(W,mn,Hs),Oc=!Wt(sa)||li;if(!Hs&&m.state.next({name:W,type:L.type,values:bt(i)}),Ln)return(h.isValid||x.isValid)&&(t.mode==="onBlur"?Hs&&b():Hs||b()),Oc&&m.state.next({name:W,...li?{}:sa});if(!Hs&&li&&m.state.next({...n}),t.resolver){const{errors:oi}=await w([W]);if(g([W]),ee(mn),ce){const Rl=Tx(n.errors,r,W),ci=Tx(oi,r,Rl.name||W);Me=ci.error,W=ci.name,kt=Wt(oi)}}else g([W],!0),Me=(await Ix(se,o.disabled,i,f,t.shouldUseNativeValidation))[W],g([W]),ee(mn),ce&&(Me?kt=!1:(h.isValid||x.isValid)&&(kt=await A(r,!0)));ce&&(se._f.deps&&(!Array.isArray(se._f.deps)||se._f.deps.length>0)&&Q(se._f.deps),I(W,kt,Me,sa))}},_=(L,U)=>{if(xe(n.errors,U)&&L.focus)return L.focus(),1},Q=async(L,U={})=>{let W,ce;const se=Oi(L);if(t.resolver){const ee=await S(rt(L)?L:se);W=Wt(ee),ce=L?!se.some(ye=>xe(ee,ye)):W}else L?(ce=(await Promise.all(se.map(async ee=>{const ye=xe(r,ee);return await A(ye&&ye._f?{[ee]:ye}:ye)}))).every(Boolean),!(!ce&&!n.isValid)&&b()):ce=W=await A(r);return m.state.next({...!gs(L)||(h.isValid||x.isValid)&&W!==n.isValid?{}:{name:L},...t.resolver||!L?{isValid:W}:{},errors:n.errors}),U.shouldFocus&&!ce&&zi(r,_,L?se:o.mount),ce},le=(L,U)=>{let W={...l.mount?i:a};return U&&(W=$v(U.dirtyFields?n.dirtyFields:n.touchedFields,W)),rt(L)?W:gs(L)?xe(W,L):L.map(ce=>xe(W,ce))},de=(L,U)=>({invalid:!!xe((U||n).errors,L),isDirty:!!xe((U||n).dirtyFields,L),error:xe((U||n).errors,L),isValidating:!!xe(n.validatingFields,L),isTouched:!!xe((U||n).touchedFields,L)}),Ke=L=>{L&&Oi(L).forEach(U=>yt(n.errors,U)),m.state.next({errors:L?n.errors:{}})},Ve=(L,U,W)=>{const ce=(xe(r,L,{_f:{}})._f||{}).ref,se=xe(n.errors,L)||{},{ref:ee,message:ye,type:Le,...Me}=se;Ye(n.errors,L,{...Me,...U,ref:ce}),m.state.next({name:L,errors:n.errors,isValid:!1}),W&&W.shouldFocus&&ce&&ce.focus&&ce.focus()},st=(L,U)=>_s(L)?m.state.subscribe({next:W=>"values"in W&&L(q(void 0,U),W)}):q(L,U,!0),C=L=>m.state.subscribe({next:U=>{Bk(L.name,U.name,L.exact)&&Kk(U,L.formState||h,ts,L.reRenderRoot)&&L.callback({values:{...i},...n,...U,defaultValues:a})}}).unsubscribe,nt=L=>(l.mount=!0,x={...x,...L.formState},C({...L,formState:{...u,...L.formState}})),es=(L,U={})=>{for(const W of L?Oi(L):o.mount)o.mount.delete(W),o.array.delete(W),U.keepValue||(yt(r,W),yt(i,W)),!U.keepError&&yt(n.errors,W),!U.keepDirty&&yt(n.dirtyFields,W),!U.keepTouched&&yt(n.touchedFields,W),!U.keepIsValidating&&yt(n.validatingFields,W),!t.shouldUnregister&&!U.keepDefaultValue&&yt(a,W);m.state.next({values:bt(i)}),m.state.next({...n,...U.keepDirty?{isDirty:R()}:{}}),!U.keepIsValid&&b()},Vt=({disabled:L,name:U})=>{if(Js(L)&&l.mount||L||o.disabled.has(U)){const se=o.disabled.has(U)!==!!L;L?o.disabled.add(U):o.disabled.delete(U),se&&l.mount&&!l.action&&b()}},ae=(L,U={})=>{let W=xe(r,L);const ce=Js(U.disabled)||Js(t.disabled);return Ye(r,L,{...W||{},_f:{...W&&W._f?W._f:{ref:{name:L}},name:L,mount:!0,...U}}),o.mount.add(L),W?Vt({disabled:Js(U.disabled)?U.disabled:t.disabled,name:L}):E(L,!0,U.value),{...ce?{disabled:U.disabled||t.disabled}:{},...t.progressive?{required:!!U.required,min:ji(U.min),max:ji(U.max),minLength:ji(U.minLength),maxLength:ji(U.maxLength),pattern:ji(U.pattern)}:{},name:L,onChange:B,onBlur:B,ref:se=>{if(se){ae(L,U),W=xe(r,L);const ee=rt(se.value)&&se.querySelectorAll&&se.querySelectorAll("input,select,textarea")[0]||se,ye=Ik(ee),Le=W._f.refs||[];if(ye?Le.find(Me=>Me===ee):ee===W._f.ref)return;Ye(r,L,{_f:{...W._f,...ye?{refs:[...Le.filter(yd),ee,...Array.isArray(xe(a,L))?[{}]:[]],ref:{type:ee.type,name:L}}:{ref:ee}}}),E(L,!1,void 0,ee)}else W=xe(r,L,{}),W._f&&(W._f.mount=!1),(t.shouldUnregister||U.shouldUnregister)&&!(Ck(o.array,L)&&l.action)&&o.unMount.add(L)}}},Ge=()=>t.shouldFocusError&&zi(r,_,o.mount),xt=L=>{Js(L)&&(m.state.next({disabled:L}),zi(r,(U,W)=>{const ce=xe(r,W);ce&&(U.disabled=ce._f.disabled||L,Array.isArray(ce._f.refs)&&ce._f.refs.forEach(se=>{se.disabled=ce._f.disabled||L}))},0,!1))},Z=(L,U)=>async W=>{let ce;W&&(W.preventDefault&&W.preventDefault(),W.persist&&W.persist());let se=bt(i);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:ee,values:ye}=await w();g(),n.errors=ee,se=bt(ye)}else await A(r);if(o.disabled.size)for(const ee of o.disabled)yt(se,ee);if(yt(n.errors,"root"),Wt(n.errors)){m.state.next({errors:{}});try{await L(se,W)}catch(ee){ce=ee}}else U&&await U({...n.errors},W),Ge(),setTimeout(Ge);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Wt(n.errors)&&!ce,submitCount:n.submitCount+1,errors:n.errors}),ce)throw ce},Fe=(L,U={})=>{xe(r,L)&&(rt(U.defaultValue)?K(L,bt(xe(a,L))):(K(L,U.defaultValue),Ye(a,L,bt(U.defaultValue))),U.keepTouched||yt(n.touchedFields,L),U.keepDirty||(yt(n.dirtyFields,L),n.isDirty=U.defaultValue?R(L,bt(xe(a,L))):R()),U.keepError||(yt(n.errors,L),h.isValid&&b()),m.state.next({...n}))},Xe=(L,U={})=>{const W=L?bt(L):a,ce=bt(W),se=Wt(L),ee=se?a:ce;if(U.keepDefaultValues||(a=W),!U.keepValues){if(U.keepDirtyValues){const ye=new Set([...o.mount,...Object.keys(ia(a,i))]);for(const Le of Array.from(ye)){const Me=xe(n.dirtyFields,Le),kt=xe(i,Le),mn=xe(ee,Le);Me&&!rt(kt)?Ye(ee,Le,kt):!Me&&!rt(mn)&&K(Le,mn)}}else{if(gh&&rt(L))for(const ye of o.mount){const Le=xe(r,ye);if(Le&&Le._f){const Me=Array.isArray(Le._f.refs)?Le._f.refs[0]:Le._f.ref;if(sc(Me)){const kt=Me.closest("form");if(kt){kt.reset();break}}}}if(U.keepFieldsRef)for(const ye of o.mount)K(ye,xe(ee,ye));else r={}}i=t.shouldUnregister?U.keepDefaultValues?bt(a):{}:bt(ee),m.array.next({values:{...ee}}),m.state.next({values:{...ee}})}o={mount:U.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!h.isValid||!!U.keepIsValid||!!U.keepDirtyValues||!t.shouldUnregister&&!Wt(ee),l.watch=!!t.shouldUnregister,l.keepIsValid=!!U.keepIsValid,l.action=!1,U.keepErrors||(n.errors={}),m.state.next({submitCount:U.keepSubmitCount?n.submitCount:0,isDirty:se?!1:U.keepDirty?n.isDirty:!!(U.keepDefaultValues&&!qn(L,a)),isSubmitted:U.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:se?{}:U.keepDirtyValues?U.keepDefaultValues&&i?ia(a,i):n.dirtyFields:U.keepDefaultValues&&L?ia(a,L):U.keepDirty?n.dirtyFields:{},touchedFields:U.keepTouched?n.touchedFields:{},errors:U.keepErrors?n.errors:{},isSubmitSuccessful:U.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},J=(L,U)=>Xe(_s(L)?L(i):L,{...t.resetOptions,...U}),ue=(L,U={})=>{const W=xe(r,L),ce=W&&W._f;if(ce){const se=ce.refs?ce.refs[0]:ce.ref;se.focus&&setTimeout(()=>{se.focus(),U.shouldSelect&&_s(se.select)&&se.select()})}},ts=L=>{n={...n,...L}},gt={control:{register:ae,unregister:es,getFieldState:de,handleSubmit:Z,setError:Ve,_subscribe:C,_runSchema:w,_updateIsValidating:g,_focusError:Ge,_getWatch:q,_getDirty:R,_setValid:b,_setFieldArray:y,_setDisabledField:Vt,_setErrors:N,_getFieldArray:D,_reset:Xe,_resetDefaultValues:()=>_s(t.defaultValues)&&t.defaultValues().then(L=>{J(L,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:O,_disableForm:xt,_subjects:m,_proxyFormState:h,get _fields(){return r},get _formValues(){return i},get _state(){return l},set _state(L){l=L},get _defaultValues(){return a},get _names(){return o},set _names(L){o=L},get _formState(){return n},get _options(){return t},set _options(L){t={...t,...L}}},subscribe:nt,trigger:Q,register:ae,handleSubmit:Z,watch:st,setValue:K,getValues:le,reset:J,resetField:Fe,clearErrors:Ke,unregister:es,setError:Ve,setFocus:ue,getFieldState:de};return{...gt,formControl:gt}}function Vv(e={}){const t=Tt.useRef(void 0),n=Tt.useRef(void 0),[r,a]=Tt.useState({isDirty:!1,isValidating:!1,isLoading:_s(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:_s(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!_s(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...o}=Hk(e);t.current={...o,formState:r}}const i=t.current.control;return i._options=e,Pk(()=>{const l=i._subscribe({formState:i._proxyFormState,callback:()=>a({...i._formState}),reRenderRoot:!0});return a(o=>({...o,isReady:!0})),i._formState.isReady=!0,l},[i]),Tt.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),Tt.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),Tt.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),Tt.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),Tt.useEffect(()=>{if(i._proxyFormState.isDirty){const l=i._getDirty();l!==r.isDirty&&i._subjects.state.next({isDirty:l})}},[i,r.isDirty]),Tt.useEffect(()=>{var l;e.values&&!qn(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((l=i._options.resetOptions)===null||l===void 0)&&l.keepIsValid||i._setValid(),n.current=e.values,a(o=>({...o}))):i._resetDefaultValues()},[i,e.values]),Tt.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=Tt.useMemo(()=>Ak(r,i),[i,r]),t.current}function Rx(){var g,y;const{id:e}=Nc(),t=Yt(),n=ge(),r=!!e,{register:a,handleSubmit:i,reset:l,watch:o,setValue:c,formState:{errors:d}}=Vv(),u=o("type"),{data:h}=fe({queryKey:["customer",e],queryFn:()=>At.getById(parseInt(e)),enabled:r});j.useEffect(()=>{if(h!=null&&h.data){const v={...h.data};v.birthDate&&(v.birthDate=v.birthDate.split("T")[0]),v.foundingDate&&(v.foundingDate=v.foundingDate.split("T")[0]),l(v)}},[h,l]);const x=G({mutationFn:At.create,onSuccess:()=>{n.invalidateQueries({queryKey:["customers"]}),t("/customers")}}),m=G({mutationFn:v=>At.update(parseInt(e),v),onSuccess:()=>{n.invalidateQueries({queryKey:["customers"]}),n.invalidateQueries({queryKey:["customer",e]}),t(`/customers/${e}`)}}),f=v=>{const N={type:v.type,salutation:v.salutation||void 0,firstName:v.firstName,lastName:v.lastName,companyName:v.companyName||void 0,email:v.email||void 0,phone:v.phone||void 0,mobile:v.mobile||void 0,taxNumber:v.taxNumber||void 0,commercialRegisterNumber:v.commercialRegisterNumber||void 0,notes:v.notes||void 0,birthPlace:v.birthPlace||void 0};v.birthDate&&typeof v.birthDate=="string"&&v.birthDate.trim()!==""?N.birthDate=new Date(v.birthDate).toISOString():N.birthDate=null,v.foundingDate&&typeof v.foundingDate=="string"&&v.foundingDate.trim()!==""?N.foundingDate=new Date(v.foundingDate).toISOString():N.foundingDate=null,r?m.mutate(N):x.mutate(N)},p=x.isPending||m.isPending,b=x.error||m.error;return s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold mb-6",children:r?"Kunde bearbeiten":"Neuer Kunde"}),b&&s.jsx("div",{className:"mb-4 p-4 bg-red-50 border border-red-200 text-red-700 rounded-lg",children:b instanceof Error?b.message:"Ein Fehler ist aufgetreten"}),s.jsxs("form",{onSubmit:i(f),children:[s.jsx(X,{className:"mb-6",title:"Stammdaten",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(Ie,{label:"Kundentyp",...a("type"),options:[{value:"PRIVATE",label:"Privatkunde"},{value:"BUSINESS",label:"Geschäftskunde"}]}),s.jsx(Ie,{label:"Anrede",...a("salutation"),options:[{value:"Herr",label:"Herr"},{value:"Frau",label:"Frau"},{value:"Divers",label:"Divers"}]}),s.jsx(H,{label:"Vorname",...a("firstName",{required:"Vorname erforderlich"}),error:(g=d.firstName)==null?void 0:g.message}),s.jsx(H,{label:"Nachname",...a("lastName",{required:"Nachname erforderlich"}),error:(y=d.lastName)==null?void 0:y.message}),u==="BUSINESS"&&s.jsxs(s.Fragment,{children:[s.jsx(H,{label:"Firmenname",...a("companyName"),className:"md:col-span-2"}),s.jsx(H,{label:"Gründungsdatum",type:"date",...a("foundingDate"),value:o("foundingDate")||"",onClear:()=>c("foundingDate","")})]}),u!=="BUSINESS"&&s.jsxs(s.Fragment,{children:[s.jsx(H,{label:"Geburtsdatum",type:"date",...a("birthDate"),value:o("birthDate")||"",onClear:()=>c("birthDate","")}),s.jsx(H,{label:"Geburtsort",...a("birthPlace")})]})]})}),s.jsx(X,{className:"mb-6",title:"Kontaktdaten",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"E-Mail",type:"email",...a("email")}),s.jsx(H,{label:"Telefon",...a("phone")}),s.jsx(H,{label:"Mobil",...a("mobile")})]})}),u==="BUSINESS"&&s.jsxs(X,{className:"mb-6",title:"Geschäftsdaten",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"Steuernummer",...a("taxNumber")}),s.jsx(H,{label:"Handelsregisternummer",...a("commercialRegisterNumber"),placeholder:"z.B. HRB 12345"})]}),r&&s.jsx("p",{className:"mt-4 text-sm text-gray-500",children:"Dokumente (Gewerbeanmeldung, Handelsregisterauszug) können nach dem Speichern in der Kundendetailansicht hochgeladen werden."})]}),s.jsx(X,{className:"mb-6",title:"Notizen",children:s.jsx("textarea",{...a("notes"),rows:4,className:"block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Interne Notizen..."})}),s.jsxs("div",{className:"flex justify-end gap-4",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:()=>t(-1),children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:p,children:p?"Speichern...":"Speichern"})]})]})]})}const vd={ELECTRICITY:"Strom",GAS:"Gas",DSL:"DSL",CABLE:"Kabelinternet",FIBER:"Glasfaser",MOBILE:"Mobilfunk",TV:"TV",CAR_INSURANCE:"KFZ-Versicherung"},jd={DRAFT:"Entwurf",PENDING:"Ausstehend",ACTIVE:"Aktiv",CANCELLED:"Gekündigt",EXPIRED:"Abgelaufen",DEACTIVATED:"Deaktiviert"},Lx={ACTIVE:"success",PENDING:"warning",CANCELLED:"danger",EXPIRED:"danger",DRAFT:"default",DEACTIVATED:"default"},Wk=[{status:"DRAFT",label:"Entwurf",description:"Vertrag wird noch vorbereitet",color:"text-gray-600"},{status:"PENDING",label:"Ausstehend",description:"Wartet auf Aktivierung",color:"text-yellow-600"},{status:"ACTIVE",label:"Aktiv",description:"Vertrag läuft normal",color:"text-green-600"},{status:"EXPIRED",label:"Abgelaufen",description:"Laufzeit vorbei, läuft aber ohne Kündigung weiter",color:"text-orange-600"},{status:"CANCELLED",label:"Gekündigt",description:"Aktive Kündigung eingereicht, Vertrag endet",color:"text-red-600"},{status:"DEACTIVATED",label:"Deaktiviert",description:"Manuell beendet/archiviert",color:"text-gray-500"}];function Gk({isOpen:e,onClose:t}){return e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[s.jsx("div",{className:"fixed inset-0 bg-black/20",onClick:t}),s.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl p-4 max-w-sm w-full mx-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Vertragsstatus-Übersicht"}),s.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600",children:s.jsx(qt,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"space-y-2",children:Wk.map(({status:n,label:r,description:a,color:i})=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:`font-medium text-sm min-w-[90px] ${i}`,children:r}),s.jsx("span",{className:"text-sm text-gray-600",children:a})]},n))})]})]}):null}function Zk(){const[e,t]=Sc(),n=Yt(),[r,a]=j.useState(e.get("search")||""),[i,l]=j.useState(e.get("type")||""),[o,c]=j.useState(e.get("status")||""),[d,u]=j.useState(parseInt(e.get("page")||"1",10)),[h,x]=j.useState(new Set),[m,f]=j.useState(!1),{hasPermission:p,isCustomer:b,isCustomerPortal:g,user:y}=We(),v=ge();j.useEffect(()=>{const D=new URLSearchParams;r&&D.set("search",r),i&&D.set("type",i),o&&D.set("status",o),d>1&&D.set("page",d.toString()),t(D,{replace:!0})},[r,i,o,d,t]);const N=G({mutationFn:Oe.delete,onSuccess:()=>{v.invalidateQueries({queryKey:["contracts"]})}}),{data:E,isLoading:P}=fe({queryKey:["contracts",r,i,o,d,b?y==null?void 0:y.customerId:null],queryFn:()=>Oe.getAll({search:r||void 0,type:i||void 0,status:o||void 0,page:d,limit:20,customerId:b?y==null?void 0:y.customerId:void 0})}),I=j.useMemo(()=>{if(!g||!(E!=null&&E.data))return[];const D=new Set;return y!=null&&y.customerId&&D.add(y.customerId),E.data.forEach(z=>D.add(z.customerId)),[...D]},[E==null?void 0:E.data,g,y==null?void 0:y.customerId]),w=s1({queries:I.map(D=>({queryKey:["contract-tree",D],queryFn:()=>Oe.getTreeForCustomer(D),enabled:g}))}),S=j.useMemo(()=>{const D=new Map;return I.forEach((z,k)=>{var B;const K=w[k];(B=K==null?void 0:K.data)!=null&&B.data&&D.set(z,K.data.data)}),D},[I,w]),A=j.useMemo(()=>{if(!g||!(E!=null&&E.data))return null;const D={};for(const z of E.data){const k=z.customerId;if(!D[k]){const K=z.customer?z.customer.companyName||`${z.customer.firstName} ${z.customer.lastName}`:`Kunde ${k}`;D[k]={customerId:k,customerName:K,isOwn:k===(y==null?void 0:y.customerId),contracts:[],tree:S.get(k)||[]}}D[k].contracts.push(z)}return Object.values(D).sort((z,k)=>z.isOwn&&!k.isOwn?-1:!z.isOwn&&k.isOwn?1:z.customerName.localeCompare(k.customerName))},[E==null?void 0:E.data,g,y==null?void 0:y.customerId,S]),O=D=>{x(z=>{const k=new Set(z);return k.has(D)?k.delete(D):k.add(D),k})},R=(D,z)=>D.map(k=>s.jsx("div",{children:q(k,z)},k.contract.id)),q=(D,z=0)=>{var le,de,Ke,Ve,st,C,nt;const{contract:k,predecessors:K,hasHistory:B}=D,_=h.has(k.id),Q=z>0;return s.jsxs("div",{children:[s.jsxs("div",{className:` + border rounded-lg p-4 transition-colors + ${Q?"ml-6 border-l-4 border-l-gray-300 bg-gray-50":"hover:bg-gray-50"} + `,children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[!Q&&B?s.jsx("button",{onClick:()=>O(k.id),className:"p-1 hover:bg-gray-200 rounded transition-colors",title:_?"Einklappen":"Vorgänger anzeigen",children:_?s.jsx(dn,{className:"w-4 h-4 text-gray-500"}):s.jsx(Ft,{className:"w-4 h-4 text-gray-500"})}):Q?null:s.jsx("div",{className:"w-6"}),s.jsxs("span",{className:"font-mono flex items-center gap-1",children:[k.contractNumber,s.jsx(oe,{value:k.contractNumber})]}),s.jsx(ve,{children:vd[k.type]||k.type}),s.jsx(ve,{variant:Lx[k.status]||"default",children:jd[k.status]||k.status}),Q&&s.jsx("span",{className:"text-xs text-gray-500 ml-2",children:"(Vorgänger)"})]}),s.jsx("div",{className:"flex gap-2",children:s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>n(`/contracts/${k.id}`,{state:{from:"contracts"}}),title:"Ansehen",children:s.jsx(Ae,{className:"w-4 h-4"})})})]}),(k.providerName||((le=k.provider)==null?void 0:le.name))&&s.jsxs("p",{className:`flex items-center gap-1 ${Q?"ml-6":""}`,children:[k.providerName||((de=k.provider)==null?void 0:de.name),(k.tariffName||((Ke=k.tariff)==null?void 0:Ke.name))&&` - ${k.tariffName||((Ve=k.tariff)==null?void 0:Ve.name)}`,s.jsx(oe,{value:(k.providerName||((st=k.provider)==null?void 0:st.name)||"")+(k.tariffName||(C=k.tariff)!=null&&C.name?` - ${k.tariffName||((nt=k.tariff)==null?void 0:nt.name)}`:"")})]}),k.startDate&&s.jsxs("p",{className:`text-sm text-gray-500 ${Q?"ml-6":""}`,children:["Beginn: ",new Date(k.startDate).toLocaleDateString("de-DE"),k.endDate&&` | Ende: ${new Date(k.endDate).toLocaleDateString("de-DE")}`]})]}),(z===0&&_||z>0)&&K.length>0&&s.jsx("div",{className:"mt-2",children:R(K,z+1)})]},k.id)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Verträge"}),p("contracts:create")&&!b&&s.jsx(ke,{to:"/contracts/new",children:s.jsxs(T,{children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Neuer Vertrag"]})})]}),s.jsx(X,{className:"mb-6",children:s.jsxs("div",{className:"flex gap-4 flex-wrap",children:[s.jsx("div",{className:"flex-1 min-w-[200px]",children:s.jsx(H,{placeholder:"Suchen...",value:r,onChange:D=>a(D.target.value)})}),s.jsx(Ie,{value:i,onChange:D=>l(D.target.value),options:Object.entries(vd).map(([D,z])=>({value:D,label:z})),className:"w-48"}),s.jsx(Ie,{value:o,onChange:D=>c(D.target.value),options:Object.entries(jd).map(([D,z])=>({value:D,label:z})),className:"w-48"}),s.jsx(T,{variant:"secondary",children:s.jsx(Tl,{className:"w-4 h-4"})})]})}),P?s.jsx(X,{children:s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."})}):E!=null&&E.data&&E.data.length>0?s.jsx(s.Fragment,{children:g&&A?s.jsx("div",{className:"space-y-6",children:A.map(D=>s.jsxs(X,{children:[s.jsx("div",{className:"flex items-center gap-3 mb-4 pb-3 border-b",children:D.isOwn?s.jsxs(s.Fragment,{children:[s.jsx(ii,{className:"w-5 h-5 text-blue-600"}),s.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Meine Verträge"}),s.jsx(ve,{variant:"default",children:D.contracts.length})]}):s.jsxs(s.Fragment,{children:[s.jsx(Ca,{className:"w-5 h-5 text-purple-600"}),s.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:["Verträge von ",D.customerName]}),s.jsx(ve,{variant:"default",children:D.contracts.length})]})}),D.tree.length>0?s.jsx("div",{className:"space-y-4",children:D.tree.map(z=>q(z,0))}):s.jsx("p",{className:"text-gray-500",children:"Keine Verträge vorhanden."})]},D.isOwn?"own":D.customerName))}):s.jsxs(X,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Vertragsnr."}),!b&&s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Kunde"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Typ"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Anbieter / Tarif"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:s.jsxs("span",{className:"flex items-center gap-1",children:["Status",s.jsx("button",{onClick:()=>f(!0),className:"text-gray-400 hover:text-blue-600 transition-colors",title:"Status-Erklärung",children:s.jsx(Ml,{className:"w-4 h-4"})})]})}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Beginn"}),s.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsx("tbody",{children:E.data.map(D=>s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[s.jsx("td",{className:"py-3 px-4 font-mono text-sm",children:D.contractNumber}),!b&&s.jsx("td",{className:"py-3 px-4",children:D.customer&&s.jsx(ke,{to:`/customers/${D.customer.id}`,className:"text-blue-600 hover:underline",children:D.customer.companyName||`${D.customer.firstName} ${D.customer.lastName}`})}),s.jsx("td",{className:"py-3 px-4",children:s.jsx(ve,{children:vd[D.type]})}),s.jsxs("td",{className:"py-3 px-4",children:[D.providerName||"-",D.tariffName&&s.jsxs("span",{className:"text-gray-500",children:[" / ",D.tariffName]})]}),s.jsx("td",{className:"py-3 px-4",children:s.jsx(ve,{variant:Lx[D.status],children:jd[D.status]})}),s.jsx("td",{className:"py-3 px-4",children:D.startDate?new Date(D.startDate).toLocaleDateString("de-DE"):"-"}),s.jsx("td",{className:"py-3 px-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>n(`/contracts/${D.id}`,{state:{from:"contracts"}}),children:s.jsx(Ae,{className:"w-4 h-4"})}),p("contracts:update")&&!b&&s.jsx(ke,{to:`/contracts/${D.id}/edit`,children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(He,{className:"w-4 h-4"})})}),p("contracts:delete")&&!b&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Vertrag wirklich löschen?")&&N.mutate(D.id)},children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})})]},D.id))})]})}),E.pagination&&E.pagination.totalPages>1&&s.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["Seite ",E.pagination.page," von ",E.pagination.totalPages," (",E.pagination.total," Einträge)"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>u(D=>Math.max(1,D-1)),disabled:d===1,children:"Zurück"}),s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>u(D=>D+1),disabled:d>=E.pagination.totalPages,children:"Weiter"})]})]})]})}):s.jsx(X,{children:s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Verträge gefunden."})}),s.jsx(Gk,{isOpen:m,onClose:()=>f(!1)})]})}const Jk={ELECTRICITY:"Strom",GAS:"Gas",DSL:"DSL",CABLE:"Kabelinternet",FIBER:"Glasfaser",MOBILE:"Mobilfunk",TV:"TV",CAR_INSURANCE:"KFZ-Versicherung"},Xk={DRAFT:"Entwurf",PENDING:"Ausstehend",ACTIVE:"Aktiv",CANCELLED:"Gekündigt",EXPIRED:"Abgelaufen",DEACTIVATED:"Deaktiviert"},Yk={ACTIVE:"success",PENDING:"warning",CANCELLED:"danger",EXPIRED:"danger",DRAFT:"default",DEACTIVATED:"default"};function eC({contractId:e,isOpen:t,onClose:n}){var o,c,d,u,h,x,m,f,p,b,g;const{data:r,isLoading:a,error:i}=fe({queryKey:["contract",e],queryFn:()=>Oe.getById(e),enabled:t}),l=r==null?void 0:r.data;return s.jsxs(qe,{isOpen:t,onClose:n,title:"Vertragsdetails",size:"xl",children:[a&&s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}),i&&s.jsx("div",{className:"text-center py-8 text-red-600",children:"Fehler beim Laden des Vertrags"}),l&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3 pb-4 border-b",children:[s.jsxs("span",{className:"text-xl font-bold font-mono flex items-center gap-2",children:[l.contractNumber,s.jsx(oe,{value:l.contractNumber})]}),s.jsx(ve,{children:Jk[l.type]||l.type}),s.jsx(ve,{variant:Yk[l.status]||"default",children:Xk[l.status]||l.status})]}),(l.providerName||((o=l.provider)==null?void 0:o.name)||l.tariffName||((c=l.tariff)==null?void 0:c.name))&&s.jsx(X,{title:"Anbieter & Tarif",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[(l.providerName||((d=l.provider)==null?void 0:d.name))&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Anbieter"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[l.providerName||((u=l.provider)==null?void 0:u.name),s.jsx(oe,{value:l.providerName||((h=l.provider)==null?void 0:h.name)||""})]})]}),(l.tariffName||((x=l.tariff)==null?void 0:x.name))&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Tarif"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[l.tariffName||((m=l.tariff)==null?void 0:m.name),s.jsx(oe,{value:l.tariffName||((f=l.tariff)==null?void 0:f.name)||""})]})]}),l.customerNumberAtProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kundennummer beim Anbieter"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[l.customerNumberAtProvider,s.jsx(oe,{value:l.customerNumberAtProvider})]})]}),l.contractNumberAtProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsnummer beim Anbieter"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[l.contractNumberAtProvider,s.jsx(oe,{value:l.contractNumberAtProvider})]})]})]})}),(l.type==="ELECTRICITY"||l.type==="GAS")&&((p=l.energyDetails)==null?void 0:p.meter)&&s.jsx(X,{title:"Zähler",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Zählernummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[l.energyDetails.meter.meterNumber,s.jsx(oe,{value:l.energyDetails.meter.meterNumber})]})]}),l.energyDetails.maloId&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"MaLo-ID"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[l.energyDetails.maloId,s.jsx(oe,{value:l.energyDetails.maloId})]})]})]})}),s.jsx(X,{title:"Laufzeit",children:s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[l.startDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsbeginn"}),s.jsx("dd",{children:new Date(l.startDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),l.endDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsende"}),s.jsx("dd",{children:new Date(l.endDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),l.contractDuration&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Laufzeit"}),s.jsx("dd",{children:l.contractDuration.description})]}),l.cancellationPeriod&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kündigungsfrist"}),s.jsx("dd",{children:l.cancellationPeriod.description})]})]})}),(l.portalUsername||((b=l.provider)==null?void 0:b.portalUrl))&&s.jsx(X,{title:"Portal-Zugangsdaten",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[((g=l.provider)==null?void 0:g.portalUrl)&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Portal-URL"}),s.jsx("dd",{children:s.jsx("a",{href:l.provider.portalUrl,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:l.provider.portalUrl})})]}),l.portalUsername&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Benutzername"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[l.portalUsername,s.jsx(oe,{value:l.portalUsername})]})]})]})}),l.address&&s.jsxs(X,{title:"Lieferadresse",children:[s.jsxs("p",{children:[l.address.street," ",l.address.houseNumber]}),s.jsxs("p",{children:[l.address.postalCode," ",l.address.city]})]}),l.notes&&s.jsx(X,{title:"Notizen",children:s.jsx("p",{className:"whitespace-pre-wrap text-gray-700",children:l.notes})})]})]})}function tC({contractId:e,canEdit:t}){const[n,r]=j.useState(!1),[a,i]=j.useState(!1),[l,o]=j.useState(null),c=ge(),{data:d,isLoading:u}=fe({queryKey:["contract-history",e],queryFn:()=>tc.getByContract(e)}),h=G({mutationFn:f=>tc.delete(e,f),onSuccess:()=>{c.invalidateQueries({queryKey:["contract-history",e]})}}),x=(d==null?void 0:d.data)||[],m=[...x].sort((f,p)=>new Date(p.createdAt).getTime()-new Date(f.createdAt).getTime());return s.jsxs("div",{className:"bg-white rounded-lg border p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(O2,{className:"w-4 h-4 text-gray-500"}),s.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Vertragshistorie"}),s.jsx(ve,{variant:"default",children:x.length})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[t&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>i(!0),children:s.jsx(_e,{className:"w-4 h-4"})}),x.length>0&&s.jsx("button",{onClick:()=>r(!n),className:"text-gray-500 hover:text-gray-700",children:n?s.jsx(Tc,{className:"w-4 h-4"}):s.jsx(dn,{className:"w-4 h-4"})})]})]}),u&&s.jsx("p",{className:"text-sm text-gray-500",children:"Laden..."}),!n&&!u&&m.length>0&&s.jsxs("div",{className:"text-sm text-gray-600",children:[s.jsx("span",{className:"font-medium",children:new Date(m[0].createdAt).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})})," - ",m[0].title]}),n&&!u&&m.length>0&&s.jsx("div",{className:"space-y-2",children:m.map(f=>s.jsxs("div",{className:"flex items-start justify-between p-3 bg-gray-50 rounded-lg group",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("span",{className:"text-sm font-medium text-gray-800",children:f.title}),f.isAutomatic?s.jsxs("span",{className:"flex items-center gap-1 px-1.5 py-0.5 text-xs rounded bg-blue-100 text-blue-700",title:"Automatisch erstellt",children:[s.jsx(D2,{className:"w-3 h-3"}),"Auto"]}):s.jsxs("span",{className:"flex items-center gap-1 px-1.5 py-0.5 text-xs rounded bg-gray-100 text-gray-600",title:"Manuell erstellt",children:[s.jsx(ii,{className:"w-3 h-3"}),"Manuell"]})]}),f.description&&s.jsx("p",{className:"text-sm text-gray-600 whitespace-pre-wrap mb-1",children:f.description}),s.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-400",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(on,{className:"w-3 h-3"}),new Date(f.createdAt).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})]}),s.jsxs("span",{children:["von ",f.createdBy]})]})]}),t&&!f.isAutomatic&&s.jsxs("div",{className:"flex items-center gap-2 opacity-0 group-hover:opacity-100 ml-3",children:[s.jsx("button",{onClick:()=>o(f),className:"text-gray-500 hover:text-blue-600",title:"Bearbeiten",children:s.jsx(He,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{confirm("Eintrag wirklich löschen?")&&h.mutate(f.id)},className:"text-gray-500 hover:text-red-600",title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4"})})]})]},f.id))}),n&&!u&&m.length===0&&s.jsx("p",{className:"text-sm text-gray-500 italic",children:"Keine Historie vorhanden."}),(a||l)&&s.jsx(sC,{isOpen:!0,onClose:()=>{i(!1),o(null)},contractId:e,entry:l})]})}function sC({isOpen:e,onClose:t,contractId:n,entry:r}){const a=ge(),i=!!r,[l,o]=j.useState({title:(r==null?void 0:r.title)||"",description:(r==null?void 0:r.description)||""}),[c,d]=j.useState(null),u=G({mutationFn:()=>tc.create(n,{title:l.title,description:l.description||void 0}),onSuccess:()=>{a.invalidateQueries({queryKey:["contract-history",n]}),t()},onError:f=>{d(f.message)}}),h=G({mutationFn:()=>tc.update(n,r.id,{title:l.title,description:l.description||void 0}),onSuccess:()=>{a.invalidateQueries({queryKey:["contract-history",n]}),t()},onError:f=>{d(f.message)}}),x=f=>{if(f.preventDefault(),d(null),!l.title.trim()){d("Titel ist erforderlich");return}i?h.mutate():u.mutate()},m=u.isPending||h.isPending;return s.jsx(qe,{isOpen:e,onClose:t,title:i?"Eintrag bearbeiten":"Historie-Eintrag hinzufügen",children:s.jsxs("form",{onSubmit:x,className:"space-y-4",children:[c&&s.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm",children:c}),s.jsx(H,{label:"Titel *",value:l.title,onChange:f=>o({...l,title:f.target.value}),placeholder:"z.B. kWh auf 18000 erhöht",required:!0}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Beschreibung (optional)"}),s.jsx("textarea",{value:l.description,onChange:f=>o({...l,description:f.target.value}),placeholder:"Weitere Details...",rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:m,children:m?"Wird gespeichert...":i?"Speichern":"Hinzufügen"})]})]})})}const Ox={INTERIM:"Zwischenrechnung",FINAL:"Schlussrechnung",NOT_AVAILABLE:"Nicht verfügbar"};function nC({ecdId:e,invoices:t,contractId:n,canEdit:r}){const[a,i]=j.useState(!1),[l,o]=j.useState(!1),[c,d]=j.useState(null),u=ge(),h=G({mutationFn:p=>aa.deleteInvoice(e,p),onSuccess:()=>{u.invalidateQueries({queryKey:["contract",n.toString()]})}}),x=[...t].sort((p,b)=>new Date(b.invoiceDate).getTime()-new Date(p.invoiceDate).getTime()),m=t.some(p=>p.invoiceType==="FINAL"),f=t.some(p=>p.invoiceType==="NOT_AVAILABLE");return s.jsxs("div",{className:"mt-4 pt-4 border-t",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Be,{className:"w-4 h-4 text-gray-500"}),s.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Rechnungen"}),s.jsx(ve,{variant:"default",children:t.length}),m?s.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 text-xs rounded-full bg-green-100 text-green-800",children:[s.jsx(xr,{className:"w-3 h-3"}),"Schlussrechnung"]}):f?s.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 text-xs rounded-full bg-yellow-100 text-yellow-800",children:[s.jsx(hs,{className:"w-3 h-3"}),"Nicht verfügbar"]}):t.length>0?s.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 text-xs rounded-full bg-orange-100 text-orange-800",children:[s.jsx(hs,{className:"w-3 h-3"}),"Schlussrechnung fehlt"]}):null]}),s.jsxs("div",{className:"flex items-center gap-2",children:[r&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>o(!0),children:s.jsx(_e,{className:"w-4 h-4"})}),t.length>0&&s.jsx("button",{onClick:()=>i(!a),className:"text-gray-500 hover:text-gray-700",children:a?s.jsx(Tc,{className:"w-4 h-4"}):s.jsx(dn,{className:"w-4 h-4"})})]})]}),!a&&x.length>0&&s.jsxs("div",{className:"text-sm text-gray-600",children:["Letzte: ",new Date(x[0].invoiceDate).toLocaleDateString("de-DE")," - ",Ox[x[0].invoiceType]]}),a&&x.length>0&&s.jsx("div",{className:"space-y-2",children:x.map(p=>s.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg group",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium",children:new Date(p.invoiceDate).toLocaleDateString("de-DE")}),s.jsx("div",{className:"text-xs text-gray-500",children:Ox[p.invoiceType]})]}),p.documentPath&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("a",{href:`/api${p.documentPath}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-blue-600 hover:text-blue-800 text-sm",title:"Anzeigen",children:s.jsx(Ae,{className:"w-4 h-4"})}),s.jsx("a",{href:`/api${p.documentPath}`,download:!0,className:"flex items-center gap-1 text-blue-600 hover:text-blue-800 text-sm",title:"Download",children:s.jsx(Ps,{className:"w-4 h-4"})})]}),p.notes&&s.jsx("span",{className:"text-xs text-gray-400 italic",children:p.notes})]}),r&&s.jsxs("div",{className:"flex items-center gap-2 opacity-0 group-hover:opacity-100",children:[s.jsx("button",{onClick:()=>d(p),className:"text-gray-500 hover:text-blue-600",title:"Bearbeiten",children:s.jsx(He,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{confirm("Rechnung wirklich löschen?")&&h.mutate(p.id)},className:"text-gray-500 hover:text-red-600",title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4"})})]})]},p.id))}),a&&x.length===0&&s.jsx("p",{className:"text-sm text-gray-500 italic",children:"Keine Rechnungen vorhanden."}),(l||c)&&s.jsx(rC,{isOpen:!0,onClose:()=>{o(!1),d(null)},ecdId:e,contractId:n,invoice:c})]})}function rC({isOpen:e,onClose:t,ecdId:n,contractId:r,invoice:a}){const i=ge(),l=!!a,o=j.useRef(null),[c,d]=j.useState({invoiceDate:a!=null&&a.invoiceDate?new Date(a.invoiceDate).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],invoiceType:(a==null?void 0:a.invoiceType)||"INTERIM",notes:(a==null?void 0:a.notes)||""}),[u,h]=j.useState(null),[x,m]=j.useState(null),f=G({mutationFn:async N=>{var P;const E=await aa.addInvoice(n,{invoiceDate:c.invoiceDate,invoiceType:c.invoiceType,notes:c.notes||void 0});return(P=E.data)!=null&&P.id&&await aa.uploadDocument(E.data.id,N),E},onSuccess:()=>{i.invalidateQueries({queryKey:["contract",r.toString()]}),t()},onError:N=>{m(N.message)}}),p=G({mutationFn:async()=>await aa.addInvoice(n,{invoiceDate:c.invoiceDate,invoiceType:c.invoiceType,notes:c.notes||void 0}),onSuccess:()=>{i.invalidateQueries({queryKey:["contract",r.toString()]}),t()},onError:N=>{m(N.message)}}),b=G({mutationFn:async N=>{const E=await aa.updateInvoice(n,a.id,{invoiceDate:c.invoiceDate,invoiceType:c.invoiceType,notes:c.notes||void 0});return N&&await aa.uploadDocument(a.id,N),E},onSuccess:()=>{i.invalidateQueries({queryKey:["contract",r.toString()]}),t()},onError:N=>{m(N.message)}}),g=N=>{if(N.preventDefault(),m(null),l){if(c.invoiceType!=="NOT_AVAILABLE"&&!(a!=null&&a.documentPath)&&!u){m("Bitte laden Sie ein Dokument hoch");return}b.mutate(u)}else if(c.invoiceType==="NOT_AVAILABLE")p.mutate();else if(u)f.mutate(u);else{m("Bitte laden Sie ein Dokument hoch");return}},y=N=>{var P;const E=(P=N.target.files)==null?void 0:P[0];if(E){if(E.type!=="application/pdf"){m("Nur PDF-Dateien sind erlaubt");return}if(E.size>10*1024*1024){m("Datei ist zu groß (max. 10 MB)");return}h(E),m(null)}},v=f.isPending||p.isPending||b.isPending;return s.jsx(qe,{isOpen:e,onClose:t,title:l?"Rechnung bearbeiten":"Rechnung hinzufügen",children:s.jsxs("form",{onSubmit:g,className:"space-y-4",children:[x&&s.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm",children:x}),s.jsx(H,{label:"Rechnungsdatum",type:"date",value:c.invoiceDate,onChange:N=>d({...c,invoiceDate:N.target.value}),required:!0}),s.jsx(Ie,{label:"Rechnungstyp",value:c.invoiceType,onChange:N=>d({...c,invoiceType:N.target.value}),options:[{value:"INTERIM",label:"Zwischenrechnung"},{value:"FINAL",label:"Schlussrechnung"},{value:"NOT_AVAILABLE",label:"Nicht verfügbar"}]}),c.invoiceType!=="NOT_AVAILABLE"&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Dokument (PDF) *"}),(a==null?void 0:a.documentPath)&&!u&&s.jsxs("div",{className:"mb-2 text-sm text-green-600 flex items-center gap-1",children:[s.jsx(xr,{className:"w-4 h-4"}),"Dokument vorhanden"]}),u&&s.jsxs("div",{className:"mb-2 text-sm text-blue-600 flex items-center gap-1",children:[s.jsx(Be,{className:"w-4 h-4"}),u.name]}),s.jsx("input",{type:"file",ref:o,accept:".pdf",onChange:y,className:"hidden"}),s.jsx(T,{type:"button",variant:"secondary",onClick:()=>{var N;return(N=o.current)==null?void 0:N.click()},children:a!=null&&a.documentPath||u?"Ersetzen":"PDF hochladen"})]}),c.invoiceType==="NOT_AVAILABLE"&&s.jsx("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg text-yellow-800 text-sm",children:'Bei diesem Typ wird kein Dokument benötigt. Die Rechnung wird als "nicht mehr zu bekommen" markiert.'}),s.jsx(H,{label:"Notizen (optional)",value:c.notes,onChange:N=>d({...c,notes:N.target.value}),placeholder:"Optionale Anmerkungen..."}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:v,children:v?"Wird gespeichert...":l?"Speichern":"Hinzufügen"})]})]})})}const aC=10.5;function zx(e,t){const n=new Date(e),r=new Date(t);n.setHours(0,0,0,0),r.setHours(0,0,0,0);const a=r.getTime()-n.getTime();return Math.ceil(a/(1e3*60*60*24))}function iC(e,t,n){const r=new Date(t),a=new Date(n);return r.setHours(0,0,0,0),a.setHours(0,0,0,0),e.filter(i=>{const l=new Date(i.readingDate);return l.setHours(0,0,0,0),l>=r&&l<=a})}function lC(e,t,n,r){const a=iC(e,t,n);if(a.length===0)return{type:"none",consumptionKwh:0};if(a.length===1)return{type:"insufficient",consumptionKwh:0,message:"Berechnung auf Grund fehlender Stände nicht möglich"};const i=[...a].sort((f,p)=>new Date(f.readingDate).getTime()-new Date(p.readingDate).getTime()),l=i[0],o=i[i.length-1],c=new Date(o.readingDate),d=new Date(n);if(c.setHours(0,0,0,0),d.setHours(0,0,0,0),c>=d){const f=o.value-l.value;return $x("exact",f,r,l,o)}const u=zx(l.readingDate,o.readingDate);if(u<1)return{type:"insufficient",consumptionKwh:0,message:"Zeitraum zwischen Zählerständen zu kurz für Berechnung"};const h=zx(t,n),m=(o.value-l.value)/u*h;return $x("projected",m,r,l,o,n)}function $x(e,t,n,r,a,i){return n==="GAS"?{type:e,consumptionM3:t,consumptionKwh:t*aC,startReading:r,endReading:a,projectedEndDate:i}:{type:e,consumptionKwh:t,startReading:r,endReading:a,projectedEndDate:i}}function oC(e,t,n,r){if(t==null&&n==null)return null;const a=(t??0)*12,i=e*(n??0),l=a+i,o=l-(r??0),c=o/12;return{annualBaseCost:a,annualConsumptionCost:i,annualTotalCost:l,monthlyPayment:c,bonus:r??void 0,effectiveAnnualCost:o}}const cC={ELECTRICITY:"Strom",GAS:"Gas",DSL:"DSL",CABLE:"Kabelinternet",FIBER:"Glasfaser",MOBILE:"Mobilfunk",TV:"TV",CAR_INSURANCE:"KFZ-Versicherung"},dC={DRAFT:"Entwurf",PENDING:"Ausstehend",ACTIVE:"Aktiv",CANCELLED:"Gekündigt",EXPIRED:"Abgelaufen",DEACTIVATED:"Deaktiviert"},uC={ACTIVE:"success",PENDING:"warning",CANCELLED:"danger",EXPIRED:"danger",DRAFT:"default",DEACTIVATED:"default"},mC=[{status:"DRAFT",label:"Entwurf",description:"Vertrag wird noch vorbereitet",color:"text-gray-600"},{status:"PENDING",label:"Ausstehend",description:"Wartet auf Aktivierung",color:"text-yellow-600"},{status:"ACTIVE",label:"Aktiv",description:"Vertrag läuft normal",color:"text-green-600"},{status:"EXPIRED",label:"Abgelaufen",description:"Laufzeit vorbei, läuft aber ohne Kündigung weiter",color:"text-orange-600"},{status:"CANCELLED",label:"Gekündigt",description:"Aktive Kündigung eingereicht, Vertrag endet",color:"text-red-600"},{status:"DEACTIVATED",label:"Deaktiviert",description:"Manuell beendet/archiviert",color:"text-gray-500"}];function hC({isOpen:e,onClose:t}){return e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[s.jsx("div",{className:"fixed inset-0 bg-black/20",onClick:t}),s.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl p-4 max-w-sm w-full mx-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Vertragsstatus-Übersicht"}),s.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600",children:s.jsx(qt,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"space-y-2",children:mC.map(({status:n,label:r,description:a,color:i})=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:`font-medium text-sm min-w-[90px] ${i}`,children:r}),s.jsx("span",{className:"text-sm text-gray-600",children:a})]},n))})]})]}):null}function fC(e){const t=e.match(/^(\d+)([TMWJ])$/);if(!t)return!1;const n=parseInt(t[1]),r=t[2];let a=0;return r==="T"?a=n:r==="W"?a=n*7:r==="M"?a=n*30:r==="J"&&(a=n*365),a<=30}function pC({simCard:e}){const[t,n]=j.useState(!1),[r,a]=j.useState(null),[i,l]=j.useState(!1),o=async()=>{if(t)n(!1),a(null);else{l(!0);try{const c=await Oe.getSimCardCredentials(e.id);c.data&&(a(c.data),n(!0))}catch{alert("PIN/PUK konnte nicht geladen werden")}finally{l(!1)}}};return s.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg border",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.isMain&&s.jsx(ve,{variant:"success",children:"Hauptkarte"}),e.isMultisim&&s.jsx(ve,{variant:"warning",children:"Multisim"})]}),s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 text-sm",children:[e.phoneNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"Rufnummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[e.phoneNumber,s.jsx(oe,{value:e.phoneNumber})]})]}),e.simCardNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"SIM-Nr."}),s.jsxs("dd",{className:"font-mono text-xs flex items-center gap-1",children:[e.simCardNumber,s.jsx(oe,{value:e.simCardNumber})]})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"PIN"}),s.jsx("dd",{className:"font-mono flex items-center gap-1",children:t&&(r!=null&&r.pin)?s.jsxs(s.Fragment,{children:[r.pin,s.jsx(oe,{value:r.pin})]}):"••••"})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"PUK"}),s.jsx("dd",{className:"font-mono flex items-center gap-1",children:t&&(r!=null&&r.puk)?s.jsxs(s.Fragment,{children:[r.puk,s.jsx(oe,{value:r.puk})]}):"••••••••"})]})]}),s.jsx("div",{className:"mt-2",children:s.jsx(T,{variant:"ghost",size:"sm",onClick:o,disabled:i,children:i?"Laden...":t?s.jsxs(s.Fragment,{children:[s.jsx(It,{className:"w-4 h-4 mr-1"})," PIN/PUK verbergen"]}):s.jsxs(s.Fragment,{children:[s.jsx(Ae,{className:"w-4 h-4 mr-1"})," PIN/PUK anzeigen"]})})})]})}function xC({meterId:e,meterType:t,readings:n,contractId:r,canEdit:a}){const[i,l]=j.useState(!1),[o,c]=j.useState(!1),[d,u]=j.useState(null),h=ge(),x=G({mutationFn:p=>ln.deleteReading(e,p),onSuccess:()=>{h.invalidateQueries({queryKey:["contract",r.toString()]})}}),m=[...n].sort((p,b)=>new Date(b.readingDate).getTime()-new Date(p.readingDate).getTime()),f=t==="ELECTRICITY"?"kWh":"m³";return s.jsxs("div",{className:"mt-4 pt-4 border-t",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Dv,{className:"w-4 h-4 text-gray-500"}),s.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Zählerstände"}),s.jsx(ve,{variant:"default",children:n.length})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[a&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>c(!0),title:"Zählerstand erfassen",children:s.jsx(_e,{className:"w-4 h-4"})}),n.length>0&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>l(!i),children:i?s.jsx(Tc,{className:"w-4 h-4"}):s.jsx(dn,{className:"w-4 h-4"})})]})]}),i&&n.length>0&&s.jsx("div",{className:"space-y-2 bg-gray-50 rounded-lg p-3",children:m.map(p=>s.jsxs("div",{className:"flex justify-between items-center text-sm group py-1 border-b border-gray-200 last:border-0",children:[s.jsxs("span",{className:"text-gray-500 flex items-center gap-1",children:[new Date(p.readingDate).toLocaleDateString("de-DE"),s.jsx(oe,{value:new Date(p.readingDate).toLocaleDateString("de-DE")})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"font-mono flex items-center gap-1",children:[p.value.toLocaleString("de-DE")," ",p.unit,s.jsx(oe,{value:p.value.toString(),title:"Nur Wert kopieren"})]}),a&&s.jsxs("div",{className:"opacity-0 group-hover:opacity-100 flex gap-1",children:[s.jsx("button",{onClick:()=>u(p),className:"text-gray-400 hover:text-blue-600",title:"Bearbeiten",children:s.jsx(He,{className:"w-3 h-3"})}),s.jsx("button",{onClick:()=>{confirm("Zählerstand wirklich löschen?")&&x.mutate(p.id)},className:"text-gray-400 hover:text-red-600",title:"Löschen",children:s.jsx(Ne,{className:"w-3 h-3"})})]})]})]},p.id))}),!i&&n.length>0&&s.jsxs("p",{className:"text-sm text-gray-500",children:["Letzter Stand: ",m[0].value.toLocaleString("de-DE")," ",m[0].unit," (",new Date(m[0].readingDate).toLocaleDateString("de-DE"),")"]}),n.length===0&&s.jsx("p",{className:"text-sm text-gray-500",children:"Keine Zählerstände vorhanden."}),(o||d)&&s.jsx(gC,{isOpen:!0,onClose:()=>{c(!1),u(null)},meterId:e,contractId:r,reading:d,defaultUnit:f})]})}function gC({isOpen:e,onClose:t,meterId:n,contractId:r,reading:a,defaultUnit:i}){var f;const l=ge(),o=!!a,[c,d]=j.useState({readingDate:a!=null&&a.readingDate?new Date(a.readingDate).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],value:((f=a==null?void 0:a.value)==null?void 0:f.toString())||"",notes:(a==null?void 0:a.notes)||""}),u=G({mutationFn:p=>ln.addReading(n,p),onSuccess:()=>{l.invalidateQueries({queryKey:["contract",r.toString()]}),t()}}),h=G({mutationFn:p=>ln.updateReading(n,a.id,p),onSuccess:()=>{l.invalidateQueries({queryKey:["contract",r.toString()]}),t()}}),x=p=>{p.preventDefault();const b={readingDate:new Date(c.readingDate),value:parseFloat(c.value),unit:i,notes:c.notes||void 0};o?h.mutate(b):u.mutate(b)},m=u.isPending||h.isPending;return s.jsx(qe,{isOpen:e,onClose:t,title:o?"Zählerstand bearbeiten":"Zählerstand erfassen",children:s.jsxs("form",{onSubmit:x,className:"space-y-4",children:[s.jsx(H,{label:"Ablesedatum",type:"date",value:c.readingDate,onChange:p=>d({...c,readingDate:p.target.value}),required:!0}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx("div",{className:"col-span-2",children:s.jsx(H,{label:"Zählerstand",type:"number",step:"0.01",value:c.value,onChange:p=>d({...c,value:p.target.value}),required:!0})}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Einheit"}),s.jsx("div",{className:"h-10 flex items-center px-3 bg-gray-100 border border-gray-300 rounded-md text-gray-700",children:i})]})]}),s.jsx(H,{label:"Notizen (optional)",value:c.notes,onChange:p=>d({...c,notes:p.target.value})}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:m||!c.value,children:m?"Speichern...":o?"Speichern":"Erfassen"})]})]})})}function yC({contractType:e,readings:t,startDate:n,endDate:r,basePrice:a,unitPrice:i,bonus:l}){const o=lC(t,n,r,e),c=o.consumptionKwh>0?oC(o.consumptionKwh,a,i,l):null;if(o.type==="none")return null;const d=(h,x=2)=>h.toLocaleString("de-DE",{minimumFractionDigits:x,maximumFractionDigits:x}),u=h=>new Date(h).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"});return s.jsxs("div",{className:"mt-4 pt-4 border-t",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(M2,{className:"w-4 h-4 text-gray-500"}),s.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Verbrauch & Kosten"}),o.type==="exact"&&s.jsx(ve,{variant:"success",children:"Exakt"}),o.type==="projected"&&s.jsx(ve,{variant:"warning",children:"Hochrechnung"})]}),o.type==="insufficient"?s.jsx("p",{className:"text-sm text-gray-500 italic",children:o.message}):s.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsxs("h5",{className:"text-sm font-medium text-gray-600 mb-2",children:["Berechneter Verbrauch",o.type==="projected"&&" (hochgerechnet)"]}),s.jsx("div",{className:"text-lg font-semibold text-gray-900",children:e==="GAS"?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"font-mono",children:[d(o.consumptionM3||0)," m³"]}),s.jsxs("span",{className:"text-gray-500 text-sm ml-2",children:["= ",d(o.consumptionKwh)," kWh"]})]}):s.jsxs("span",{className:"font-mono",children:[d(o.consumptionKwh)," kWh"]})}),o.startReading&&o.endReading&&s.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["Basierend auf Zählerständen vom ",u(o.startReading.readingDate)," bis ",u(o.endReading.readingDate)]})]}),c&&s.jsxs("div",{className:"border-t border-gray-200 pt-4",children:[s.jsx("h5",{className:"text-sm font-medium text-gray-600 mb-3",children:"Kostenvorschau"}),s.jsxs("div",{className:"space-y-2 text-sm",children:[a!=null&&a>0&&s.jsxs("div",{className:"flex justify-between",children:[s.jsxs("span",{className:"text-gray-600",children:["Grundpreis: ",d(a)," €/Mon × 12"]}),s.jsxs("span",{className:"font-mono",children:[d(c.annualBaseCost)," €"]})]}),i!=null&&i>0&&s.jsxs("div",{className:"flex justify-between",children:[s.jsxs("span",{className:"text-gray-600",children:["Arbeitspreis: ",d(o.consumptionKwh)," kWh × ",d(i,4)," €"]}),s.jsxs("span",{className:"font-mono",children:[d(c.annualConsumptionCost)," €"]})]}),s.jsx("div",{className:"border-t border-gray-300 pt-2",children:s.jsxs("div",{className:"flex justify-between font-medium",children:[s.jsx("span",{className:"text-gray-700",children:"Jahreskosten"}),s.jsxs("span",{className:"font-mono",children:[d(c.annualTotalCost)," €"]})]})}),c.bonus!=null&&c.bonus>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex justify-between text-green-600",children:[s.jsx("span",{children:"Bonus"}),s.jsxs("span",{className:"font-mono",children:["- ",d(c.bonus)," €"]})]}),s.jsx("div",{className:"border-t border-gray-300 pt-2",children:s.jsxs("div",{className:"flex justify-between font-semibold",children:[s.jsx("span",{className:"text-gray-800",children:"Effektive Jahreskosten"}),s.jsxs("span",{className:"font-mono",children:[d(c.effectiveAnnualCost)," €"]})]})})]}),s.jsx("div",{className:"border-t border-gray-300 pt-2 mt-2",children:s.jsxs("div",{className:"flex justify-between text-blue-700 font-semibold",children:[s.jsx("span",{children:"Monatlicher Abschlag"}),s.jsxs("span",{className:"font-mono",children:[d(c.monthlyPayment)," €"]})]})})]})]})]})]})}function _x({task:e,contractId:t,canEdit:n,isCustomerPortal:r,isCompleted:a,onEdit:i}){const[l,o]=j.useState(""),[c,d]=j.useState(!1),[u,h]=j.useState(null),[x,m]=j.useState(""),f=ge(),p=G({mutationFn:K=>et.complete(K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]})}}),b=G({mutationFn:K=>et.reopen(K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]})}}),g=G({mutationFn:K=>et.delete(K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]})}}),y=G({mutationFn:K=>et.createSubtask(e.id,K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]}),o(""),d(!1)},onError:K=>{console.error("Fehler beim Erstellen der Unteraufgabe:",K),alert("Fehler beim Erstellen der Unteraufgabe. Bitte versuchen Sie es erneut.")}}),v=G({mutationFn:K=>et.createReply(e.id,K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]}),o(""),d(!1)},onError:K=>{console.error("Fehler beim Erstellen der Antwort:",K),alert("Fehler beim Erstellen der Antwort. Bitte versuchen Sie es erneut.")}}),N=G({mutationFn:({id:K,title:B})=>et.updateSubtask(K,B),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]}),h(null),m("")}}),E=G({mutationFn:K=>et.completeSubtask(K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]})}}),P=G({mutationFn:K=>et.reopenSubtask(K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]})}}),I=G({mutationFn:K=>et.deleteSubtask(K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]})}}),w=K=>{K.preventDefault(),l.trim()&&(r?v.mutate(l.trim()):y.mutate(l.trim()))},S=K=>{K.preventDefault(),x.trim()&&u&&N.mutate({id:u,title:x.trim()})},A=(K,B)=>{h(K),m(B)},O=()=>{h(null),m("")},R=e.subtasks||[],q=R.filter(K=>K.status==="OPEN"),D=R.filter(K=>K.status==="COMPLETED"),z=r?{singular:"Antwort",placeholder:"Antwort...",deleteConfirm:"Antwort löschen?"}:{singular:"Unteraufgabe",placeholder:"Unteraufgabe...",deleteConfirm:"Unteraufgabe löschen?"},k=(K,B)=>u===K.id?s.jsx("div",{className:"py-1",children:s.jsxs("form",{onSubmit:S,className:"flex items-center gap-2",children:[s.jsx(No,{className:"w-4 h-4 text-gray-300 flex-shrink-0"}),s.jsx("input",{type:"text",value:x,onChange:Q=>m(Q.target.value),className:"flex-1 text-sm px-2 py-1 border rounded focus:outline-none focus:ring-1 focus:ring-blue-500",autoFocus:!0}),s.jsx(T,{type:"submit",size:"sm",disabled:!x.trim()||N.isPending,children:"✓"}),s.jsx(T,{type:"button",variant:"ghost",size:"sm",onClick:O,children:"×"})]})},K.id):s.jsx("div",{className:`py-1 group/subtask ${B?"opacity-60":""}`,children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("button",{onClick:()=>B?P.mutate(K.id):E.mutate(K.id),disabled:E.isPending||P.isPending||r,className:`flex-shrink-0 mt-0.5 ${r?"cursor-default":B?"hover:text-yellow-600":"hover:text-green-600"}`,children:B?s.jsx(As,{className:"w-4 h-4 text-green-500"}):s.jsx(No,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:`text-sm ${B?"line-through text-gray-500":""}`,children:K.title}),n&&!r&&!B&&s.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 group-hover/subtask:opacity-100",children:[s.jsx("button",{onClick:()=>A(K.id,K.title),className:"text-gray-400 hover:text-blue-600 p-0.5",title:"Bearbeiten",children:s.jsx(He,{className:"w-3 h-3"})}),s.jsx("button",{onClick:()=>{confirm(z.deleteConfirm)&&I.mutate(K.id)},className:"text-gray-400 hover:text-red-600 p-0.5",title:"Löschen",children:s.jsx(Ne,{className:"w-3 h-3"})})]}),n&&!r&&B&&s.jsx("button",{onClick:()=>{confirm(z.deleteConfirm)&&I.mutate(K.id)},className:"text-gray-400 hover:text-red-600 p-0.5 opacity-0 group-hover/subtask:opacity-100",title:"Löschen",children:s.jsx(Ne,{className:"w-3 h-3"})})]}),s.jsxs("p",{className:"text-xs text-gray-400",children:[K.createdBy&&`${K.createdBy} • `,B?`Erledigt am ${K.completedAt?new Date(K.completedAt).toLocaleDateString("de-DE"):new Date(K.updatedAt).toLocaleDateString("de-DE")}`:new Date(K.createdAt).toLocaleDateString("de-DE")]})]})]})},K.id);return s.jsx("div",{className:`p-3 bg-gray-50 rounded-lg group ${a?"bg-gray-50/50 opacity-70":""}`,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("button",{onClick:()=>a?b.mutate(e.id):p.mutate(e.id),disabled:p.isPending||b.isPending||r,className:`mt-0.5 flex-shrink-0 ${r?"cursor-default":a?"hover:text-yellow-600":"hover:text-green-600"}`,title:r?void 0:a?"Wieder öffnen":"Als erledigt markieren",children:a?s.jsx(As,{className:"w-5 h-5 text-green-500"}):s.jsx(No,{className:"w-5 h-5 text-gray-400"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`font-medium ${a?"line-through text-gray-500":""}`,children:e.title}),e.visibleInPortal&&s.jsx(ve,{variant:"default",className:"text-xs",children:"Portal"}),R.length>0&&s.jsxs("span",{className:"text-xs text-gray-400",children:["(",D.length,"/",R.length,")"]})]}),e.description&&s.jsx("p",{className:`text-sm mt-1 whitespace-pre-wrap ${a?"text-gray-500":"text-gray-600"}`,children:e.description}),s.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:[e.createdBy&&`${e.createdBy} • `,a?`Erledigt am ${e.completedAt?new Date(e.completedAt).toLocaleDateString("de-DE"):"-"}`:new Date(e.createdAt).toLocaleDateString("de-DE")]}),R.length>0&&s.jsxs("div",{className:"mt-3 ml-2 space-y-0 border-l-2 border-gray-200 pl-3",children:[q.map(K=>k(K,!1)),D.map(K=>k(K,!0))]}),!a&&(n&&!r||r)&&s.jsx("div",{className:"mt-2 ml-2",children:c?s.jsxs("form",{onSubmit:w,className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",value:l,onChange:K=>o(K.target.value),placeholder:z.placeholder,className:"flex-1 text-sm px-2 py-1 border rounded focus:outline-none focus:ring-1 focus:ring-blue-500",autoFocus:!0}),s.jsx(T,{type:"submit",size:"sm",disabled:!l.trim()||y.isPending||v.isPending,children:s.jsx(_e,{className:"w-3 h-3"})}),s.jsx(T,{type:"button",variant:"ghost",size:"sm",onClick:()=>{d(!1),o("")},children:"×"})]}):s.jsxs("button",{onClick:()=>d(!0),className:"text-xs text-gray-400 hover:text-blue-600 flex items-center gap-1",children:[s.jsx(_e,{className:"w-3 h-3"}),z.singular]})})]}),n&&!r&&s.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100",children:[!a&&s.jsx("button",{onClick:i,className:"text-gray-400 hover:text-blue-600 p-1",title:"Bearbeiten",children:s.jsx(He,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{confirm("Aufgabe wirklich löschen?")&&g.mutate(e.id)},className:"text-gray-400 hover:text-red-600 p-1",title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4"})})]})]})})}function vC({contractId:e,canEdit:t,isCustomerPortal:n}){var v;const[r,a]=j.useState(!1),[i,l]=j.useState(null),{data:o,isLoading:c}=fe({queryKey:["contract-tasks",e],queryFn:()=>et.getByContract(e),staleTime:0,gcTime:0,refetchOnMount:"always"}),{data:d,isLoading:u}=fe({queryKey:["app-settings-public"],queryFn:()=>Xr.getPublic(),enabled:n,staleTime:0}),h=!u&&((v=d==null?void 0:d.data)==null?void 0:v.customerSupportTicketsEnabled)==="true",x=(o==null?void 0:o.data)||[],m=x.filter(N=>N.status==="OPEN"),f=x.filter(N=>N.status==="COMPLETED"),p=n?{title:"Support-Anfragen",button:"Anfrage erstellen",empty:"Keine Support-Anfragen vorhanden."}:{title:"Aufgaben",button:"Aufgabe",empty:"Keine Aufgaben vorhanden."},b=n?ul:dl;if(c||n&&u)return s.jsx(X,{className:"mb-6",title:p.title,children:s.jsx("div",{className:"text-center py-4 text-gray-500",children:"Laden..."})});const y=t&&!n||n&&h;return s.jsxs(X,{className:"mb-6",title:p.title,children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(b,{className:"w-5 h-5 text-gray-500"}),s.jsxs("span",{className:"text-sm text-gray-600",children:[m.length," offen, ",f.length," erledigt"]})]}),y&&s.jsxs(T,{size:"sm",onClick:()=>a(!0),children:[s.jsx(_e,{className:"w-4 h-4 mr-1"}),p.button]})]}),x.length===0?s.jsx("p",{className:"text-center py-4 text-gray-500",children:p.empty}):s.jsxs("div",{className:"space-y-2",children:[m.map(N=>s.jsx(_x,{task:N,contractId:e,canEdit:t,isCustomerPortal:n,isCompleted:!1,onEdit:()=>l(N)},N.id)),f.length>0&&m.length>0&&s.jsx("div",{className:"border-t my-3"}),f.map(N=>s.jsx(_x,{task:N,contractId:e,canEdit:t,isCustomerPortal:n,isCompleted:!0,onEdit:()=>{}},N.id))]}),(r||i)&&s.jsx(jC,{isOpen:!0,onClose:()=>{a(!1),l(null)},contractId:e,task:i,isCustomerPortal:n})]})}function jC({isOpen:e,onClose:t,contractId:n,task:r,isCustomerPortal:a=!1}){const i=ge(),l=!!r,[o,c]=j.useState({title:(r==null?void 0:r.title)||"",description:(r==null?void 0:r.description)||"",visibleInPortal:(r==null?void 0:r.visibleInPortal)||!1});j.useEffect(()=>{e&&c({title:(r==null?void 0:r.title)||"",description:(r==null?void 0:r.description)||"",visibleInPortal:(r==null?void 0:r.visibleInPortal)||!1})},[e,r]);const d=G({mutationFn:p=>et.create(n,p),onSuccess:async()=>{await i.refetchQueries({queryKey:["contract-tasks",n]}),t()}}),u=G({mutationFn:p=>et.createSupportTicket(n,p),onSuccess:async()=>{await i.refetchQueries({queryKey:["contract-tasks",n]}),t()}}),h=G({mutationFn:p=>et.update(r.id,p),onSuccess:async()=>{await i.refetchQueries({queryKey:["contract-tasks",n]}),t()}}),x=p=>{p.preventDefault(),l?h.mutate({title:o.title,description:o.description||void 0,visibleInPortal:o.visibleInPortal}):a?u.mutate({title:o.title,description:o.description||void 0}):d.mutate({title:o.title,description:o.description||void 0,visibleInPortal:o.visibleInPortal})},m=d.isPending||u.isPending||h.isPending,f=a?{modalTitle:l?"Anfrage bearbeiten":"Neue Support-Anfrage",titleLabel:"Betreff",titlePlaceholder:"Kurze Beschreibung Ihrer Anfrage",descLabel:"Ihre Nachricht",descPlaceholder:"Beschreiben Sie Ihr Anliegen...",submitBtn:l?"Speichern":"Anfrage senden"}:{modalTitle:l?"Aufgabe bearbeiten":"Neue Aufgabe",titleLabel:"Titel",titlePlaceholder:"Kurze Beschreibung der Aufgabe",descLabel:"Beschreibung (optional)",descPlaceholder:"Details zur Aufgabe...",submitBtn:l?"Speichern":"Erstellen"};return s.jsx(qe,{isOpen:e,onClose:t,title:f.modalTitle,children:s.jsxs("form",{onSubmit:x,className:"space-y-4",children:[s.jsx(H,{label:f.titleLabel,value:o.title,onChange:p=>c({...o,title:p.target.value}),required:!0,placeholder:f.titlePlaceholder}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:f.descLabel}),s.jsx("textarea",{value:o.description,onChange:p=>c({...o,description:p.target.value}),className:"w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",rows:a?5:3,placeholder:f.descPlaceholder})]}),!a&&s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.visibleInPortal,onChange:p=>c({...o,visibleInPortal:p.target.checked}),className:"w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),s.jsx("span",{className:"text-sm text-gray-700",children:"Im Kundenportal sichtbar"})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:m||!o.title.trim(),children:m?"Speichern...":f.submitBtn})]})]})})}function bC(){var nt,es,Vt,ae,Ge,xt;const{id:e}=Nc(),t=Yt(),r=Rn().state,a=ge(),{hasPermission:i,isCustomer:l,isCustomerPortal:o}=We(),c=parseInt(e),[d,u]=j.useState(!1),[h,x]=j.useState(null),[m,f]=j.useState(!1),[p,b]=j.useState(!1),[g,y]=j.useState(null),[v,N]=j.useState({}),[E,P]=j.useState({}),[I,w]=j.useState(!1),[S,A]=j.useState(!1),[O,R]=j.useState(!1),[q,D]=j.useState(!1),{data:z,isLoading:k}=fe({queryKey:["contract",e],queryFn:()=>Oe.getById(c)}),K=G({mutationFn:()=>Oe.delete(c),onSuccess:()=>{t("/contracts")}}),B=G({mutationFn:()=>Oe.createFollowUp(c),onSuccess:Z=>{Z.data?t(`/contracts/${Z.data.id}/edit`):alert("Folgevertrag wurde erstellt, aber keine ID zurückgegeben")},onError:Z=>{console.error("Folgevertrag Fehler:",Z),alert(`Fehler beim Erstellen des Folgevertrags: ${Z instanceof Error?Z.message:"Unbekannter Fehler"}`)}}),_=G({mutationFn:()=>Oe.snooze(c,{}),onSuccess:()=>{a.invalidateQueries({queryKey:["contract",e]}),a.invalidateQueries({queryKey:["contract-cockpit"]}),D(!1)},onError:Z=>{console.error("Un-Snooze Fehler:",Z),alert(`Fehler beim Aufheben der Zurückstellung: ${Z instanceof Error?Z.message:"Unbekannter Fehler"}`)}}),Q=G({mutationFn:Z=>{const Xe={cancellationConfirmationDate:Z?new Date(Z).toISOString():null};return Oe.update(c,Xe)},onSuccess:()=>{a.invalidateQueries({queryKey:["contract",e]}),a.invalidateQueries({queryKey:["contract-cockpit"]})},onError:Z=>{console.error("Fehler beim Speichern des Datums:",Z),alert("Fehler beim Speichern des Datums")}}),le=G({mutationFn:Z=>{const Xe={cancellationConfirmationOptionsDate:Z?new Date(Z).toISOString():null};return Oe.update(c,Xe)},onSuccess:()=>{a.invalidateQueries({queryKey:["contract",e]}),a.invalidateQueries({queryKey:["contract-cockpit"]})},onError:Z=>{console.error("Fehler beim Speichern des Datums:",Z),alert("Fehler beim Speichern des Datums")}}),de=async()=>{var Z;if(d)u(!1),x(null);else try{const Fe=await Oe.getPassword(c);(Z=Fe.data)!=null&&Z.password&&(x(Fe.data.password),u(!0))}catch{alert("Passwort konnte nicht entschlüsselt werden")}},Ke=async()=>{var Z;if(p)b(!1),y(null);else try{const Fe=await Oe.getInternetCredentials(c);(Z=Fe.data)!=null&&Z.password&&(y(Fe.data.password),b(!0))}catch{alert("Internet-Passwort konnte nicht entschlüsselt werden")}},Ve=async Z=>{var Fe;if(v[Z])N(Xe=>({...Xe,[Z]:!1})),P(Xe=>({...Xe,[Z]:null}));else try{const J=(Fe=(await Oe.getSipCredentials(Z)).data)==null?void 0:Fe.password;J&&(P(ue=>({...ue,[Z]:J})),N(ue=>({...ue,[Z]:!0})))}catch{alert("SIP-Passwort konnte nicht entschlüsselt werden")}},st=async()=>{var Xe,J,ue;const Z=z==null?void 0:z.data,Fe=((Xe=Z==null?void 0:Z.stressfreiEmail)==null?void 0:Xe.email)||(Z==null?void 0:Z.portalUsername);if(!((J=Z==null?void 0:Z.provider)!=null&&J.portalUrl)||!Fe){alert("Portal-URL oder Benutzername fehlt");return}f(!0);try{const ts=await Oe.getPassword(c);if(!((ue=ts.data)!=null&&ue.password)){alert("Passwort konnte nicht entschlüsselt werden");return}const un=Z.provider,gt=un.portalUrl,L=un.usernameFieldName||"username",U=un.passwordFieldName||"password",W=new URL(gt);W.searchParams.set(L,Fe),W.searchParams.set(U,ts.data.password),window.open(W.toString(),"_blank")}catch{alert("Fehler beim Auto-Login")}finally{f(!1)}};if(k)return s.jsx("div",{className:"text-center py-8",children:"Laden..."});if(!(z!=null&&z.data))return s.jsx("div",{className:"text-center py-8 text-red-600",children:"Vertrag nicht gefunden"});const C=z.data;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{if((r==null?void 0:r.from)==="customer"&&(r!=null&&r.customerId))t(`/customers/${r.customerId}?tab=contracts`);else if((r==null?void 0:r.from)==="cockpit"){const Z=r.filter?`?filter=${r.filter}`:"";t(`/contracts/cockpit${Z}`)}else(r==null?void 0:r.from)==="contracts"?t("/contracts"):C.customer?t(`/customers/${C.customer.id}?tab=contracts`):t("/contracts")},children:s.jsx(Vs,{className:"w-4 h-4"})}),s.jsx("h1",{className:"text-2xl font-bold",children:C.contractNumber}),s.jsx(ve,{children:cC[C.type]}),s.jsx(ve,{variant:uC[C.status],children:dC[C.status]}),s.jsx("button",{onClick:()=>R(!0),className:"text-gray-400 hover:text-blue-600 transition-colors",title:"Status-Erklärung",children:s.jsx(Ml,{className:"w-4 h-4"})}),C.nextReviewDate&&new Date(C.nextReviewDate)>new Date&&s.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 bg-amber-100 text-amber-800 rounded-full text-xs",children:[s.jsx(Sv,{className:"w-3 h-3"}),s.jsxs("span",{children:["Zurückgestellt bis ",new Date(C.nextReviewDate).toLocaleDateString("de-DE")]}),i("contracts:update")&&s.jsx("button",{onClick:()=>D(!0),className:"ml-1 p-0.5 hover:bg-amber-200 rounded",title:"Zurückstellung aufheben",children:s.jsx(qt,{className:"w-3 h-3"})})]})]}),C.customer&&s.jsxs("p",{className:"text-gray-500 ml-10",children:["Kunde:"," ",s.jsx(ke,{to:`/customers/${C.customer.id}`,className:"text-blue-600 hover:underline",children:C.customer.companyName||`${C.customer.firstName} ${C.customer.lastName}`})]})]}),!l&&s.jsxs("div",{className:"flex gap-2",children:[C.previousContract&&s.jsx(ke,{to:`/contracts/${C.previousContract.id}`,children:s.jsxs(T,{variant:"secondary",children:[s.jsx(Vs,{className:"w-4 h-4 mr-2"}),"Vorgängervertrag"]})}),i("contracts:create")&&!C.followUpContract&&s.jsxs(T,{variant:"secondary",onClick:()=>A(!0),disabled:B.isPending,children:[s.jsx(oh,{className:"w-4 h-4 mr-2"}),B.isPending?"Erstelle...":"Folgevertrag anlegen"]}),C.followUpContract&&s.jsx(ke,{to:`/contracts/${C.followUpContract.id}`,children:s.jsxs(T,{variant:"secondary",children:[s.jsx(wv,{className:"w-4 h-4 mr-2"}),"Folgevertrag anzeigen"]})}),i("contracts:update")&&s.jsx(ke,{to:`/contracts/${e}/edit`,children:s.jsxs(T,{variant:"secondary",children:[s.jsx(He,{className:"w-4 h-4 mr-2"}),"Bearbeiten"]})}),i("contracts:delete")&&s.jsxs(T,{variant:"danger",onClick:()=>{confirm("Vertrag wirklich löschen?")&&K.mutate()},children:[s.jsx(Ne,{className:"w-4 h-4 mr-2"}),"Löschen"]})]})]}),C.previousContract&&s.jsx(X,{className:"mb-6 border-l-4 border-l-blue-500",title:"Vorgängervertrag",children:s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsnummer"}),s.jsx("dd",{children:s.jsx("button",{onClick:()=>w(!0),className:"text-blue-600 hover:underline",children:C.previousContract.contractNumber})})]}),C.previousContract.providerName&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Anbieter"}),s.jsx("dd",{children:C.previousContract.providerName})]}),C.previousContract.customerNumberAtProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kundennummer"}),s.jsx("dd",{className:"font-mono",children:C.previousContract.customerNumberAtProvider})]}),C.previousContract.contractNumberAtProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsnummer"}),s.jsx("dd",{className:"font-mono",children:C.previousContract.contractNumberAtProvider})]}),C.previousContract.portalUsername&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Zugangsdaten"}),s.jsx("dd",{children:C.previousContract.portalUsername})]})]})}),!C.previousContract&&(C.previousProvider||C.previousCustomerNumber||C.previousContractNumber)&&s.jsx(X,{className:"mb-6 border-l-4 border-l-gray-400",title:"Altanbieter",children:s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[C.previousProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Anbieter"}),s.jsx("dd",{children:C.previousProvider.name})]}),C.previousCustomerNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kundennummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.previousCustomerNumber,s.jsx(oe,{value:C.previousCustomerNumber})]})]}),C.previousContractNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsnummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.previousContractNumber,s.jsx(oe,{value:C.previousContractNumber})]})]})]})}),C.cancellationConfirmationDate&&s.jsxs("div",{className:"mb-6 p-4 bg-red-50 border-2 border-red-400 rounded-lg flex items-start gap-3",children:[s.jsx("span",{className:"text-red-600 text-xl font-bold",children:"!"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold text-red-800",children:"Kündigungsbestätigung vorhanden"}),s.jsxs("p",{className:"text-sm text-red-700 mt-1",children:["Dieser Vertrag hat eine Kündigungsbestätigung vom"," ",s.jsx("strong",{children:new Date(C.cancellationConfirmationDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})}),".",C.cancellationConfirmationOptionsDate&&s.jsxs(s.Fragment,{children:[" Optionen-Bestätigung: ",s.jsx("strong",{children:new Date(C.cancellationConfirmationOptionsDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})}),"."]})]})]})]}),C.type==="MOBILE"&&((nt=C.mobileDetails)==null?void 0:nt.requiresMultisim)&&s.jsxs("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-300 rounded-lg flex items-start gap-3",children:[s.jsx("span",{className:"text-amber-600 text-xl font-bold",children:"!"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold text-amber-800",children:"Multisim erforderlich"}),s.jsx("p",{className:"text-sm text-amber-700 mt-1",children:"Dieser Kunde benötigt eine Multisim-Karte. Multisim ist bei Klarmobil, Congstar und Otelo nicht buchbar. Bitte einen Anbieter wie Freenet oder vergleichbar wählen."})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6",children:[s.jsx(X,{title:"Anbieter & Tarif",children:s.jsxs("dl",{className:"space-y-3",children:[(C.provider||C.providerName)&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Anbieter"}),s.jsx("dd",{className:"font-medium",children:((es=C.provider)==null?void 0:es.name)||C.providerName})]}),(C.tariff||C.tariffName)&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Tarif"}),s.jsx("dd",{children:((Vt=C.tariff)==null?void 0:Vt.name)||C.tariffName})]}),C.customerNumberAtProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kundennummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.customerNumberAtProvider,s.jsx(oe,{value:C.customerNumberAtProvider})]})]}),C.contractNumberAtProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsnummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.contractNumberAtProvider,s.jsx(oe,{value:C.contractNumberAtProvider})]})]}),C.salesPlatform&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertriebsplattform"}),s.jsx("dd",{children:C.salesPlatform.name})]}),C.commission!==null&&C.commission!==void 0&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Provision"}),s.jsx("dd",{children:C.commission.toLocaleString("de-DE",{style:"currency",currency:"EUR"})})]}),C.priceFirst12Months&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Preis erste 12 Monate"}),s.jsx("dd",{children:C.priceFirst12Months})]}),C.priceFrom13Months&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Preis ab 13. Monat"}),s.jsx("dd",{children:C.priceFrom13Months})]}),C.priceAfter24Months&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Preis nach 24 Monaten"}),s.jsx("dd",{children:C.priceAfter24Months})]})]})}),s.jsxs(X,{title:"Laufzeit und Kündigung",className:C.cancellationConfirmationDate?"border-2 border-red-400":"",children:[C.contractDuration&&fC(C.contractDuration.code)&&s.jsxs("p",{className:"text-sm text-gray-500 mb-4 bg-blue-50 border border-blue-200 rounded-lg p-3",children:[s.jsx("strong",{children:"Hinweis:"})," Dieser Vertrag gilt als unbefristet mit der jeweiligen Kündigungsfrist."]}),s.jsxs("dl",{className:"space-y-3",children:[C.startDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsbeginn"}),s.jsx("dd",{children:new Date(C.startDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),C.endDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsende"}),s.jsx("dd",{children:new Date(C.endDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),C.contractDuration&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragslaufzeit"}),s.jsx("dd",{children:C.contractDuration.description})]}),C.cancellationPeriod&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kündigungsfrist"}),s.jsx("dd",{children:C.cancellationPeriod.description})]}),C.cancellationConfirmationDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kündigungsbestätigungsdatum"}),s.jsx("dd",{children:new Date(C.cancellationConfirmationDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),C.cancellationConfirmationOptionsDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kündigungsbestätigungsoptionendatum"}),s.jsx("dd",{children:new Date(C.cancellationConfirmationOptionsDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),C.wasSpecialCancellation&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Sonderkündigung"}),s.jsx("dd",{children:s.jsx(ve,{variant:"warning",children:"Ja"})})]})]}),i("contracts:update")&&s.jsxs("div",{className:"mt-6 pt-6 border-t",children:[s.jsx("h4",{className:"font-medium mb-4",children:"Kündigungsdokumente"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500 mb-1",children:"Kündigungsschreiben"}),C.cancellationLetterPath?s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("a",{href:`/api${C.cancellationLetterPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ae,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${C.cancellationLetterPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ps,{className:"w-4 h-4"}),"Download"]}),s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationLetter(c,Z),a.invalidateQueries({queryKey:["contract",e]})},existingFile:C.cancellationLetterPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:async()=>{confirm("Dokument wirklich löschen?")&&(await ut.deleteCancellationLetter(c),a.invalidateQueries({queryKey:["contract",e]}))},className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]}):s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationLetter(c,Z),a.invalidateQueries({queryKey:["contract",e]})},accept:".pdf",label:"PDF hochladen"})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500 mb-1",children:"Kündigungsbestätigung"}),C.cancellationConfirmationPath?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("a",{href:`/api${C.cancellationConfirmationPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ae,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${C.cancellationConfirmationPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ps,{className:"w-4 h-4"}),"Download"]}),s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationConfirmation(c,Z),a.invalidateQueries({queryKey:["contract",e]})},existingFile:C.cancellationConfirmationPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:async()=>{confirm("Dokument wirklich löschen?")&&(await ut.deleteCancellationConfirmation(c),a.invalidateQueries({queryKey:["contract",e]}))},className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Bestätigung erhalten am"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"date",value:C.cancellationConfirmationDate?C.cancellationConfirmationDate.split("T")[0]:"",onChange:Z=>{const Fe=Z.target.value||null;Q.mutate(Fe)},className:"block w-full max-w-[180px] px-2 py-1 text-sm border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500"}),C.cancellationConfirmationDate&&s.jsx("button",{onClick:()=>Q.mutate(null),className:"p-1 text-red-500 hover:text-red-700 hover:bg-red-50 rounded",title:"Datum löschen",children:s.jsx(Ne,{className:"w-4 h-4"})})]})]})]}):s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationConfirmation(c,Z),a.invalidateQueries({queryKey:["contract",e]})},accept:".pdf",label:"PDF hochladen"})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500 mb-1",children:"Kündigungsschreiben Optionen"}),C.cancellationLetterOptionsPath?s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("a",{href:`/api${C.cancellationLetterOptionsPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ae,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${C.cancellationLetterOptionsPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ps,{className:"w-4 h-4"}),"Download"]}),s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationLetterOptions(c,Z),a.invalidateQueries({queryKey:["contract",e]})},existingFile:C.cancellationLetterOptionsPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:async()=>{confirm("Dokument wirklich löschen?")&&(await ut.deleteCancellationLetterOptions(c),a.invalidateQueries({queryKey:["contract",e]}))},className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]}):s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationLetterOptions(c,Z),a.invalidateQueries({queryKey:["contract",e]})},accept:".pdf",label:"PDF hochladen"})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500 mb-1",children:"Kündigungsbestätigung Optionen"}),C.cancellationConfirmationOptionsPath?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("a",{href:`/api${C.cancellationConfirmationOptionsPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ae,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${C.cancellationConfirmationOptionsPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ps,{className:"w-4 h-4"}),"Download"]}),s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationConfirmationOptions(c,Z),a.invalidateQueries({queryKey:["contract",e]})},existingFile:C.cancellationConfirmationOptionsPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:async()=>{confirm("Dokument wirklich löschen?")&&(await ut.deleteCancellationConfirmationOptions(c),a.invalidateQueries({queryKey:["contract",e]}))},className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Bestätigung erhalten am"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"date",value:C.cancellationConfirmationOptionsDate?C.cancellationConfirmationOptionsDate.split("T")[0]:"",onChange:Z=>{const Fe=Z.target.value||null;le.mutate(Fe)},className:"block w-full max-w-[180px] px-2 py-1 text-sm border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500"}),C.cancellationConfirmationOptionsDate&&s.jsx("button",{onClick:()=>le.mutate(null),className:"p-1 text-red-500 hover:text-red-700 hover:bg-red-50 rounded",title:"Datum löschen",children:s.jsx(Ne,{className:"w-4 h-4"})})]})]})]}):s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationConfirmationOptions(c,Z),a.invalidateQueries({queryKey:["contract",e]})},accept:".pdf",label:"PDF hochladen"})]})]})]})]})]}),(C.portalUsername||C.stressfreiEmail||C.portalPasswordEncrypted)&&s.jsxs(X,{className:"mb-6",title:"Zugangsdaten",children:[s.jsxs("dl",{className:"grid grid-cols-2 gap-4",children:[(C.portalUsername||C.stressfreiEmail)&&s.jsxs("div",{children:[s.jsxs("dt",{className:"text-sm text-gray-500",children:["Benutzername",C.stressfreiEmail&&s.jsx("span",{className:"ml-2 text-xs text-blue-600",children:"(Stressfrei-Wechseln)"})]}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[((ae=C.stressfreiEmail)==null?void 0:ae.email)||C.portalUsername,s.jsx(oe,{value:((Ge=C.stressfreiEmail)==null?void 0:Ge.email)||C.portalUsername||""})]})]}),C.portalPasswordEncrypted&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Passwort"}),s.jsxs("dd",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-mono",children:d&&h?h:"••••••••"}),d&&h&&s.jsx(oe,{value:h}),s.jsx(T,{variant:"ghost",size:"sm",onClick:de,children:d?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Ae,{className:"w-4 h-4"})})]})]})]}),((xt=C.provider)==null?void 0:xt.portalUrl)&&(C.portalUsername||C.stressfreiEmail)&&C.portalPasswordEncrypted&&s.jsxs("div",{className:"mt-4 pt-4 border-t",children:[s.jsxs(T,{onClick:st,disabled:m,className:"w-full sm:w-auto",children:[s.jsx(dh,{className:"w-4 h-4 mr-2"}),m?"Wird geöffnet...":"Zum Kundenportal (Auto-Login)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"Öffnet das Portal mit vorausgefüllten Zugangsdaten"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 mb-6",children:[C.address&&s.jsx(X,{title:"Lieferadresse",children:s.jsxs(Wu,{values:[`${C.address.street} ${C.address.houseNumber}`,`${C.address.postalCode} ${C.address.city}`,C.address.country],children:[s.jsxs("p",{children:[C.address.street," ",C.address.houseNumber]}),s.jsxs("p",{children:[C.address.postalCode," ",C.address.city]}),s.jsx("p",{className:"text-gray-500",children:C.address.country})]})}),(C.billingAddress||C.address)&&s.jsx(X,{title:"Rechnungsadresse",children:(()=>{const Z=C.billingAddress||C.address;return Z?s.jsxs(Wu,{values:[`${Z.street} ${Z.houseNumber}`,`${Z.postalCode} ${Z.city}`,Z.country],children:[s.jsxs("p",{children:[Z.street," ",Z.houseNumber]}),s.jsxs("p",{children:[Z.postalCode," ",Z.city]}),s.jsx("p",{className:"text-gray-500",children:Z.country}),!C.billingAddress&&C.address&&s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"(wie Lieferadresse)"})]}):null})()}),C.bankCard&&s.jsxs(X,{title:"Bankkarte",children:[s.jsx("p",{className:"font-medium",children:C.bankCard.accountHolder}),s.jsxs("p",{className:"font-mono flex items-center gap-1",children:[C.bankCard.iban,s.jsx(oe,{value:C.bankCard.iban})]}),C.bankCard.bankName&&s.jsx("p",{className:"text-gray-500",children:C.bankCard.bankName})]}),C.identityDocument&&s.jsxs(X,{title:"Ausweis",children:[s.jsxs("p",{className:"font-mono flex items-center gap-1",children:[C.identityDocument.documentNumber,s.jsx(oe,{value:C.identityDocument.documentNumber})]}),s.jsx("p",{className:"text-gray-500",children:C.identityDocument.type})]})]}),C.energyDetails&&s.jsxs(X,{className:"mb-6",title:C.type==="ELECTRICITY"?"Strom-Details":"Gas-Details",children:[s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[C.energyDetails.meter&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Zählernummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.energyDetails.meter.meterNumber,s.jsx(oe,{value:C.energyDetails.meter.meterNumber})]})]}),C.energyDetails.maloId&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"MaLo-ID"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.energyDetails.maloId,s.jsx(oe,{value:C.energyDetails.maloId})]})]}),C.energyDetails.annualConsumption&&s.jsxs("div",{children:[s.jsxs("dt",{className:"text-sm text-gray-500",children:["Jahresverbrauch ",C.type==="ELECTRICITY"?"":"(m³)"]}),s.jsxs("dd",{children:[C.energyDetails.annualConsumption.toLocaleString("de-DE")," ",C.type==="ELECTRICITY"?"kWh":"m³"]})]}),C.type==="GAS"&&C.energyDetails.annualConsumptionKwh&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Jahresverbrauch (kWh)"}),s.jsxs("dd",{children:[C.energyDetails.annualConsumptionKwh.toLocaleString("de-DE")," kWh"]})]}),C.energyDetails.basePrice!=null&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Grundpreis"}),s.jsxs("dd",{children:[C.energyDetails.basePrice.toLocaleString("de-DE",{minimumFractionDigits:2,maximumFractionDigits:10})," €/Monat"]})]}),C.energyDetails.unitPrice!=null&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Arbeitspreis"}),s.jsxs("dd",{children:[C.energyDetails.unitPrice.toLocaleString("de-DE",{minimumFractionDigits:2,maximumFractionDigits:10})," €/kWh"]})]}),C.energyDetails.bonus&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Bonus"}),s.jsxs("dd",{children:[C.energyDetails.bonus.toLocaleString("de-DE")," €"]})]}),C.energyDetails.previousProviderName&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vorversorger"}),s.jsx("dd",{children:C.energyDetails.previousProviderName})]}),C.energyDetails.previousCustomerNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vorherige Kundennr."}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.energyDetails.previousCustomerNumber,s.jsx(oe,{value:C.energyDetails.previousCustomerNumber})]})]})]}),C.energyDetails.meter&&s.jsx(xC,{meterId:C.energyDetails.meter.id,meterType:C.energyDetails.meter.type,readings:C.energyDetails.meter.readings||[],contractId:c,canEdit:i("contracts:update")&&!l}),C.energyDetails.meter&&C.startDate&&C.endDate&&s.jsx(yC,{contractType:C.type,readings:C.energyDetails.meter.readings||[],startDate:C.startDate,endDate:C.endDate,basePrice:C.energyDetails.basePrice,unitPrice:C.energyDetails.unitPrice,bonus:C.energyDetails.bonus}),s.jsx(nC,{ecdId:C.energyDetails.id,invoices:C.energyDetails.invoices||[],contractId:c,canEdit:i("contracts:update")&&!l})]}),C.internetDetails&&s.jsxs(X,{className:"mb-6",title:C.type==="DSL"?"DSL-Details":C.type==="CABLE"?"Kabelinternet-Details":"Glasfaser-Details",children:[s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[C.internetDetails.downloadSpeed&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Download"}),s.jsxs("dd",{children:[C.internetDetails.downloadSpeed," Mbit/s"]})]}),C.internetDetails.uploadSpeed&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Upload"}),s.jsxs("dd",{children:[C.internetDetails.uploadSpeed," Mbit/s"]})]}),C.internetDetails.routerModel&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Router"}),s.jsx("dd",{children:C.internetDetails.routerModel})]}),C.internetDetails.routerSerialNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Router S/N"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.internetDetails.routerSerialNumber,s.jsx(oe,{value:C.internetDetails.routerSerialNumber})]})]}),C.internetDetails.installationDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Installation"}),s.jsx("dd",{children:new Date(C.internetDetails.installationDate).toLocaleDateString("de-DE")})]}),C.internetDetails.homeId&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Home-ID"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.internetDetails.homeId,s.jsx(oe,{value:C.internetDetails.homeId})]})]}),C.internetDetails.activationCode&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Aktivierungscode"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.internetDetails.activationCode,s.jsx(oe,{value:C.internetDetails.activationCode})]})]})]}),(C.internetDetails.internetUsername||C.internetDetails.internetPasswordEncrypted)&&s.jsxs("div",{className:"mt-4 pt-4 border-t",children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-3",children:"Internet-Zugangsdaten"}),s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[C.internetDetails.internetUsername&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Benutzername"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.internetDetails.internetUsername,s.jsx(oe,{value:C.internetDetails.internetUsername})]})]}),C.internetDetails.internetPasswordEncrypted&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Passwort"}),s.jsxs("dd",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-mono",children:p&&g?g:"••••••••"}),p&&g&&s.jsx(oe,{value:g}),s.jsx(T,{variant:"ghost",size:"sm",onClick:Ke,children:p?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Ae,{className:"w-4 h-4"})})]})]})]})]}),C.internetDetails.phoneNumbers&&C.internetDetails.phoneNumbers.length>0&&s.jsxs("div",{className:"mt-4 pt-4 border-t",children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-3",children:"Rufnummern & SIP-Zugangsdaten"}),s.jsx("div",{className:"space-y-3",children:C.internetDetails.phoneNumbers.map(Z=>s.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsxs("span",{className:"font-mono font-medium flex items-center gap-1",children:[Z.phoneNumber,s.jsx(oe,{value:Z.phoneNumber})]}),Z.isMain&&s.jsx(ve,{variant:"success",children:"Hauptnummer"})]}),(Z.sipUsername||Z.sipPasswordEncrypted||Z.sipServer)&&s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 text-sm",children:[Z.sipUsername&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"SIP-Benutzer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[Z.sipUsername,s.jsx(oe,{value:Z.sipUsername})]})]}),Z.sipPasswordEncrypted&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"SIP-Passwort"}),s.jsxs("dd",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-mono",children:v[Z.id]&&E[Z.id]?E[Z.id]:"••••••••"}),v[Z.id]&&E[Z.id]&&s.jsx(oe,{value:E[Z.id]}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>Ve(Z.id),children:v[Z.id]?s.jsx(It,{className:"w-3 h-3"}):s.jsx(Ae,{className:"w-3 h-3"})})]})]}),Z.sipServer&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"SIP-Server"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[Z.sipServer,s.jsx(oe,{value:Z.sipServer})]})]})]})]},Z.id))})]})]}),C.mobileDetails&&s.jsxs(X,{className:"mb-6",title:"Mobilfunk-Details",children:[s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[C.mobileDetails.dataVolume&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Datenvolumen"}),s.jsxs("dd",{children:[C.mobileDetails.dataVolume," GB"]})]}),C.mobileDetails.includedMinutes&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Inklusiv-Minuten"}),s.jsx("dd",{children:C.mobileDetails.includedMinutes})]}),C.mobileDetails.includedSMS&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Inklusiv-SMS"}),s.jsx("dd",{children:C.mobileDetails.includedSMS})]}),C.mobileDetails.deviceModel&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Gerät"}),s.jsx("dd",{children:C.mobileDetails.deviceModel})]}),C.mobileDetails.deviceImei&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"IMEI"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.mobileDetails.deviceImei,s.jsx(oe,{value:C.mobileDetails.deviceImei})]})]}),C.mobileDetails.requiresMultisim&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Multisim"}),s.jsx("dd",{children:s.jsx(ve,{variant:"warning",children:"Erforderlich"})})]})]}),C.mobileDetails.simCards&&C.mobileDetails.simCards.length>0&&s.jsxs("div",{className:"mt-6 pt-6 border-t",children:[s.jsx("h4",{className:"font-medium mb-4",children:"SIM-Karten"}),s.jsx("div",{className:"space-y-3",children:C.mobileDetails.simCards.map(Z=>s.jsx(pC,{simCard:Z},Z.id))})]}),(!C.mobileDetails.simCards||C.mobileDetails.simCards.length===0)&&(C.mobileDetails.phoneNumber||C.mobileDetails.simCardNumber)&&s.jsxs("div",{className:"mt-6 pt-6 border-t",children:[s.jsx("h4",{className:"font-medium mb-4",children:"SIM-Karte (Legacy)"}),s.jsxs("dl",{className:"grid grid-cols-2 gap-4",children:[C.mobileDetails.phoneNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Rufnummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.mobileDetails.phoneNumber,s.jsx(oe,{value:C.mobileDetails.phoneNumber})]})]}),C.mobileDetails.simCardNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"SIM-Kartennummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.mobileDetails.simCardNumber,s.jsx(oe,{value:C.mobileDetails.simCardNumber})]})]})]})]})]}),C.tvDetails&&s.jsx(X,{className:"mb-6",title:"TV-Details",children:s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[C.tvDetails.receiverModel&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Receiver"}),s.jsx("dd",{children:C.tvDetails.receiverModel})]}),C.tvDetails.smartcardNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Smartcard"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.tvDetails.smartcardNumber,s.jsx(oe,{value:C.tvDetails.smartcardNumber})]})]}),C.tvDetails.package&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Paket"}),s.jsx("dd",{children:C.tvDetails.package})]})]})}),C.carInsuranceDetails&&s.jsx(X,{className:"mb-6",title:"KFZ-Versicherung Details",children:s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[C.carInsuranceDetails.licensePlate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kennzeichen"}),s.jsxs("dd",{className:"font-mono font-bold flex items-center gap-1",children:[C.carInsuranceDetails.licensePlate,s.jsx(oe,{value:C.carInsuranceDetails.licensePlate})]})]}),C.carInsuranceDetails.vehicleType&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Fahrzeug"}),s.jsx("dd",{children:C.carInsuranceDetails.vehicleType})]}),C.carInsuranceDetails.hsn&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"HSN/TSN"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.carInsuranceDetails.hsn,"/",C.carInsuranceDetails.tsn,s.jsx(oe,{value:`${C.carInsuranceDetails.hsn}/${C.carInsuranceDetails.tsn}`})]})]}),C.carInsuranceDetails.vin&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"FIN"}),s.jsxs("dd",{className:"font-mono text-sm flex items-center gap-1",children:[C.carInsuranceDetails.vin,s.jsx(oe,{value:C.carInsuranceDetails.vin})]})]}),C.carInsuranceDetails.firstRegistration&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Erstzulassung"}),s.jsx("dd",{children:new Date(C.carInsuranceDetails.firstRegistration).toLocaleDateString("de-DE")})]}),C.carInsuranceDetails.noClaimsClass&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"SF-Klasse"}),s.jsx("dd",{children:C.carInsuranceDetails.noClaimsClass})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Versicherungsart"}),s.jsx("dd",{children:s.jsx(ve,{variant:C.carInsuranceDetails.insuranceType==="FULL"?"success":C.carInsuranceDetails.insuranceType==="PARTIAL"?"warning":"default",children:C.carInsuranceDetails.insuranceType==="FULL"?"Vollkasko":C.carInsuranceDetails.insuranceType==="PARTIAL"?"Teilkasko":"Haftpflicht"})})]}),C.carInsuranceDetails.deductiblePartial&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"SB Teilkasko"}),s.jsxs("dd",{children:[C.carInsuranceDetails.deductiblePartial," €"]})]}),C.carInsuranceDetails.deductibleFull&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"SB Vollkasko"}),s.jsxs("dd",{children:[C.carInsuranceDetails.deductibleFull," €"]})]}),C.carInsuranceDetails.policyNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Versicherungsschein-Nr."}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.carInsuranceDetails.policyNumber,s.jsx(oe,{value:C.carInsuranceDetails.policyNumber})]})]}),C.carInsuranceDetails.previousInsurer&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vorversicherer"}),s.jsx("dd",{children:C.carInsuranceDetails.previousInsurer})]})]})}),s.jsx(vC,{contractId:c,canEdit:i("contracts:update"),isCustomerPortal:o}),!o&&i("contracts:read")&&C.customerId&&s.jsx(dk,{contractId:c,customerId:C.customerId}),C.notes&&s.jsx(X,{title:"Notizen",children:s.jsx("p",{className:"whitespace-pre-wrap",children:C.notes})}),!o&&i("contracts:read")&&s.jsx(tC,{contractId:c,canEdit:i("contracts:update")}),I&&C.previousContract&&s.jsx(eC,{contractId:C.previousContract.id,isOpen:!0,onClose:()=>w(!1)}),s.jsx(qe,{isOpen:S,onClose:()=>A(!1),title:"Folgevertrag anlegen",size:"sm",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-700",children:"Möchten Sie wirklich einen Folgevertrag für diesen Vertrag anlegen?"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Die Daten des aktuellen Vertrags werden als Vorlage übernommen."}),s.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[s.jsx(T,{variant:"secondary",onClick:()=>A(!1),children:"Nein"}),s.jsx(T,{onClick:()=>{A(!1),B.mutate()},children:"Ja, anlegen"})]})]})}),s.jsx(hC,{isOpen:O,onClose:()=>R(!1)}),s.jsx(qe,{isOpen:q,onClose:()=>D(!1),title:"Zurückstellung aufheben?",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-700",children:"Möchten Sie die Zurückstellung für diesen Vertrag wirklich aufheben?"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Der Vertrag wird danach wieder im Cockpit angezeigt, wenn Fristen anstehen oder abgelaufen sind."}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:()=>D(!1),children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:()=>_.mutate(),disabled:_.isPending,children:_.isPending?"Wird aufgehoben...":"Ja, aufheben"})]})]})})]})}const NC=[{value:"DRAFT",label:"Entwurf"},{value:"PENDING",label:"Ausstehend"},{value:"ACTIVE",label:"Aktiv"},{value:"CANCELLED",label:"Gekündigt"},{value:"EXPIRED",label:"Abgelaufen"},{value:"DEACTIVATED",label:"Deaktiviert"}],wC=[{status:"DRAFT",label:"Entwurf",description:"Vertrag wird noch vorbereitet",color:"text-gray-600"},{status:"PENDING",label:"Ausstehend",description:"Wartet auf Aktivierung",color:"text-yellow-600"},{status:"ACTIVE",label:"Aktiv",description:"Vertrag läuft normal",color:"text-green-600"},{status:"EXPIRED",label:"Abgelaufen",description:"Laufzeit vorbei, läuft aber ohne Kündigung weiter",color:"text-orange-600"},{status:"CANCELLED",label:"Gekündigt",description:"Aktive Kündigung eingereicht, Vertrag endet",color:"text-red-600"},{status:"DEACTIVATED",label:"Deaktiviert",description:"Manuell beendet/archiviert",color:"text-gray-500"}];function SC({isOpen:e,onClose:t}){return e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[s.jsx("div",{className:"fixed inset-0 bg-black/20",onClick:t}),s.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl p-4 max-w-sm w-full mx-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Vertragsstatus-Übersicht"}),s.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600",children:s.jsx(qt,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"space-y-2",children:wC.map(({status:n,label:r,description:a,color:i})=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:`font-medium text-sm min-w-[90px] ${i}`,children:r}),s.jsx("span",{className:"text-sm text-gray-600",children:a})]},n))})]})]}):null}function Kx(){var oi,Rl,ci,Nh,wh,Sh,kh,Ch,Eh;const{id:e}=Nc(),[t]=Sc(),n=Yt(),r=ge(),a=!!e,i=t.get("customerId"),{register:l,handleSubmit:o,reset:c,watch:d,setValue:u,formState:{errors:h}}=Vv({defaultValues:{customerId:i||"",type:"ELECTRICITY",status:"DRAFT",previousContractId:""}}),x=d("type"),m=d("customerId"),f=d("previousContractId"),{data:p}=fe({queryKey:["contract",e],queryFn:()=>Oe.getById(parseInt(e)),enabled:a}),{data:b}=fe({queryKey:["customers-all"],queryFn:()=>At.getAll({limit:1e3})}),{data:g}=fe({queryKey:["customer",m],queryFn:()=>At.getById(parseInt(m)),enabled:!!m}),{data:y}=fe({queryKey:["customer-contracts-for-predecessor",m],queryFn:()=>Oe.getAll({customerId:parseInt(m),limit:1e3}),enabled:!!m}),{data:v}=fe({queryKey:["platforms"],queryFn:()=>il.getAll()}),{data:N}=fe({queryKey:["cancellation-periods"],queryFn:()=>ll.getAll()}),{data:E}=fe({queryKey:["contract-durations"],queryFn:()=>ol.getAll()}),{data:P}=fe({queryKey:["providers"],queryFn:()=>Xa.getAll()}),{data:I}=fe({queryKey:["contract-categories"],queryFn:()=>cl.getAll()}),w=d("providerId"),[S,A]=j.useState(null),[O,R]=j.useState([]),[q,D]=j.useState([]),[z,k]=j.useState(!1),[K,B]=j.useState("manual"),[_,Q]=j.useState(""),[le,de]=j.useState(!1),[Ke,Ve]=j.useState(!1),[st,C]=j.useState({}),[nt,es]=j.useState({}),[Vt,ae]=j.useState({}),[Ge,xt]=j.useState(!1);j.useEffect(()=>{a||k(!0)},[a]),j.useEffect(()=>{!a&&i&&(b!=null&&b.data)&&b.data.some(ie=>ie.id.toString()===i)&&u("customerId",i)},[a,i,b,u]),j.useEffect(()=>{z&&S&&w!==S&&u("tariffId",""),A(w)},[w,S,u,z]),j.useEffect(()=>{if(!a&&(I!=null&&I.data)&&I.data.length>0){const F=d("type"),ie=I.data.filter(pe=>pe.isActive),we=ie.some(pe=>pe.code===F);if(!F||!we){const pe=ie.sort((je,ct)=>je.sortOrder-ct.sortOrder)[0];pe&&u("type",pe.code)}}},[I,a,u,d]),j.useEffect(()=>{a&&(p!=null&&p.data)&&!m&&u("customerId",p.data.customerId.toString())},[a,p,m,u]),j.useEffect(()=>{var F,ie,we,pe,je,ct,Ce,di,Dh,Ah,Ph,Mh,Th,Fh,Ih,Rh,Lh,Oh,zh,$h,_h,Kh,Bh,Uh,qh,Vh,Qh,Hh,Wh,Gh,Zh,Jh,Xh,Yh,ef,tf,sf,nf,rf,af,lf,of,cf,df,uf,mf,hf,ff,pf,xf,gf,yf;if(p!=null&&p.data&&(v!=null&&v.data)&&(I!=null&&I.data)&&(P!=null&&P.data)&&(g!=null&&g.data)){const re=p.data;c({customerId:re.customerId.toString(),type:re.type,status:re.status,addressId:((F=re.addressId)==null?void 0:F.toString())||"",billingAddressId:((ie=re.billingAddressId)==null?void 0:ie.toString())||"",bankCardId:((we=re.bankCardId)==null?void 0:we.toString())||"",identityDocumentId:((pe=re.identityDocumentId)==null?void 0:pe.toString())||"",salesPlatformId:((je=re.salesPlatformId)==null?void 0:je.toString())||"",providerId:((ct=re.providerId)==null?void 0:ct.toString())||"",tariffId:((Ce=re.tariffId)==null?void 0:Ce.toString())||"",providerName:re.providerName||"",tariffName:re.tariffName||"",customerNumberAtProvider:re.customerNumberAtProvider||"",contractNumberAtProvider:re.contractNumberAtProvider||"",priceFirst12Months:re.priceFirst12Months||"",priceFrom13Months:re.priceFrom13Months||"",priceAfter24Months:re.priceAfter24Months||"",startDate:re.startDate?re.startDate.split("T")[0]:"",endDate:re.endDate?re.endDate.split("T")[0]:"",cancellationPeriodId:((di=re.cancellationPeriodId)==null?void 0:di.toString())||"",contractDurationId:((Dh=re.contractDurationId)==null?void 0:Dh.toString())||"",commission:re.commission||"",portalUsername:re.portalUsername||"",notes:re.notes||"",meterId:((Ph=(Ah=re.energyDetails)==null?void 0:Ah.meterId)==null?void 0:Ph.toString())||"",maloId:((Mh=re.energyDetails)==null?void 0:Mh.maloId)||"",annualConsumption:((Th=re.energyDetails)==null?void 0:Th.annualConsumption)||"",annualConsumptionKwh:((Fh=re.energyDetails)==null?void 0:Fh.annualConsumptionKwh)||"",basePrice:((Ih=re.energyDetails)==null?void 0:Ih.basePrice)||"",unitPrice:((Rh=re.energyDetails)==null?void 0:Rh.unitPrice)||"",bonus:((Lh=re.energyDetails)==null?void 0:Lh.bonus)||"",downloadSpeed:((Oh=re.internetDetails)==null?void 0:Oh.downloadSpeed)||"",uploadSpeed:((zh=re.internetDetails)==null?void 0:zh.uploadSpeed)||"",routerModel:(($h=re.internetDetails)==null?void 0:$h.routerModel)||"",routerSerialNumber:((_h=re.internetDetails)==null?void 0:_h.routerSerialNumber)||"",installationDate:(Kh=re.internetDetails)!=null&&Kh.installationDate?re.internetDetails.installationDate.split("T")[0]:"",internetUsername:((Bh=re.internetDetails)==null?void 0:Bh.internetUsername)||"",homeId:((Uh=re.internetDetails)==null?void 0:Uh.homeId)||"",activationCode:((qh=re.internetDetails)==null?void 0:qh.activationCode)||"",requiresMultisim:((Vh=re.mobileDetails)==null?void 0:Vh.requiresMultisim)||!1,dataVolume:((Qh=re.mobileDetails)==null?void 0:Qh.dataVolume)||"",includedMinutes:((Hh=re.mobileDetails)==null?void 0:Hh.includedMinutes)||"",includedSMS:((Wh=re.mobileDetails)==null?void 0:Wh.includedSMS)||"",deviceModel:((Gh=re.mobileDetails)==null?void 0:Gh.deviceModel)||"",deviceImei:((Zh=re.mobileDetails)==null?void 0:Zh.deviceImei)||"",phoneNumber:((Jh=re.mobileDetails)==null?void 0:Jh.phoneNumber)||"",simCardNumber:((Xh=re.mobileDetails)==null?void 0:Xh.simCardNumber)||"",receiverModel:((Yh=re.tvDetails)==null?void 0:Yh.receiverModel)||"",smartcardNumber:((ef=re.tvDetails)==null?void 0:ef.smartcardNumber)||"",tvPackage:((tf=re.tvDetails)==null?void 0:tf.package)||"",licensePlate:((sf=re.carInsuranceDetails)==null?void 0:sf.licensePlate)||"",hsn:((nf=re.carInsuranceDetails)==null?void 0:nf.hsn)||"",tsn:((rf=re.carInsuranceDetails)==null?void 0:rf.tsn)||"",vin:((af=re.carInsuranceDetails)==null?void 0:af.vin)||"",vehicleType:((lf=re.carInsuranceDetails)==null?void 0:lf.vehicleType)||"",firstRegistration:(of=re.carInsuranceDetails)!=null&&of.firstRegistration?re.carInsuranceDetails.firstRegistration.split("T")[0]:"",noClaimsClass:((cf=re.carInsuranceDetails)==null?void 0:cf.noClaimsClass)||"",insuranceType:((df=re.carInsuranceDetails)==null?void 0:df.insuranceType)||"LIABILITY",deductiblePartial:((uf=re.carInsuranceDetails)==null?void 0:uf.deductiblePartial)||"",deductibleFull:((mf=re.carInsuranceDetails)==null?void 0:mf.deductibleFull)||"",policyNumber:((hf=re.carInsuranceDetails)==null?void 0:hf.policyNumber)||"",previousInsurer:((ff=re.carInsuranceDetails)==null?void 0:ff.previousInsurer)||"",cancellationConfirmationDate:re.cancellationConfirmationDate?re.cancellationConfirmationDate.split("T")[0]:"",cancellationConfirmationOptionsDate:re.cancellationConfirmationOptionsDate?re.cancellationConfirmationOptionsDate.split("T")[0]:"",wasSpecialCancellation:re.wasSpecialCancellation||!1,previousContractId:((pf=re.previousContractId)==null?void 0:pf.toString())||"",previousProviderId:((xf=re.previousProviderId)==null?void 0:xf.toString())||"",previousCustomerNumber:re.previousCustomerNumber||"",previousContractNumber:re.previousContractNumber||""}),(gf=re.mobileDetails)!=null&&gf.simCards&&re.mobileDetails.simCards.length>0?R(re.mobileDetails.simCards.map(ss=>({id:ss.id,phoneNumber:ss.phoneNumber||"",simCardNumber:ss.simCardNumber||"",pin:"",puk:"",hasExistingPin:!!ss.pin,hasExistingPuk:!!ss.puk,isMultisim:ss.isMultisim,isMain:ss.isMain}))):R([]),(yf=re.internetDetails)!=null&&yf.phoneNumbers&&re.internetDetails.phoneNumbers.length>0?D(re.internetDetails.phoneNumbers.map(ss=>({id:ss.id,phoneNumber:ss.phoneNumber||"",sipUsername:ss.sipUsername||"",sipPassword:"",hasExistingSipPassword:!!ss.sipPasswordEncrypted,sipServer:ss.sipServer||"",isMain:ss.isMain}))):D([]),re.stressfreiEmailId?(B("stressfrei"),Q(re.stressfreiEmailId.toString())):(B("manual"),Q("")),k(!0)}},[p,c,v,I,P,g]);const Z=d("startDate"),Fe=d("contractDurationId");j.useEffect(()=>{if(Z&&Fe&&(E!=null&&E.data)){const F=E.data.find(ie=>ie.id===parseInt(Fe));if(F){const ie=new Date(Z),pe=F.code.match(/^(\d+)([MTJ])$/);if(pe){const je=parseInt(pe[1]),ct=pe[2];let Ce=new Date(ie);ct==="T"?Ce.setDate(Ce.getDate()+je):ct==="M"?Ce.setMonth(Ce.getMonth()+je):ct==="J"&&Ce.setFullYear(Ce.getFullYear()+je),u("endDate",Ce.toISOString().split("T")[0])}}}},[Z,Fe,E,u]);const Xe=G({mutationFn:Oe.create,onSuccess:(F,ie)=>{r.invalidateQueries({queryKey:["contracts"]}),ie.customerId&&r.invalidateQueries({queryKey:["customer",ie.customerId.toString()]}),r.invalidateQueries({queryKey:["customers"]}),n(i?`/customers/${i}?tab=contracts`:"/contracts")}}),J=G({mutationFn:F=>Oe.update(parseInt(e),F),onSuccess:(F,ie)=>{r.invalidateQueries({queryKey:["contracts"]}),r.invalidateQueries({queryKey:["contract",e]}),ie.customerId&&r.invalidateQueries({queryKey:["customer",ie.customerId.toString()]}),r.invalidateQueries({queryKey:["customers"]}),n(`/contracts/${e}`)}}),ue=F=>{const ie=Ce=>{if(Ce==null||Ce==="")return;const di=parseInt(String(Ce));return isNaN(di)?void 0:di},we=kt.find(Ce=>Ce.code===F.type),pe=ie(F.customerId);if(!pe){alert("Bitte wählen Sie einen Kunden aus");return}if(!F.type||!we){alert("Bitte wählen Sie einen Vertragstyp aus");return}const je=Ce=>Ce==null||Ce===""?null:Ce,ct={customerId:pe,type:F.type,contractCategoryId:we.id,status:F.status,addressId:ie(F.addressId)??null,billingAddressId:ie(F.billingAddressId)??null,bankCardId:ie(F.bankCardId)??null,identityDocumentId:ie(F.identityDocumentId)??null,salesPlatformId:ie(F.salesPlatformId)??null,providerId:ie(F.providerId)??null,tariffId:ie(F.tariffId)??null,providerName:je(F.providerName),tariffName:je(F.tariffName),customerNumberAtProvider:je(F.customerNumberAtProvider),contractNumberAtProvider:je(F.contractNumberAtProvider),priceFirst12Months:je(F.priceFirst12Months),priceFrom13Months:je(F.priceFrom13Months),priceAfter24Months:je(F.priceAfter24Months),startDate:F.startDate?new Date(F.startDate):null,endDate:F.endDate?new Date(F.endDate):null,cancellationPeriodId:ie(F.cancellationPeriodId)??null,contractDurationId:ie(F.contractDurationId)??null,commission:F.commission?parseFloat(F.commission):null,portalUsername:K==="manual"?je(F.portalUsername):null,stressfreiEmailId:K==="stressfrei"&&_?parseInt(_):null,portalPassword:F.portalPassword||void 0,notes:je(F.notes),cancellationConfirmationDate:F.cancellationConfirmationDate?new Date(F.cancellationConfirmationDate):null,cancellationConfirmationOptionsDate:F.cancellationConfirmationOptionsDate?new Date(F.cancellationConfirmationOptionsDate):null,wasSpecialCancellation:F.wasSpecialCancellation||!1,previousContractId:ie(F.previousContractId)??null,previousProviderId:F.previousContractId?null:ie(F.previousProviderId)??null,previousCustomerNumber:F.previousContractId?null:je(F.previousCustomerNumber),previousContractNumber:F.previousContractId?null:je(F.previousContractNumber)};["ELECTRICITY","GAS"].includes(F.type)&&(ct.energyDetails={meterId:ie(F.meterId)??null,maloId:je(F.maloId),annualConsumption:F.annualConsumption?parseFloat(F.annualConsumption):null,annualConsumptionKwh:F.annualConsumptionKwh?parseFloat(F.annualConsumptionKwh):null,basePrice:F.basePrice?parseFloat(F.basePrice):null,unitPrice:F.unitPrice?parseFloat(F.unitPrice):null,bonus:F.bonus?parseFloat(F.bonus):null}),["DSL","CABLE","FIBER"].includes(F.type)&&(ct.internetDetails={downloadSpeed:ie(F.downloadSpeed)??null,uploadSpeed:ie(F.uploadSpeed)??null,routerModel:je(F.routerModel),routerSerialNumber:je(F.routerSerialNumber),installationDate:F.installationDate?new Date(F.installationDate):null,internetUsername:je(F.internetUsername),internetPassword:F.internetPassword||void 0,homeId:je(F.homeId),activationCode:je(F.activationCode),phoneNumbers:q.length>0?q.map(Ce=>({id:Ce.id,phoneNumber:Ce.phoneNumber||"",isMain:Ce.isMain??!1,sipUsername:je(Ce.sipUsername),sipPassword:Ce.sipPassword||void 0,sipServer:je(Ce.sipServer)})):void 0}),F.type==="MOBILE"&&(ct.mobileDetails={requiresMultisim:F.requiresMultisim||!1,dataVolume:F.dataVolume?parseFloat(F.dataVolume):null,includedMinutes:ie(F.includedMinutes)??null,includedSMS:ie(F.includedSMS)??null,deviceModel:je(F.deviceModel),deviceImei:je(F.deviceImei),phoneNumber:je(F.phoneNumber),simCardNumber:je(F.simCardNumber),simCards:O.length>0?O.map(Ce=>({id:Ce.id,phoneNumber:je(Ce.phoneNumber),simCardNumber:je(Ce.simCardNumber),pin:Ce.pin||void 0,puk:Ce.puk||void 0,isMultisim:Ce.isMultisim,isMain:Ce.isMain})):void 0}),F.type==="TV"&&(ct.tvDetails={receiverModel:je(F.receiverModel),smartcardNumber:je(F.smartcardNumber),package:je(F.tvPackage)}),F.type==="CAR_INSURANCE"&&(ct.carInsuranceDetails={licensePlate:je(F.licensePlate),hsn:je(F.hsn),tsn:je(F.tsn),vin:je(F.vin),vehicleType:je(F.vehicleType),firstRegistration:F.firstRegistration?new Date(F.firstRegistration):null,noClaimsClass:je(F.noClaimsClass),insuranceType:F.insuranceType,deductiblePartial:F.deductiblePartial?parseFloat(F.deductiblePartial):null,deductibleFull:F.deductibleFull?parseFloat(F.deductibleFull):null,policyNumber:je(F.policyNumber),previousInsurer:je(F.previousInsurer)}),a?J.mutate(ct):Xe.mutate(ct)},ts=Xe.isPending||J.isPending,un=Xe.error||J.error,gt=g==null?void 0:g.data,L=(gt==null?void 0:gt.addresses)||[],U=((oi=gt==null?void 0:gt.bankCards)==null?void 0:oi.filter(F=>F.isActive))||[],W=((Rl=gt==null?void 0:gt.identityDocuments)==null?void 0:Rl.filter(F=>F.isActive))||[],ce=((ci=gt==null?void 0:gt.meters)==null?void 0:ci.filter(F=>F.isActive))||[],se=((Nh=gt==null?void 0:gt.stressfreiEmails)==null?void 0:Nh.filter(F=>F.isActive))||[],ee=(v==null?void 0:v.data)||[],ye=(N==null?void 0:N.data)||[],Le=(E==null?void 0:E.data)||[],Me=((wh=P==null?void 0:P.data)==null?void 0:wh.filter(F=>F.isActive))||[],kt=((Sh=I==null?void 0:I.data)==null?void 0:Sh.filter(F=>F.isActive).sort((F,ie)=>F.sortOrder-ie.sortOrder))||[],mn=kt.map(F=>({value:F.code,label:F.name})),Hs=((y==null?void 0:y.data)||[]).filter(F=>!a||F.id!==parseInt(e)).sort((F,ie)=>new Date(ie.startDate||0).getTime()-new Date(F.startDate||0).getTime()),Ln=Me.find(F=>F.id===parseInt(w||"0")),li=((kh=Ln==null?void 0:Ln.tariffs)==null?void 0:kh.filter(F=>F.isActive))||[],sa=F=>{const ie=F.companyName||`${F.firstName} ${F.lastName}`,we=F.birthDate?` (geb. ${new Date(F.birthDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})`:"";return`${F.customerNumber} - ${ie}${we}`},Oc=(()=>{var we;const ie=((b==null?void 0:b.data)||[]).map(pe=>({value:pe.id.toString(),label:sa(pe)}));if(a&&((we=p==null?void 0:p.data)!=null&&we.customer)){const pe=p.data.customer;ie.some(ct=>ct.value===pe.id.toString())||ie.unshift({value:pe.id.toString(),label:sa(pe)})}return ie})();return s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold mb-6",children:a?"Vertrag bearbeiten":"Neuer Vertrag"}),un&&s.jsx("div",{className:"mb-4 p-4 bg-red-50 border border-red-200 text-red-700 rounded-lg",children:un instanceof Error?un.message:"Ein Fehler ist aufgetreten"}),s.jsxs("form",{onSubmit:o(ue),children:[s.jsx(X,{className:"mb-6",title:"Vertragsdaten",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(Ie,{label:"Kunde *",...l("customerId",{required:"Kunde erforderlich"}),options:Oc,error:(Ch=h.customerId)==null?void 0:Ch.message}),s.jsx(Ie,{label:"Vertragstyp *",...l("type",{required:"Typ erforderlich"}),options:mn}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Status"}),s.jsx("button",{type:"button",onClick:()=>xt(!0),className:"text-gray-400 hover:text-blue-600 transition-colors",title:"Status-Erklärung",children:s.jsx(Ml,{className:"w-4 h-4"})})]}),s.jsx(Ie,{...l("status"),options:NC})]}),s.jsx(Ie,{label:"Vertriebsplattform",...l("salesPlatformId"),options:ee.map(F=>({value:F.id,label:F.name}))}),m&&s.jsx(Ie,{label:"Vorgänger-Vertrag",...l("previousContractId"),options:Hs.map(F=>({value:F.id,label:`${F.contractNumber} (${F.type}${F.startDate?` - ${new Date(F.startDate).toLocaleDateString("de-DE")}`:""})`})),placeholder:"Keinen Vorgänger auswählen"}),m&&!f&&s.jsxs("div",{className:"mt-4 p-4 bg-gray-50 rounded-lg border border-gray-200",children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-3",children:"Altanbieter-Daten"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[s.jsx(Ie,{label:"Altanbieter",...l("previousProviderId"),options:Me.map(F=>({value:F.id,label:F.name})),placeholder:"Bitte wählen..."}),s.jsx(H,{label:"Kundennr. beim Altanbieter",...l("previousCustomerNumber")}),s.jsx(H,{label:"Vertragsnr. beim Altanbieter",...l("previousContractNumber")})]})]})]})}),m&&s.jsxs(X,{className:"mb-6",title:"Kundendaten verknüpfen",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[s.jsx(Ie,{label:"Lieferadresse",...l("addressId"),options:L.filter(F=>F.type==="DELIVERY_RESIDENCE").map(F=>({value:F.id,label:`${F.street} ${F.houseNumber}, ${F.postalCode} ${F.city}`}))}),s.jsx(Ie,{label:"Rechnungsadresse",...l("billingAddressId"),options:L.filter(F=>F.type==="BILLING").map(F=>({value:F.id,label:`${F.street} ${F.houseNumber}, ${F.postalCode} ${F.city}`})),placeholder:"Wie Lieferadresse"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(Ie,{label:"Bankkarte",...l("bankCardId"),options:U.map(F=>({value:F.id,label:`${F.iban} (${F.accountHolder})`}))}),s.jsx(Ie,{label:"Ausweis",...l("identityDocumentId"),options:W.map(F=>({value:F.id,label:`${F.documentNumber} (${F.type})`}))})]})]}),s.jsx(X,{className:"mb-6",title:"Anbieter & Tarif",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(Ie,{label:"Anbieter",...l("providerId"),options:Me.map(F=>({value:F.id,label:F.name}))}),s.jsx(Ie,{label:"Tarif",...l("tariffId"),options:li.map(F=>({value:F.id,label:F.name})),disabled:!w}),s.jsx(H,{label:"Kundennummer beim Anbieter",...l("customerNumberAtProvider")}),s.jsx(H,{label:"Vertragsnummer beim Anbieter",...l("contractNumberAtProvider")}),s.jsx(H,{label:"Provision (€)",type:"number",step:"0.01",...l("commission")}),s.jsx(H,{label:"Preis erste 12 Monate",...l("priceFirst12Months"),placeholder:"z.B. 29,99 €/Monat"}),s.jsx(H,{label:"Preis ab 13. Monat",...l("priceFrom13Months"),placeholder:"z.B. 39,99 €/Monat"}),s.jsx(H,{label:"Preis nach 24 Monaten",...l("priceAfter24Months"),placeholder:"z.B. 49,99 €/Monat"})]})}),s.jsxs(X,{className:"mb-6",title:"Laufzeit und Kündigung",children:[s.jsxs("p",{className:"text-sm text-gray-500 mb-4 bg-blue-50 border border-blue-200 rounded-lg p-3",children:[s.jsx("strong",{children:"Hinweis:"})," Ist die Laufzeit ≤ 4 Wochen, 1 Monat oder 30 Tage, gilt der Vertrag als unbefristet mit der jeweiligen Kündigungsfrist."]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"Vertragsbeginn",type:"date",...l("startDate"),value:d("startDate")||"",onClear:()=>u("startDate","")}),s.jsx(H,{label:"Vertragsende (berechnet)",type:"date",...l("endDate"),disabled:!0,className:"bg-gray-50"}),s.jsx(Ie,{label:"Vertragslaufzeit",...l("contractDurationId"),options:Le.map(F=>({value:F.id,label:F.description}))}),s.jsx(Ie,{label:"Kündigungsfrist",...l("cancellationPeriodId"),options:ye.map(F=>({value:F.id,label:F.description}))}),s.jsx(H,{label:"Kündigungsbestätigungsdatum",type:"date",...l("cancellationConfirmationDate"),value:d("cancellationConfirmationDate")||"",onClear:()=>u("cancellationConfirmationDate","")}),s.jsx(H,{label:"Kündigungsbestätigungsoptionendatum",type:"date",...l("cancellationConfirmationOptionsDate"),value:d("cancellationConfirmationOptionsDate")||"",onClear:()=>u("cancellationConfirmationOptionsDate","")}),s.jsx("div",{className:"col-span-2",children:s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",...l("wasSpecialCancellation"),className:"rounded border-gray-300"}),s.jsx("span",{children:"Wurde sondergekündigt?"})]})})]})]}),s.jsx(X,{className:"mb-6",title:"Zugangsdaten (verschlüsselt gespeichert)",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Portal Benutzername"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"radio",name:"usernameType",checked:K==="manual",onChange:()=>{B("manual"),Q("")},className:"text-blue-600"}),s.jsx("span",{className:"text-sm",children:"Manuell eingeben"})]}),K==="manual"&&s.jsx(H,{...l("portalUsername"),placeholder:"Benutzername eingeben..."}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"radio",name:"usernameType",checked:K==="stressfrei",onChange:()=>{B("stressfrei"),u("portalUsername","")},className:"text-blue-600"}),s.jsx("span",{className:"text-sm",children:"Stressfrei-Wechseln Adresse"})]}),K==="stressfrei"&&s.jsx(Ie,{value:_,onChange:F=>Q(F.target.value),options:se.map(F=>({value:F.id,label:F.email+(F.notes?` (${F.notes})`:"")})),placeholder:se.length===0?"Keine Stressfrei-Adressen vorhanden":"Adresse auswählen..."}),K==="stressfrei"&&se.length===0&&s.jsx("p",{className:"text-xs text-amber-600",children:"Keine Stressfrei-Wechseln Adressen für diesen Kunden vorhanden. Bitte zuerst beim Kunden anlegen."})]})]}),s.jsxs("div",{className:"mt-8",children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:a?"Neues Passwort (leer lassen = unverändert)":"Portal Passwort"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:le?"text":"password",...l("portalPassword"),className:"block w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("button",{type:"button",onClick:()=>de(!le),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600",children:le?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Ae,{className:"w-4 h-4"})})]})]})]})}),["ELECTRICITY","GAS"].includes(x)&&s.jsxs(X,{className:"mb-6",title:x==="ELECTRICITY"?"Strom-Details":"Gas-Details",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(Ie,{label:"Zähler",...l("meterId"),options:ce.filter(F=>F.type===x).map(F=>({value:F.id,label:`${F.meterNumber}${F.location?` (${F.location})`:""}`}))}),s.jsx(H,{label:"MaLo-ID (Marktlokations-ID)",...l("maloId")}),s.jsx(H,{label:`Jahresverbrauch (${x==="ELECTRICITY"?"kWh":"m³"})`,type:"number",...l("annualConsumption")}),x==="GAS"&&s.jsx(H,{label:"Jahresverbrauch (kWh)",type:"number",...l("annualConsumptionKwh")}),s.jsx(H,{label:"Grundpreis (€/Monat)",type:"number",step:"any",...l("basePrice")}),s.jsx(H,{label:"Arbeitspreis (€/kWh)",type:"number",step:"any",...l("unitPrice")}),s.jsx(H,{label:"Bonus (€)",type:"number",step:"0.01",...l("bonus")})]}),a&&s.jsxs("div",{className:"mt-4 p-3 bg-blue-50 border border-blue-200 rounded-lg text-sm text-blue-700",children:[s.jsx("strong",{children:"Hinweis:"})," Zählerstände und Rechnungen werden in der"," ",s.jsx("span",{className:"font-medium",children:"Vertragsdetailansicht"})," verwaltet, nicht hier im Bearbeitungsformular."]})]}),["DSL","CABLE","FIBER"].includes(x)&&s.jsxs(s.Fragment,{children:[s.jsx(X,{className:"mb-6",title:x==="DSL"?"DSL-Details":x==="CABLE"?"Kabelinternet-Details":"Glasfaser-Details",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"Download (Mbit/s)",type:"number",...l("downloadSpeed")}),s.jsx(H,{label:"Upload (Mbit/s)",type:"number",...l("uploadSpeed")}),s.jsx(H,{label:"Router Modell",...l("routerModel")}),s.jsx(H,{label:"Router Seriennummer",...l("routerSerialNumber")}),s.jsx(H,{label:"Installationsdatum",type:"date",...l("installationDate"),value:d("installationDate")||"",onClear:()=>u("installationDate","")}),x==="FIBER"&&s.jsx(H,{label:"Home-ID",...l("homeId")}),((Eh=Ln==null?void 0:Ln.name)==null?void 0:Eh.toLowerCase().includes("vodafone"))&&["DSL","CABLE"].includes(x)&&s.jsx(H,{label:"Aktivierungscode",...l("activationCode")})]})}),s.jsx(X,{className:"mb-6",title:"Internet-Zugangsdaten (verschlüsselt)",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"Benutzername",...l("internetUsername")}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:a?"Neues Passwort (leer = beibehalten)":"Passwort"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:Ke?"text":"password",...l("internetPassword"),className:"block w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("button",{type:"button",onClick:()=>Ve(!Ke),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600",children:Ke?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Ae,{className:"w-4 h-4"})})]})]})]})}),s.jsxs(X,{className:"mb-6",title:"Rufnummern & SIP-Zugangsdaten",children:[s.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Hier können Sie Festnetz-Rufnummern mit SIP-Zugangsdaten erfassen."}),q.length>0&&s.jsx("div",{className:"space-y-4 mb-4",children:q.map((F,ie)=>s.jsxs("div",{className:"p-4 border rounded-lg bg-gray-50",children:[s.jsxs("div",{className:"flex justify-between items-center mb-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("span",{className:"font-medium",children:["Rufnummer ",ie+1]}),s.jsxs("label",{className:"flex items-center gap-1 text-sm",children:[s.jsx("input",{type:"checkbox",checked:F.isMain,onChange:we=>{const pe=[...q];we.target.checked?pe.forEach((je,ct)=>je.isMain=ct===ie):pe[ie].isMain=!1,D(pe)},className:"rounded border-gray-300"}),"Hauptnummer"]})]}),s.jsx(T,{type:"button",variant:"ghost",size:"sm",onClick:()=>{D(q.filter((we,pe)=>pe!==ie))},children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[s.jsx(H,{label:"Rufnummer",value:F.phoneNumber,onChange:we=>{const pe=[...q];pe[ie].phoneNumber=we.target.value,D(pe)},placeholder:"z.B. 030 123456"}),s.jsx(H,{label:"SIP-Benutzername",value:F.sipUsername,onChange:we=>{const pe=[...q];pe[ie].sipUsername=we.target.value,D(pe)}}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:F.hasExistingSipPassword?"SIP-Passwort (bereits hinterlegt)":"SIP-Passwort"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:st[ie]?"text":"password",value:F.sipPassword,onChange:we=>{const pe=[...q];pe[ie].sipPassword=we.target.value,D(pe)},placeholder:F.hasExistingSipPassword?"Leer = beibehalten":"",className:"block w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("button",{type:"button",onClick:()=>C(we=>({...we,[ie]:!we[ie]})),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600",children:st[ie]?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Ae,{className:"w-4 h-4"})})]})]}),s.jsx(H,{label:"SIP-Server",value:F.sipServer,onChange:we=>{const pe=[...q];pe[ie].sipServer=we.target.value,D(pe)},placeholder:"z.B. sip.provider.de"})]})]},ie))}),s.jsxs(T,{type:"button",variant:"secondary",onClick:()=>{D([...q,{phoneNumber:"",sipUsername:"",sipPassword:"",sipServer:"",isMain:q.length===0}])},children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Rufnummer hinzufügen"]})]})]}),x==="MOBILE"&&s.jsxs(s.Fragment,{children:[s.jsxs(X,{className:"mb-6",title:"Mobilfunk-Details",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"Datenvolumen (GB)",type:"number",...l("dataVolume")}),s.jsx(H,{label:"Inklusiv-Minuten",type:"number",...l("includedMinutes")}),s.jsx(H,{label:"Inklusiv-SMS",type:"number",...l("includedSMS")}),s.jsx(H,{label:"Gerät (Modell)",...l("deviceModel")}),s.jsx(H,{label:"Gerät (IMEI)",...l("deviceImei")})]}),s.jsx("div",{className:"mt-4 pt-4 border-t",children:s.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[s.jsx("input",{type:"checkbox",...l("requiresMultisim"),className:"mt-1 rounded border-gray-300"}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium",children:"Multisim erforderlich"}),s.jsx("p",{className:"text-sm text-amber-600 mt-1",children:"Hinweis: Multisim ist bei Klarmobil, Congstar und Otelo nicht buchbar. Muss Freenet oder vergleichbar sein."})]})]})})]}),s.jsxs(X,{className:"mb-6",title:"SIM-Karten",children:[s.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Hier können Sie alle SIM-Karten zum Vertrag erfassen (Hauptkarte und Multisim-Karten)."}),O.length>0&&s.jsx("div",{className:"space-y-4 mb-4",children:O.map((F,ie)=>s.jsxs("div",{className:"p-4 border rounded-lg bg-gray-50",children:[s.jsxs("div",{className:"flex justify-between items-center mb-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("span",{className:"font-medium",children:["SIM-Karte ",ie+1]}),s.jsxs("label",{className:"flex items-center gap-1 text-sm",children:[s.jsx("input",{type:"checkbox",checked:F.isMain,onChange:we=>{const pe=[...O];we.target.checked?pe.forEach((je,ct)=>je.isMain=ct===ie):pe[ie].isMain=!1,R(pe)},className:"rounded border-gray-300"}),"Hauptkarte"]}),s.jsxs("label",{className:"flex items-center gap-1 text-sm",children:[s.jsx("input",{type:"checkbox",checked:F.isMultisim,onChange:we=>{const pe=[...O];pe[ie].isMultisim=we.target.checked,R(pe)},className:"rounded border-gray-300"}),"Multisim"]})]}),s.jsx(T,{type:"button",variant:"ghost",size:"sm",onClick:()=>{R(O.filter((we,pe)=>pe!==ie))},children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[s.jsx(H,{label:"Rufnummer",value:F.phoneNumber,onChange:we=>{const pe=[...O];pe[ie].phoneNumber=we.target.value,R(pe)},placeholder:"z.B. 0171 1234567"}),s.jsx(H,{label:"SIM-Kartennummer",value:F.simCardNumber,onChange:we=>{const pe=[...O];pe[ie].simCardNumber=we.target.value,R(pe)},placeholder:"ICCID"}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:F.hasExistingPin?"PIN (bereits hinterlegt)":"PIN"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:nt[ie]?"text":"password",value:F.pin,onChange:we=>{const pe=[...O];pe[ie].pin=we.target.value,R(pe)},placeholder:F.hasExistingPin?"Leer = beibehalten":"4-stellig",className:"block w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("button",{type:"button",onClick:()=>es(we=>({...we,[ie]:!we[ie]})),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600",children:nt[ie]?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Ae,{className:"w-4 h-4"})})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:F.hasExistingPuk?"PUK (bereits hinterlegt)":"PUK"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:Vt[ie]?"text":"password",value:F.puk,onChange:we=>{const pe=[...O];pe[ie].puk=we.target.value,R(pe)},placeholder:F.hasExistingPuk?"Leer = beibehalten":"8-stellig",className:"block w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("button",{type:"button",onClick:()=>ae(we=>({...we,[ie]:!we[ie]})),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600",children:Vt[ie]?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Ae,{className:"w-4 h-4"})})]})]})]})]},ie))}),s.jsxs(T,{type:"button",variant:"secondary",onClick:()=>{R([...O,{phoneNumber:"",simCardNumber:"",pin:"",puk:"",isMultisim:!1,isMain:O.length===0}])},children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"SIM-Karte hinzufügen"]})]})]}),x==="TV"&&s.jsx(X,{className:"mb-6",title:"TV-Details",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"Receiver Modell",...l("receiverModel")}),s.jsx(H,{label:"Smartcard-Nummer",...l("smartcardNumber")}),s.jsx(H,{label:"Paket",...l("tvPackage"),placeholder:"z.B. Basis, Premium, Sport"})]})}),x==="CAR_INSURANCE"&&s.jsx(X,{className:"mb-6",title:"KFZ-Versicherung Details",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[s.jsx(H,{label:"Kennzeichen",...l("licensePlate")}),s.jsx(H,{label:"HSN",...l("hsn")}),s.jsx(H,{label:"TSN",...l("tsn")}),s.jsx(H,{label:"FIN (VIN)",...l("vin")}),s.jsx(H,{label:"Fahrzeugtyp",...l("vehicleType")}),s.jsx(H,{label:"Erstzulassung",type:"date",...l("firstRegistration"),value:d("firstRegistration")||"",onClear:()=>u("firstRegistration","")}),s.jsx(H,{label:"SF-Klasse",...l("noClaimsClass")}),s.jsx(Ie,{label:"Versicherungsart",...l("insuranceType"),options:[{value:"LIABILITY",label:"Haftpflicht"},{value:"PARTIAL",label:"Teilkasko"},{value:"FULL",label:"Vollkasko"}]}),s.jsx(H,{label:"SB Teilkasko (€)",type:"number",...l("deductiblePartial")}),s.jsx(H,{label:"SB Vollkasko (€)",type:"number",...l("deductibleFull")}),s.jsx(H,{label:"Versicherungsscheinnummer",...l("policyNumber")}),s.jsx(H,{label:"Vorversicherer",...l("previousInsurer")})]})}),s.jsx(X,{className:"mb-6",title:"Notizen",children:s.jsx("textarea",{...l("notes"),rows:4,className:"block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Interne Notizen..."})}),s.jsxs("div",{className:"flex justify-end gap-4",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:()=>n(-1),children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:ts,children:ts?"Speichern...":"Speichern"})]})]}),s.jsx(SC,{isOpen:Ge,onClose:()=>xt(!1)})]})}const kC={ELECTRICITY:xh,GAS:Ev,DSL:Ea,CABLE:Ea,FIBER:Ea,MOBILE:fh,TV:Fv,CAR_INSURANCE:Cv},CC={ELECTRICITY:"Strom",GAS:"Gas",DSL:"DSL",CABLE:"Kabel",FIBER:"Glasfaser",MOBILE:"Mobilfunk",TV:"TV",CAR_INSURANCE:"KFZ"},EC={critical:"bg-red-100 border-red-300 text-red-800",warning:"bg-yellow-100 border-yellow-300 text-yellow-800",ok:"bg-green-100 border-green-300 text-green-800",none:"bg-gray-100 border-gray-300 text-gray-800"},DC={critical:"danger",warning:"warning",ok:"success",none:"default"},AC={cancellation_deadline:kv,contract_ending:on,missing_cancellation_letter:Be,missing_cancellation_confirmation:Be,missing_portal_credentials:z2,missing_customer_number:Be,missing_provider:Be,missing_address:Be,missing_bank:Be,missing_meter:xh,missing_sim:fh,open_tasks:dl,pending_status:on,draft_status:Be,review_due:hh,missing_invoice:mh},PC={cancellationDeadlines:"Kündigungsfristen",contractEnding:"Vertragsenden",missingCredentials:"Fehlende Zugangsdaten",missingData:"Fehlende Daten",openTasks:"Offene Aufgaben",pendingContracts:"Wartende Verträge",missingInvoices:"Fehlende Rechnungen",reviewDue:"Erneute Prüfung fällig"};function MC(){var w;const[e,t]=Sc(),[n,r]=j.useState(new Set),a=e.get("filter"),[i,l]=j.useState(a||"all");j.useEffect(()=>{i==="all"?e.delete("filter"):e.set("filter",i),t(e,{replace:!0})},[i,e,t]);const{data:o,isLoading:c,error:d}=fe({queryKey:["contract-cockpit"],queryFn:()=>Oe.getCockpit(),staleTime:0}),u=ge(),[h,x]=j.useState(null),[m,f]=j.useState(""),p=j.useRef(null);j.useEffect(()=>{const S=A=>{p.current&&!p.current.contains(A.target)&&(x(null),f(""))};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);const b=G({mutationFn:({contractId:S,data:A})=>Oe.snooze(S,A),onSuccess:()=>{u.invalidateQueries({queryKey:["contract-cockpit"]}),x(null),f("")}}),g=(S,A)=>{A?b.mutate({contractId:S,data:{months:A}}):m&&b.mutate({contractId:S,data:{nextReviewDate:m}})},y=S=>{b.mutate({contractId:S,data:{}})},v=S=>{r(A=>{const O=new Set(A);return O.has(S)?O.delete(S):O.add(S),O})},N=j.useMemo(()=>{var A;if(!((A=o==null?void 0:o.data)!=null&&A.contracts))return[];const S=o.data.contracts;switch(i){case"critical":return S.filter(O=>O.highestUrgency==="critical");case"warning":return S.filter(O=>O.highestUrgency==="warning");case"ok":return S.filter(O=>O.highestUrgency==="ok");case"deadlines":return S.filter(O=>O.issues.some(R=>["cancellation_deadline","contract_ending"].includes(R.type)));case"credentials":return S.filter(O=>O.issues.some(R=>R.type.includes("credentials")));case"data":return S.filter(O=>O.issues.some(R=>R.type.startsWith("missing_")&&!R.type.includes("credentials")));case"tasks":return S.filter(O=>O.issues.some(R=>["open_tasks","pending_status","draft_status"].includes(R.type)));case"review":return S.filter(O=>O.issues.some(R=>R.type==="review_due"));case"invoices":return S.filter(O=>O.issues.some(R=>R.type.includes("invoice")));default:return S}},[(w=o==null?void 0:o.data)==null?void 0:w.contracts,i]);if(c)return s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx("div",{className:"text-gray-500",children:"Laden..."})});if(d||!(o!=null&&o.data))return s.jsx("div",{className:"text-center py-12",children:s.jsx("p",{className:"text-red-500",children:"Fehler beim Laden des Cockpits"})});const{summary:E,thresholds:P}=o.data,I=S=>{var R,q,D,z;const A=n.has(S.id),O=kC[S.type]||Be;return s.jsxs("div",{className:`border rounded-lg mb-2 ${EC[S.highestUrgency]}`,children:[s.jsxs("div",{className:"flex items-center p-4 cursor-pointer hover:bg-opacity-50",onClick:()=>v(S.id),children:[s.jsx("div",{className:"w-6 mr-2",children:A?s.jsx(dn,{className:"w-5 h-5"}):s.jsx(Ft,{className:"w-5 h-5"})}),s.jsx(O,{className:"w-5 h-5 mr-3"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(ke,{to:`/contracts/${S.id}`,state:{from:"cockpit",filter:i!=="all"?i:void 0},className:"font-medium hover:underline",onClick:k=>k.stopPropagation(),children:S.contractNumber}),s.jsxs(ve,{variant:DC[S.highestUrgency],children:[S.issues.length," ",S.highestUrgency==="ok"?S.issues.length===1?"Hinweis":"Hinweise":S.issues.length===1?"Problem":"Probleme"]}),s.jsx("span",{className:"text-sm",children:CC[S.type]})]}),s.jsxs("div",{className:"text-sm mt-1",children:[s.jsxs(ke,{to:`/customers/${S.customer.id}`,className:"hover:underline",onClick:k=>k.stopPropagation(),children:[S.customer.customerNumber," - ",S.customer.name]}),(((R=S.provider)==null?void 0:R.name)||S.providerName)&&s.jsxs("span",{className:"ml-2",children:["| ",((q=S.provider)==null?void 0:q.name)||S.providerName,(((D=S.tariff)==null?void 0:D.name)||S.tariffName)&&` - ${((z=S.tariff)==null?void 0:z.name)||S.tariffName}`]})]})]}),s.jsxs("div",{className:"flex items-center gap-1 ml-4",children:[s.jsxs("div",{className:"relative",ref:h===S.id?p:void 0,children:[s.jsx("button",{onClick:k=>{k.stopPropagation(),x(h===S.id?null:S.id),f("")},className:"p-2 hover:bg-white hover:bg-opacity-50 rounded",title:"Zurückstellen",children:s.jsx(Sv,{className:"w-4 h-4"})}),h===S.id&&s.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 bg-white border rounded-lg shadow-lg z-50 p-3",onClick:k=>k.stopPropagation(),children:[s.jsx("div",{className:"text-sm font-medium mb-2",children:"Zurückstellen"}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("button",{onClick:()=>g(S.id,3),className:"w-full text-left px-3 py-2 text-sm hover:bg-gray-100 rounded",disabled:b.isPending,children:"+3 Monate"}),s.jsxs("button",{onClick:()=>g(S.id,6),className:"w-full text-left px-3 py-2 text-sm hover:bg-gray-100 rounded bg-blue-50 border-blue-200",disabled:b.isPending,children:["+6 Monate ",s.jsx("span",{className:"text-xs text-gray-500",children:"(Empfohlen)"})]}),s.jsx("button",{onClick:()=>g(S.id,12),className:"w-full text-left px-3 py-2 text-sm hover:bg-gray-100 rounded",disabled:b.isPending,children:"+12 Monate"})]}),s.jsxs("div",{className:"border-t mt-2 pt-2",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Eigenes Datum:"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(H,{type:"date",value:m,onChange:k=>f(k.target.value),className:"flex-1 text-sm",min:new Date().toISOString().split("T")[0]}),s.jsx(T,{size:"sm",onClick:()=>g(S.id),disabled:!m||b.isPending,children:"OK"})]})]}),S.issues.some(k=>k.type==="review_due")&&s.jsx("div",{className:"border-t mt-2 pt-2",children:s.jsxs("button",{onClick:()=>y(S.id),className:"w-full text-left px-3 py-2 text-sm hover:bg-red-50 text-red-600 rounded flex items-center gap-2",disabled:b.isPending,children:[s.jsx(hh,{className:"w-4 h-4"}),"Snooze aufheben"]})})]})]}),s.jsx(ke,{to:`/contracts/${S.id}`,state:{from:"cockpit",filter:i!=="all"?i:void 0},className:"p-2 hover:bg-white hover:bg-opacity-50 rounded",onClick:k=>k.stopPropagation(),title:"Zum Vertrag",children:s.jsx(Ae,{className:"w-4 h-4"})})]})]}),A&&s.jsx("div",{className:"border-t px-4 py-3 bg-white bg-opacity-50",children:s.jsx("div",{className:"space-y-2",children:S.issues.map((k,K)=>{const B=AC[k.type]||kn,_=k.urgency==="critical"?kn:k.urgency==="warning"?hs:k.urgency==="ok"?As:on;return s.jsxs("div",{className:"flex items-start gap-3 text-sm",children:[s.jsx(_,{className:`w-4 h-4 mt-0.5 flex-shrink-0 ${k.urgency==="critical"?"text-red-500":k.urgency==="warning"?"text-yellow-500":k.urgency==="ok"?"text-green-500":"text-gray-500"}`}),s.jsx(B,{className:"w-4 h-4 mt-0.5 flex-shrink-0 text-gray-500"}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium",children:k.label}),k.details&&s.jsx("span",{className:"text-gray-600 ml-2",children:k.details})]})]},K)})})})]},S.id)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(kn,{className:"w-6 h-6 text-red-500"}),s.jsx("h1",{className:"text-2xl font-bold",children:"Vertrags-Cockpit"})]}),s.jsx(ke,{to:"/settings/deadlines",className:"text-sm text-blue-600 hover:underline",children:"Fristenschwellen anpassen"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[s.jsx(X,{className:"!p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-red-100 rounded-lg",children:s.jsx(kn,{className:"w-6 h-6 text-red-500"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-red-600",children:E.criticalCount}),s.jsxs("p",{className:"text-sm text-gray-500",children:["Kritisch (<",P.criticalDays," Tage)"]})]})]})}),s.jsx(X,{className:"!p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-yellow-100 rounded-lg",children:s.jsx(hs,{className:"w-6 h-6 text-yellow-500"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-yellow-600",children:E.warningCount}),s.jsxs("p",{className:"text-sm text-gray-500",children:["Warnung (<",P.warningDays," Tage)"]})]})]})}),s.jsx(X,{className:"!p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:s.jsx(As,{className:"w-6 h-6 text-green-500"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-green-600",children:E.okCount}),s.jsxs("p",{className:"text-sm text-gray-500",children:["OK (<",P.okDays," Tage)"]})]})]})}),s.jsx(X,{className:"!p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-gray-100 rounded-lg",children:s.jsx(Be,{className:"w-6 h-6 text-gray-500"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-gray-600",children:E.totalContracts}),s.jsx("p",{className:"text-sm text-gray-500",children:"Verträge mit Handlungsbedarf"})]})]})})]}),s.jsx(X,{className:"mb-6",children:s.jsx("div",{className:"flex flex-wrap gap-4",children:Object.entries(E.byCategory).map(([S,A])=>A>0&&s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsxs("span",{className:"font-medium",children:[PC[S]||S,":"]}),s.jsx(ve,{variant:"default",children:A})]},S))})}),s.jsx(X,{className:"mb-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-sm text-gray-600",children:"Filter:"}),s.jsx(Ie,{value:i,onChange:S=>l(S.target.value),options:[{value:"all",label:`Alle (${o.data.contracts.length})`},{value:"critical",label:`Kritisch (${E.criticalCount})`},{value:"warning",label:`Warnung (${E.warningCount})`},{value:"ok",label:`OK (${E.okCount})`},{value:"deadlines",label:`Fristen (${E.byCategory.cancellationDeadlines+E.byCategory.contractEnding})`},{value:"credentials",label:`Zugangsdaten (${E.byCategory.missingCredentials})`},{value:"data",label:`Fehlende Daten (${E.byCategory.missingData})`},{value:"tasks",label:`Aufgaben/Status (${E.byCategory.openTasks+E.byCategory.pendingContracts})`},{value:"review",label:`Erneute Prüfung (${E.byCategory.reviewDue||0})`},{value:"invoices",label:`Fehlende Rechnungen (${E.byCategory.missingInvoices||0})`}],className:"w-64"}),s.jsxs("span",{className:"text-sm text-gray-500",children:[N.length," Verträge angezeigt"]})]})}),N.length===0?s.jsx(X,{children:s.jsx("div",{className:"text-center py-8 text-gray-500",children:i==="all"?s.jsxs(s.Fragment,{children:[s.jsx(As,{className:"w-12 h-12 mx-auto mb-4 text-green-500"}),s.jsx("p",{className:"text-lg font-medium",children:"Alles in Ordnung!"}),s.jsx("p",{children:"Keine Verträge mit Handlungsbedarf gefunden."})]}):s.jsx("p",{children:"Keine Verträge für diesen Filter gefunden."})})}):s.jsx("div",{children:N.map(I)})]})}const Bx={OPEN:"Offen",COMPLETED:"Erledigt"},TC={OPEN:"warning",COMPLETED:"success"};function FC(){var B;const e=Yt(),t=ge(),{isCustomerPortal:n,user:r,hasPermission:a}=We(),[i,l]=j.useState("OPEN"),[o,c]=j.useState(new Set),[d,u]=j.useState(!1),[h,x]=j.useState({}),[m,f]=j.useState(null),p=n?"Support-Anfragen":"Aufgaben",b=n?"Anfrage":"Aufgabe",{data:g,isLoading:y}=fe({queryKey:["app-settings-public"],queryFn:()=>Xr.getPublic(),enabled:n,staleTime:0}),v=!y&&((B=g==null?void 0:g.data)==null?void 0:B.customerSupportTicketsEnabled)==="true",{data:N,isLoading:E}=fe({queryKey:["all-tasks",i],queryFn:()=>et.getAll({status:i||void 0}),staleTime:0}),P=G({mutationFn:_=>et.completeSubtask(_),onSuccess:()=>{t.invalidateQueries({queryKey:["all-tasks"]}),t.invalidateQueries({queryKey:["task-stats"]})}}),I=G({mutationFn:_=>et.reopenSubtask(_),onSuccess:()=>{t.invalidateQueries({queryKey:["all-tasks"]}),t.invalidateQueries({queryKey:["task-stats"]})}}),w=G({mutationFn:({taskId:_,title:Q})=>n?et.createReply(_,Q):et.createSubtask(_,Q),onSuccess:(_,{taskId:Q})=>{t.invalidateQueries({queryKey:["all-tasks"]}),x(le=>({...le,[Q]:""}))}}),S=G({mutationFn:_=>et.delete(_),onSuccess:()=>{t.invalidateQueries({queryKey:["all-tasks"]}),t.invalidateQueries({queryKey:["task-stats"]})}}),A=G({mutationFn:({taskId:_,data:Q})=>et.update(_,Q),onSuccess:()=>{t.invalidateQueries({queryKey:["all-tasks"]}),f(null)}}),O=j.useMemo(()=>{var de;if(!(N!=null&&N.data))return{ownTasks:[],representedTasks:[],allTasks:[]};const _=N.data;if(!n)return{allTasks:_,ownTasks:[],representedTasks:[]};const Q=[],le=[];for(const Ke of _)((de=Ke.contract)==null?void 0:de.customerId)===(r==null?void 0:r.customerId)?Q.push(Ke):le.push(Ke);return{ownTasks:Q,representedTasks:le,allTasks:[]}},[N==null?void 0:N.data,n,r==null?void 0:r.customerId]),R=_=>{c(Q=>{const le=new Set(Q);return le.has(_)?le.delete(_):le.add(_),le})},q=_=>{P.isPending||I.isPending||(_.status==="COMPLETED"?I.mutate(_.id):P.mutate(_.id))},D=_=>{var le;const Q=(le=h[_])==null?void 0:le.trim();Q&&w.mutate({taskId:_,title:Q})},z=!n&&a("contracts:update"),k=(_,Q=!1)=>{var Ge,xt,Z,Fe,Xe,J;const le=o.has(_.id),de=_.subtasks&&_.subtasks.length>0,Ke=((Ge=_.subtasks)==null?void 0:Ge.filter(ue=>ue.status==="COMPLETED").length)||0,Ve=((xt=_.subtasks)==null?void 0:xt.length)||0,st=_.status==="COMPLETED",C=new Date(_.createdAt).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),nt=!n&&a("contracts:update"),es=!n&&a("contracts:update"),Vt=_.contract?`${_.contract.contractNumber} - ${((Z=_.contract.provider)==null?void 0:Z.name)||_.contract.providerName||"Kein Anbieter"}`:`Vertrag #${_.contractId}`,ae=(Fe=_.contract)!=null&&Fe.customer?_.contract.customer.companyName||`${_.contract.customer.firstName} ${_.contract.customer.lastName}`:"";return s.jsxs("div",{className:"border rounded-lg mb-2",children:[s.jsxs("div",{className:"flex items-center p-4 hover:bg-gray-50 cursor-pointer",onClick:()=>R(_.id),children:[s.jsx("div",{className:"w-6 mr-2",children:le?s.jsx(dn,{className:"w-5 h-5 text-gray-400"}):s.jsx(Ft,{className:"w-5 h-5 text-gray-400"})}),s.jsx("div",{className:"mr-3",children:_.status==="COMPLETED"?s.jsx(As,{className:"w-5 h-5 text-green-500"}):s.jsx(on,{className:"w-5 h-5 text-yellow-500"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"font-medium",children:_.title}),s.jsx(ve,{variant:TC[_.status],children:Bx[_.status]}),de&&s.jsxs("span",{className:"text-xs text-gray-500",children:["(",Ke,"/",Ve," erledigt)"]})]}),s.jsxs("div",{className:"text-sm text-gray-500 mt-1 flex items-center gap-2",children:[s.jsx(Be,{className:"w-4 h-4"}),s.jsx(ke,{to:`/contracts/${_.contractId}`,className:"text-blue-600 hover:underline",onClick:ue=>ue.stopPropagation(),children:Vt}),Q&&ae&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-gray-400",children:"|"}),s.jsx("span",{children:ae})]})]}),_.description&&s.jsx("p",{className:"text-sm text-gray-600 mt-1 line-clamp-2",children:_.description}),s.jsxs("div",{className:"text-xs text-gray-400 mt-1",children:[_.createdBy," • ",C]})]}),s.jsxs("div",{className:"ml-4 flex gap-2",children:[nt&&s.jsx(T,{variant:"ghost",size:"sm",onClick:ue=>{ue.stopPropagation(),f(_)},title:"Bearbeiten",children:s.jsx(He,{className:"w-4 h-4"})}),es&&s.jsx(T,{variant:"ghost",size:"sm",onClick:ue=>{ue.stopPropagation(),confirm("Aufgabe wirklich löschen?")&&S.mutate(_.id)},title:"Löschen",className:"text-red-500 hover:text-red-700",children:s.jsx(Ne,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:ue=>{ue.stopPropagation(),e(`/contracts/${_.contractId}`)},title:"Zum Vertrag",children:s.jsx(Ae,{className:"w-4 h-4"})})]})]}),le&&s.jsxs("div",{className:"border-t bg-gray-50 px-4 py-3",children:[de&&s.jsx("div",{className:"space-y-2 mb-4",children:(Xe=_.subtasks)==null?void 0:Xe.map(ue=>{const ts=new Date(ue.createdAt).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"});return s.jsxs("div",{className:`flex items-start gap-2 text-sm ml-6 ${z?"cursor-pointer hover:bg-gray-100 rounded px-2 py-1 -mx-2":""}`,onClick:z?()=>q(ue):void 0,children:[s.jsx("span",{className:"flex-shrink-0 mt-0.5",children:ue.status==="COMPLETED"?s.jsx(As,{className:"w-4 h-4 text-green-500"}):s.jsx(No,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:ue.status==="COMPLETED"?"text-gray-500 line-through":"",children:[ue.title,s.jsxs("span",{className:"text-xs text-gray-400 ml-2",children:[ue.createdBy," • ",ts]})]})]},ue.id)})}),!st&&(z||n)&&s.jsxs("div",{className:"flex gap-2 ml-6",children:[s.jsx(H,{placeholder:n?"Antwort schreiben...":"Neue Unteraufgabe...",value:h[_.id]||"",onChange:ue=>x(ts=>({...ts,[_.id]:ue.target.value})),onKeyDown:ue=>{ue.key==="Enter"&&!ue.shiftKey&&(ue.preventDefault(),D(_.id))},className:"flex-1"}),s.jsx(T,{size:"sm",onClick:()=>D(_.id),disabled:!((J=h[_.id])!=null&&J.trim())||w.isPending,children:s.jsx(Fl,{className:"w-4 h-4"})})]}),!de&&st&&s.jsx("p",{className:"text-gray-500 text-sm text-center py-2",children:"Keine Unteraufgaben vorhanden."})]})]},_.id)},K=n?v:a("contracts:update");return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"text-2xl font-bold",children:p}),K&&s.jsxs(T,{onClick:()=>u(!0),children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Neue ",b]})]}),s.jsx(X,{className:"mb-6",children:s.jsx("div",{className:"flex gap-4 flex-wrap items-center",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-gray-600",children:"Status:"}),s.jsx(Ie,{value:i,onChange:_=>l(_.target.value),options:[{value:"",label:"Alle"},...Object.entries(Bx).map(([_,Q])=>({value:_,label:Q}))],className:"w-40"})]})})}),E?s.jsx(X,{children:s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."})}):s.jsx(s.Fragment,{children:n?s.jsxs("div",{className:"space-y-6",children:[s.jsxs(X,{children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 pb-3 border-b",children:[s.jsx(ii,{className:"w-5 h-5 text-blue-600"}),s.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:["Meine ",p]}),s.jsx(ve,{variant:"default",children:O.ownTasks.length})]}),O.ownTasks.length>0?s.jsx("div",{children:O.ownTasks.map(_=>k(_,!1))}):s.jsxs("p",{className:"text-gray-500 text-center py-4",children:["Keine eigenen ",p.toLowerCase()," vorhanden."]})]}),O.representedTasks.length>0&&s.jsxs(X,{children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 pb-3 border-b",children:[s.jsx(Ca,{className:"w-5 h-5 text-purple-600"}),s.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:[p," freigegebener Kunden"]}),s.jsx(ve,{variant:"default",children:O.representedTasks.length})]}),s.jsx("div",{children:O.representedTasks.map(_=>k(_,!0))})]})]}):s.jsx(X,{children:O.allTasks&&O.allTasks.length>0?s.jsx("div",{children:O.allTasks.map(_=>k(_,!0))}):s.jsxs("div",{className:"text-center py-8 text-gray-500",children:["Keine ",p.toLowerCase()," gefunden."]})})}),n?s.jsx(IC,{isOpen:d,onClose:()=>u(!1)}):s.jsx(RC,{isOpen:d,onClose:()=>u(!1)}),m&&s.jsx(LC,{task:m,onClose:()=>f(null),onSave:_=>A.mutate({taskId:m.id,data:_}),isPending:A.isPending})]})}function IC({isOpen:e,onClose:t}){const{user:n}=We(),r=Yt(),a=ge(),[i,l]=j.useState("own"),[o,c]=j.useState(null),[d,u]=j.useState(""),[h,x]=j.useState(""),[m,f]=j.useState(!1),[p,b]=j.useState(""),{data:g}=fe({queryKey:["contracts",n==null?void 0:n.customerId],queryFn:()=>Oe.getAll({customerId:n==null?void 0:n.customerId}),enabled:e}),y=j.useMemo(()=>{if(!(g!=null&&g.data))return{own:[],represented:{}};const w=[],S={};for(const A of g.data)if(A.customerId===(n==null?void 0:n.customerId))w.push(A);else{if(!S[A.customerId]){const O=A.customer?A.customer.companyName||`${A.customer.firstName} ${A.customer.lastName}`:`Kunde ${A.customerId}`;S[A.customerId]={name:O,contracts:[]}}S[A.customerId].contracts.push(A)}return{own:w,represented:S}},[g==null?void 0:g.data,n==null?void 0:n.customerId]),v=Object.keys(y.represented).length>0,N=j.useMemo(()=>{var w;return i==="own"?y.own:((w=y.represented[i])==null?void 0:w.contracts)||[]},[i,y]),E=j.useMemo(()=>{if(!p)return N;const w=p.toLowerCase();return N.filter(S=>S.contractNumber.toLowerCase().includes(w)||(S.providerName||"").toLowerCase().includes(w)||(S.tariffName||"").toLowerCase().includes(w))},[N,p]),P=async()=>{if(!(!o||!d.trim())){f(!0);try{await et.createSupportTicket(o,{title:d.trim(),description:h.trim()||void 0}),a.invalidateQueries({queryKey:["all-tasks"]}),a.invalidateQueries({queryKey:["task-stats"]}),t(),u(""),x(""),c(null),l("own"),r(`/contracts/${o}`)}catch(w){console.error("Fehler beim Erstellen der Support-Anfrage:",w),alert("Fehler beim Erstellen der Support-Anfrage. Bitte versuchen Sie es erneut.")}finally{f(!1)}}},I=()=>{u(""),x(""),c(null),l("own"),b(""),t()};return s.jsx(qe,{isOpen:e,onClose:I,title:"Neue Support-Anfrage",children:s.jsxs("div",{className:"space-y-4",children:[v&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Kunde"}),s.jsxs("select",{value:i,onChange:w=>{const S=w.target.value;l(S==="own"?"own":parseInt(S)),c(null),b("")},className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:[s.jsx("option",{value:"own",children:"Eigene Verträge"}),Object.entries(y.represented).map(([w,{name:S}])=>s.jsx("option",{value:w,children:S},w))]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Vertrag *"}),s.jsx(H,{placeholder:"Vertrag suchen...",value:p,onChange:w=>b(w.target.value),className:"mb-2"}),s.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-lg",children:E.length>0?E.map(w=>s.jsxs("div",{onClick:()=>c(w.id),className:`p-3 cursor-pointer border-b last:border-b-0 hover:bg-gray-50 ${o===w.id?"bg-blue-50 border-blue-200":""}`,children:[s.jsx("div",{className:"font-medium",children:w.contractNumber}),s.jsxs("div",{className:"text-sm text-gray-500",children:[w.providerName||"Kein Anbieter",w.tariffName&&` - ${w.tariffName}`]})]},w.id)):s.jsx("div",{className:"p-3 text-gray-500 text-center",children:"Keine Verträge gefunden."})})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Titel *"}),s.jsx(H,{value:d,onChange:w=>u(w.target.value),placeholder:"Kurze Beschreibung Ihres Anliegens"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Beschreibung"}),s.jsx("textarea",{value:h,onChange:w=>x(w.target.value),placeholder:"Detaillierte Beschreibung (optional)",rows:4,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:I,children:"Abbrechen"}),s.jsx(T,{onClick:P,disabled:!o||!d.trim()||m,children:m?"Wird erstellt...":"Anfrage erstellen"})]})]})})}function RC({isOpen:e,onClose:t}){const n=Yt(),r=ge(),[a,i]=j.useState(null),[l,o]=j.useState(null),[c,d]=j.useState(""),[u,h]=j.useState(""),[x,m]=j.useState(!1),[f,p]=j.useState(!1),[b,g]=j.useState(""),[y,v]=j.useState(""),{data:N}=fe({queryKey:["customers-for-task"],queryFn:()=>At.getAll({limit:100}),enabled:e}),{data:E}=fe({queryKey:["contracts-for-task",a],queryFn:()=>Oe.getAll({customerId:a}),enabled:e&&a!==null}),P=j.useMemo(()=>{if(!(N!=null&&N.data))return[];if(!b)return N.data;const O=b.toLowerCase();return N.data.filter(R=>R.customerNumber.toLowerCase().includes(O)||R.firstName.toLowerCase().includes(O)||R.lastName.toLowerCase().includes(O)||(R.companyName||"").toLowerCase().includes(O))},[N==null?void 0:N.data,b]),I=j.useMemo(()=>{if(!(E!=null&&E.data))return[];if(!y)return E.data;const O=y.toLowerCase();return E.data.filter(R=>R.contractNumber.toLowerCase().includes(O)||(R.providerName||"").toLowerCase().includes(O)||(R.tariffName||"").toLowerCase().includes(O))},[E==null?void 0:E.data,y]),w=async()=>{if(!(!l||!c.trim())){p(!0);try{await et.create(l,{title:c.trim(),description:u.trim()||void 0,visibleInPortal:x}),r.invalidateQueries({queryKey:["all-tasks"]}),r.invalidateQueries({queryKey:["task-stats"]}),t(),d(""),h(""),m(!1),o(null),i(null),n(`/contracts/${l}`)}catch(O){console.error("Fehler beim Erstellen der Aufgabe:",O),alert("Fehler beim Erstellen der Aufgabe. Bitte versuchen Sie es erneut.")}finally{p(!1)}}},S=()=>{d(""),h(""),m(!1),o(null),i(null),g(""),v(""),t()},A=O=>{const R=O.companyName||`${O.firstName} ${O.lastName}`;return`${O.customerNumber} - ${R}`};return s.jsx(qe,{isOpen:e,onClose:S,title:"Neue Aufgabe",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Kunde *"}),s.jsx(H,{placeholder:"Kunde suchen...",value:b,onChange:O=>g(O.target.value),className:"mb-2"}),s.jsx("div",{className:"max-h-40 overflow-y-auto border rounded-lg",children:P.length>0?P.map(O=>s.jsx("div",{onClick:()=>{i(O.id),o(null),v("")},className:`p-3 cursor-pointer border-b last:border-b-0 hover:bg-gray-50 ${a===O.id?"bg-blue-50 border-blue-200":""}`,children:s.jsx("div",{className:"font-medium",children:A(O)})},O.id)):s.jsx("div",{className:"p-3 text-gray-500 text-center",children:"Keine Kunden gefunden."})})]}),a&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Vertrag *"}),s.jsx(H,{placeholder:"Vertrag suchen...",value:y,onChange:O=>v(O.target.value),className:"mb-2"}),s.jsx("div",{className:"max-h-40 overflow-y-auto border rounded-lg",children:I.length>0?I.map(O=>s.jsxs("div",{onClick:()=>o(O.id),className:`p-3 cursor-pointer border-b last:border-b-0 hover:bg-gray-50 ${l===O.id?"bg-blue-50 border-blue-200":""}`,children:[s.jsx("div",{className:"font-medium",children:O.contractNumber}),s.jsxs("div",{className:"text-sm text-gray-500",children:[O.providerName||"Kein Anbieter",O.tariffName&&` - ${O.tariffName}`]})]},O.id)):s.jsx("div",{className:"p-3 text-gray-500 text-center",children:E?"Keine Verträge gefunden.":"Laden..."})})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Titel *"}),s.jsx(H,{value:c,onChange:O=>d(O.target.value),placeholder:"Aufgabentitel"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Beschreibung"}),s.jsx("textarea",{value:u,onChange:O=>h(O.target.value),placeholder:"Detaillierte Beschreibung (optional)",rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),s.jsx("div",{children:s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:x,onChange:O=>m(O.target.checked),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),s.jsx("span",{className:"text-sm text-gray-700",children:"Im Kundenportal sichtbar"})]})}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:S,children:"Abbrechen"}),s.jsx(T,{onClick:w,disabled:!l||!c.trim()||f,children:f?"Wird erstellt...":"Aufgabe erstellen"})]})]})})}function LC({task:e,onClose:t,onSave:n,isPending:r}){const[a,i]=j.useState(e.title),[l,o]=j.useState(e.description||""),[c,d]=j.useState(e.visibleInPortal||!1),u=()=>{a.trim()&&n({title:a.trim(),description:l.trim()||void 0,visibleInPortal:c})};return s.jsx(qe,{isOpen:!0,onClose:t,title:"Aufgabe bearbeiten",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Titel *"}),s.jsx(H,{value:a,onChange:h=>i(h.target.value),placeholder:"Aufgabentitel"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Beschreibung"}),s.jsx("textarea",{value:l,onChange:h=>o(h.target.value),placeholder:"Detaillierte Beschreibung (optional)",rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),s.jsx("div",{children:s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:c,onChange:h=>d(h.target.checked),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),s.jsx("span",{className:"text-sm text-gray-700",children:"Im Kundenportal sichtbar"})]})}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{onClick:u,disabled:!a.trim()||r,children:r?"Wird gespeichert...":"Speichern"})]})]})})}function OC(){const[e,t]=j.useState(!1),[n,r]=j.useState(null),[a,i]=j.useState(!1),{hasPermission:l}=We(),o=ge(),{data:c,isLoading:d}=fe({queryKey:["platforms",a],queryFn:()=>il.getAll(a)}),u=G({mutationFn:il.delete,onSuccess:()=>{o.invalidateQueries({queryKey:["platforms"]})}}),h=m=>{r(m),t(!0)},x=()=>{t(!1),r(null)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Vertriebsplattformen"}),l("platforms:create")&&s.jsxs(T,{onClick:()=>t(!0),children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Neue Plattform"]})]}),s.jsxs(X,{children:[s.jsx("div",{className:"mb-4",children:s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:a,onChange:m=>i(m.target.checked),className:"rounded"}),"Inaktive anzeigen"]})}),d?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):c!=null&&c.data&&c.data.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Name"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Kontakt"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Status"}),s.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsx("tbody",{children:c.data.map(m=>s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[s.jsx("td",{className:"py-3 px-4 font-medium",children:m.name}),s.jsx("td",{className:"py-3 px-4 text-gray-500",children:m.contactInfo||"-"}),s.jsx("td",{className:"py-3 px-4",children:s.jsx(ve,{variant:m.isActive?"success":"danger",children:m.isActive?"Aktiv":"Inaktiv"})}),s.jsx("td",{className:"py-3 px-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[l("platforms:update")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>h(m),children:s.jsx(He,{className:"w-4 h-4"})}),l("platforms:delete")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Plattform wirklich löschen?")&&u.mutate(m.id)},children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})})]},m.id))})]})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Plattformen vorhanden."})]}),s.jsx(zC,{isOpen:e,onClose:x,platform:n})]})}function zC({isOpen:e,onClose:t,platform:n}){const r=ge(),[a,i]=j.useState({name:"",contactInfo:"",isActive:!0});j.useState(()=>{i(n?{name:n.name,contactInfo:n.contactInfo||"",isActive:n.isActive}:{name:"",contactInfo:"",isActive:!0})}),n&&a.name!==n.name?i({name:n.name,contactInfo:n.contactInfo||"",isActive:n.isActive}):!n&&a.name;const l=G({mutationFn:il.create,onSuccess:()=>{r.invalidateQueries({queryKey:["platforms"]}),t(),i({name:"",contactInfo:"",isActive:!0})}}),o=G({mutationFn:u=>il.update(n.id,u),onSuccess:()=>{r.invalidateQueries({queryKey:["platforms"]}),t()}}),c=u=>{u.preventDefault(),n?o.mutate(a):l.mutate(a)},d=l.isPending||o.isPending;return s.jsx(qe,{isOpen:e,onClose:t,title:n?"Plattform bearbeiten":"Neue Plattform",children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(H,{label:"Name *",value:a.name,onChange:u=>i({...a,name:u.target.value}),required:!0}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Kontaktinformationen"}),s.jsx("textarea",{value:a.contactInfo,onChange:u=>i({...a,contactInfo:u.target.value}),rows:3,className:"block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"E-Mail, Telefon, Ansprechpartner..."})]}),n&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:a.isActive,onChange:u=>i({...a,isActive:u.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:d,children:d?"Speichern...":"Speichern"})]})]})})}function $C(){const[e,t]=j.useState(!1),[n,r]=j.useState(null),[a,i]=j.useState(!1),{hasPermission:l}=We(),o=ge(),{data:c,isLoading:d}=fe({queryKey:["cancellation-periods",a],queryFn:()=>ll.getAll(a)}),u=G({mutationFn:ll.delete,onSuccess:()=>{o.invalidateQueries({queryKey:["cancellation-periods"]})}}),h=m=>{r(m),t(!0)},x=()=>{t(!1),r(null)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Vs,{className:"w-4 h-4"})})}),s.jsx("h1",{className:"text-2xl font-bold flex-1",children:"Kündigungsfristen"}),l("platforms:create")&&s.jsxs(T,{onClick:()=>t(!0),children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Neue Frist"]})]}),s.jsxs(X,{children:[s.jsx("div",{className:"mb-4",children:s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:a,onChange:m=>i(m.target.checked),className:"rounded"}),"Inaktive anzeigen"]})}),s.jsxs("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-lg text-sm",children:[s.jsx("strong",{children:"Code-Format:"})," Zahl + Buchstabe (T=Tage, M=Monate, J=Jahre)",s.jsx("br",{}),s.jsx("strong",{children:"Beispiele:"})," 14T = 14 Tage, 3M = 3 Monate, 1J = 1 Jahr"]}),d?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):c!=null&&c.data&&c.data.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Code"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Beschreibung"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Status"}),s.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsx("tbody",{children:c.data.map(m=>s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[s.jsx("td",{className:"py-3 px-4 font-mono font-medium",children:m.code}),s.jsx("td",{className:"py-3 px-4",children:m.description}),s.jsx("td",{className:"py-3 px-4",children:s.jsx(ve,{variant:m.isActive?"success":"danger",children:m.isActive?"Aktiv":"Inaktiv"})}),s.jsx("td",{className:"py-3 px-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[l("platforms:update")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>h(m),children:s.jsx(He,{className:"w-4 h-4"})}),l("platforms:delete")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Kündigungsfrist wirklich löschen?")&&u.mutate(m.id)},children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})})]},m.id))})]})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Kündigungsfristen vorhanden."})]}),s.jsx(_C,{isOpen:e,onClose:x,period:n})]})}function _C({isOpen:e,onClose:t,period:n}){const r=ge(),[a,i]=j.useState({code:"",description:"",isActive:!0});j.useEffect(()=>{e&&i(n?{code:n.code,description:n.description,isActive:n.isActive}:{code:"",description:"",isActive:!0})},[e,n]);const l=G({mutationFn:ll.create,onSuccess:()=>{r.invalidateQueries({queryKey:["cancellation-periods"]}),t(),i({code:"",description:"",isActive:!0})}}),o=G({mutationFn:u=>ll.update(n.id,u),onSuccess:()=>{r.invalidateQueries({queryKey:["cancellation-periods"]}),t()}}),c=u=>{u.preventDefault(),n?o.mutate(a):l.mutate(a)},d=l.isPending||o.isPending;return s.jsx(qe,{isOpen:e,onClose:t,title:n?"Kündigungsfrist bearbeiten":"Neue Kündigungsfrist",children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(H,{label:"Code *",value:a.code,onChange:u=>i({...a,code:u.target.value.toUpperCase()}),required:!0,placeholder:"z.B. 14T, 3M, 1J"}),s.jsx(H,{label:"Beschreibung *",value:a.description,onChange:u=>i({...a,description:u.target.value}),required:!0,placeholder:"z.B. 14 Tage, 3 Monate, 1 Jahr"}),n&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:a.isActive,onChange:u=>i({...a,isActive:u.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:d,children:d?"Speichern...":"Speichern"})]})]})})}function KC(){const[e,t]=j.useState(!1),[n,r]=j.useState(null),[a,i]=j.useState(!1),{hasPermission:l}=We(),o=ge(),{data:c,isLoading:d}=fe({queryKey:["contract-durations",a],queryFn:()=>ol.getAll(a)}),u=G({mutationFn:ol.delete,onSuccess:()=>{o.invalidateQueries({queryKey:["contract-durations"]})}}),h=m=>{r(m),t(!0)},x=()=>{t(!1),r(null)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Vs,{className:"w-4 h-4"})})}),s.jsx("h1",{className:"text-2xl font-bold flex-1",children:"Vertragslaufzeiten"}),l("platforms:create")&&s.jsxs(T,{onClick:()=>t(!0),children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Neue Laufzeit"]})]}),s.jsxs(X,{children:[s.jsx("div",{className:"mb-4",children:s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:a,onChange:m=>i(m.target.checked),className:"rounded"}),"Inaktive anzeigen"]})}),s.jsxs("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-lg text-sm",children:[s.jsx("strong",{children:"Code-Format:"})," Zahl + Buchstabe (T=Tage, M=Monate, J=Jahre)",s.jsx("br",{}),s.jsx("strong",{children:"Beispiele:"})," 12M = 12 Monate, 24M = 24 Monate, 2J = 2 Jahre"]}),d?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):c!=null&&c.data&&c.data.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Code"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Beschreibung"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Status"}),s.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsx("tbody",{children:c.data.map(m=>s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[s.jsx("td",{className:"py-3 px-4 font-mono font-medium",children:m.code}),s.jsx("td",{className:"py-3 px-4",children:m.description}),s.jsx("td",{className:"py-3 px-4",children:s.jsx(ve,{variant:m.isActive?"success":"danger",children:m.isActive?"Aktiv":"Inaktiv"})}),s.jsx("td",{className:"py-3 px-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[l("platforms:update")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>h(m),children:s.jsx(He,{className:"w-4 h-4"})}),l("platforms:delete")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Laufzeit wirklich löschen?")&&u.mutate(m.id)},children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})})]},m.id))})]})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Laufzeiten vorhanden."})]}),s.jsx(BC,{isOpen:e,onClose:x,duration:n})]})}function BC({isOpen:e,onClose:t,duration:n}){const r=ge(),[a,i]=j.useState({code:"",description:"",isActive:!0});j.useEffect(()=>{e&&i(n?{code:n.code,description:n.description,isActive:n.isActive}:{code:"",description:"",isActive:!0})},[e,n]);const l=G({mutationFn:ol.create,onSuccess:()=>{r.invalidateQueries({queryKey:["contract-durations"]}),t(),i({code:"",description:"",isActive:!0})}}),o=G({mutationFn:u=>ol.update(n.id,u),onSuccess:()=>{r.invalidateQueries({queryKey:["contract-durations"]}),t()}}),c=u=>{u.preventDefault(),n?o.mutate(a):l.mutate(a)},d=l.isPending||o.isPending;return s.jsx(qe,{isOpen:e,onClose:t,title:n?"Laufzeit bearbeiten":"Neue Laufzeit",children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(H,{label:"Code *",value:a.code,onChange:u=>i({...a,code:u.target.value.toUpperCase()}),required:!0,placeholder:"z.B. 12M, 24M, 2J"}),s.jsx(H,{label:"Beschreibung *",value:a.description,onChange:u=>i({...a,description:u.target.value}),required:!0,placeholder:"z.B. 12 Monate, 24 Monate, 2 Jahre"}),n&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:a.isActive,onChange:u=>i({...a,isActive:u.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:d,children:d?"Speichern...":"Speichern"})]})]})})}function UC(){const[e,t]=j.useState(!1),[n,r]=j.useState(null),[a,i]=j.useState(!1),[l,o]=j.useState(new Set),{hasPermission:c}=We(),d=ge(),{data:u,isLoading:h}=fe({queryKey:["providers",a],queryFn:()=>Xa.getAll(a)}),x=G({mutationFn:Xa.delete,onSuccess:()=>{d.invalidateQueries({queryKey:["providers"]})},onError:b=>{alert(b.message)}}),m=b=>{o(g=>{const y=new Set(g);return y.has(b)?y.delete(b):y.add(b),y})},f=b=>{r(b),t(!0)},p=()=>{t(!1),r(null)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Vs,{className:"w-4 h-4"})})}),s.jsx("h1",{className:"text-2xl font-bold flex-1",children:"Anbieter & Tarife"}),c("providers:create")&&s.jsxs(T,{onClick:()=>t(!0),children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Neuer Anbieter"]})]}),s.jsxs(X,{children:[s.jsx("div",{className:"mb-4",children:s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:a,onChange:b=>i(b.target.checked),className:"rounded"}),"Inaktive anzeigen"]})}),h?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):u!=null&&u.data&&u.data.length>0?s.jsx("div",{className:"space-y-2",children:u.data.map(b=>s.jsx(qC,{provider:b,isExpanded:l.has(b.id),onToggle:()=>m(b.id),onEdit:()=>f(b),onDelete:()=>{confirm("Anbieter wirklich löschen?")&&x.mutate(b.id)},hasPermission:c,showInactive:a},b.id))}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Anbieter vorhanden."})]}),s.jsx(VC,{isOpen:e,onClose:p,provider:n})]})}function qC({provider:e,isExpanded:t,onToggle:n,onEdit:r,onDelete:a,hasPermission:i,showInactive:l}){var f,p;const[o,c]=j.useState(!1),[d,u]=j.useState(null),h=ge(),x=G({mutationFn:yv.delete,onSuccess:()=>{h.invalidateQueries({queryKey:["providers"]})},onError:b=>{alert(b.message)}}),m=((f=e.tariffs)==null?void 0:f.filter(b=>l||b.isActive))||[];return s.jsxs("div",{className:"border rounded-lg",children:[s.jsxs("div",{className:"flex items-center p-4 hover:bg-gray-50",children:[s.jsx("button",{onClick:n,className:"mr-3 p-1 hover:bg-gray-200 rounded",children:t?s.jsx(dn,{className:"w-5 h-5 text-gray-400"}):s.jsx(Ft,{className:"w-5 h-5 text-gray-400"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"font-medium",children:e.name}),s.jsx(ve,{variant:e.isActive?"success":"danger",children:e.isActive?"Aktiv":"Inaktiv"}),s.jsxs("span",{className:"text-sm text-gray-500",children:["(",m.length," Tarife, ",((p=e._count)==null?void 0:p.contracts)||0," Verträge)"]})]}),e.portalUrl&&s.jsxs("a",{href:e.portalUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:underline flex items-center gap-1 mt-1",children:[s.jsx(dh,{className:"w-3 h-3"}),e.portalUrl]})]}),s.jsxs("div",{className:"flex gap-2 ml-4",children:[i("providers:update")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:r,title:"Bearbeiten",children:s.jsx(He,{className:"w-4 h-4"})}),i("providers:delete")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:a,title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]}),t&&s.jsxs("div",{className:"border-t bg-gray-50 p-4",children:[s.jsxs("div",{className:"flex justify-between items-center mb-3",children:[s.jsx("h4",{className:"font-medium text-gray-700",children:"Tarife"}),i("providers:create")&&s.jsxs(T,{size:"sm",onClick:()=>c(!0),children:[s.jsx(_e,{className:"w-4 h-4 mr-1"}),"Tarif hinzufügen"]})]}),m.length>0?s.jsx("div",{className:"space-y-2",children:m.map(b=>{var g;return s.jsxs("div",{className:"flex items-center justify-between bg-white p-3 rounded border",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{children:b.name}),s.jsx(ve,{variant:b.isActive?"success":"danger",className:"text-xs",children:b.isActive?"Aktiv":"Inaktiv"}),((g=b._count)==null?void 0:g.contracts)!==void 0&&s.jsxs("span",{className:"text-xs text-gray-500",children:["(",b._count.contracts," Verträge)"]})]}),s.jsxs("div",{className:"flex gap-1",children:[i("providers:update")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{u(b),c(!0)},title:"Bearbeiten",children:s.jsx(He,{className:"w-3 h-3"})}),i("providers:delete")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Tarif wirklich löschen?")&&x.mutate(b.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-3 h-3 text-red-500"})})]})]},b.id)})}):s.jsx("p",{className:"text-sm text-gray-500",children:"Keine Tarife vorhanden."})]}),s.jsx(QC,{isOpen:o,onClose:()=>{c(!1),u(null)},providerId:e.id,tariff:d})]})}function VC({isOpen:e,onClose:t,provider:n}){const r=ge(),[a,i]=j.useState({name:"",portalUrl:"",usernameFieldName:"",passwordFieldName:"",isActive:!0});j.useEffect(()=>{e&&i(n?{name:n.name,portalUrl:n.portalUrl||"",usernameFieldName:n.usernameFieldName||"",passwordFieldName:n.passwordFieldName||"",isActive:n.isActive}:{name:"",portalUrl:"",usernameFieldName:"",passwordFieldName:"",isActive:!0})},[e,n]);const l=G({mutationFn:Xa.create,onSuccess:()=>{r.invalidateQueries({queryKey:["providers"]}),t()},onError:u=>{alert(u.message)}}),o=G({mutationFn:u=>Xa.update(n.id,u),onSuccess:()=>{r.invalidateQueries({queryKey:["providers"]}),t()},onError:u=>{alert(u.message)}}),c=u=>{u.preventDefault(),n?o.mutate(a):l.mutate(a)},d=l.isPending||o.isPending;return s.jsx(qe,{isOpen:e,onClose:t,title:n?"Anbieter bearbeiten":"Neuer Anbieter",children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(H,{label:"Anbietername *",value:a.name,onChange:u=>i({...a,name:u.target.value}),required:!0,placeholder:"z.B. Vodafone, E.ON, Allianz"}),s.jsx(H,{label:"Portal-URL (Login-Seite)",value:a.portalUrl,onChange:u=>i({...a,portalUrl:u.target.value}),placeholder:"https://kundenportal.anbieter.de/login"}),s.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg space-y-3",children:[s.jsxs("p",{className:"text-sm text-gray-600",children:[s.jsx("strong",{children:"Auto-Login Felder"})," (optional)",s.jsx("br",{}),"Feldnamen für URL-Parameter beim Auto-Login:"]}),s.jsx(H,{label:"Benutzername-Feldname",value:a.usernameFieldName,onChange:u=>i({...a,usernameFieldName:u.target.value}),placeholder:"z.B. username, email, login"}),s.jsx(H,{label:"Passwort-Feldname",value:a.passwordFieldName,onChange:u=>i({...a,passwordFieldName:u.target.value}),placeholder:"z.B. password, pwd, kennwort"})]}),n&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:a.isActive,onChange:u=>i({...a,isActive:u.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:d,children:d?"Speichern...":"Speichern"})]})]})})}function QC({isOpen:e,onClose:t,providerId:n,tariff:r}){const a=ge(),[i,l]=j.useState({name:"",isActive:!0});j.useEffect(()=>{e&&l(r?{name:r.name,isActive:r.isActive}:{name:"",isActive:!0})},[e,r]);const o=G({mutationFn:h=>Xa.createTariff(n,h),onSuccess:()=>{a.invalidateQueries({queryKey:["providers"]}),t()},onError:h=>{alert(h.message)}}),c=G({mutationFn:h=>yv.update(r.id,h),onSuccess:()=>{a.invalidateQueries({queryKey:["providers"]}),t()},onError:h=>{alert(h.message)}}),d=h=>{h.preventDefault(),r?c.mutate(i):o.mutate(i)},u=o.isPending||c.isPending;return s.jsx(qe,{isOpen:e,onClose:t,title:r?"Tarif bearbeiten":"Neuer Tarif",children:s.jsxs("form",{onSubmit:d,className:"space-y-4",children:[s.jsx(H,{label:"Tarifname *",value:i.name,onChange:h=>l({...i,name:h.target.value}),required:!0,placeholder:"z.B. Comfort Plus, Basic 100"}),r&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:i.isActive,onChange:h=>l({...i,isActive:h.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:u,children:u?"Speichern...":"Speichern"})]})]})})}const Ju={Zap:s.jsx(xh,{className:"w-5 h-5"}),Flame:s.jsx(Ev,{className:"w-5 h-5"}),Wifi:s.jsx(Ea,{className:"w-5 h-5"}),Cable:s.jsx(P2,{className:"w-5 h-5"}),Network:s.jsx(q2,{className:"w-5 h-5"}),Smartphone:s.jsx(fh,{className:"w-5 h-5"}),Tv:s.jsx(Fv,{className:"w-5 h-5"}),Car:s.jsx(Cv,{className:"w-5 h-5"}),FileText:s.jsx(Be,{className:"w-5 h-5"})},HC=[{value:"Zap",label:"Blitz (Strom)"},{value:"Flame",label:"Flamme (Gas)"},{value:"Wifi",label:"WLAN (DSL)"},{value:"Cable",label:"Kabel"},{value:"Network",label:"Netzwerk (Glasfaser)"},{value:"Smartphone",label:"Smartphone (Mobilfunk)"},{value:"Tv",label:"TV"},{value:"Car",label:"Auto (KFZ)"},{value:"FileText",label:"Dokument (Sonstige)"}],WC=[{value:"#FFC107",label:"Gelb"},{value:"#FF5722",label:"Orange"},{value:"#2196F3",label:"Blau"},{value:"#9C27B0",label:"Lila"},{value:"#4CAF50",label:"Grün"},{value:"#E91E63",label:"Pink"},{value:"#607D8B",label:"Grau"},{value:"#795548",label:"Braun"},{value:"#00BCD4",label:"Cyan"},{value:"#F44336",label:"Rot"}];function GC(){const[e,t]=j.useState(!1),[n,r]=j.useState(null),[a,i]=j.useState(!1),{hasPermission:l}=We(),o=ge(),{data:c,isLoading:d}=fe({queryKey:["contract-categories",a],queryFn:()=>cl.getAll(a)}),u=G({mutationFn:cl.delete,onSuccess:()=>{o.invalidateQueries({queryKey:["contract-categories"]})},onError:m=>{alert(m.message)}}),h=m=>{r(m),t(!0)},x=()=>{t(!1),r(null)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Vs,{className:"w-4 h-4"})})}),s.jsx("h1",{className:"text-2xl font-bold flex-1",children:"Vertragstypen"}),l("developer:access")&&s.jsxs(T,{onClick:()=>t(!0),children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Neuer Vertragstyp"]})]}),s.jsxs(X,{children:[s.jsx("div",{className:"mb-4",children:s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:a,onChange:m=>i(m.target.checked),className:"rounded"}),"Inaktive anzeigen"]})}),d?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):c!=null&&c.data&&c.data.length>0?s.jsx("div",{className:"space-y-2",children:c.data.map(m=>{var f;return s.jsxs("div",{className:"flex items-center p-4 border rounded-lg hover:bg-gray-50",children:[s.jsx("div",{className:"mr-3 text-gray-400",children:s.jsx(L2,{className:"w-5 h-5"})}),s.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center mr-4",style:{backgroundColor:m.color||"#E5E7EB",color:"#fff"},children:m.icon&&Ju[m.icon]?Ju[m.icon]:s.jsx(Be,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"font-medium",children:m.name}),s.jsx(ve,{variant:m.isActive?"success":"danger",children:m.isActive?"Aktiv":"Inaktiv"}),s.jsxs("span",{className:"text-sm text-gray-500",children:["(",((f=m._count)==null?void 0:f.contracts)||0," Verträge)"]})]}),s.jsxs("div",{className:"text-sm text-gray-500",children:["Code: ",s.jsx("span",{className:"font-mono",children:m.code})]})]}),s.jsxs("div",{className:"flex gap-2 ml-4",children:[l("developer:access")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>h(m),title:"Bearbeiten",children:s.jsx(He,{className:"w-4 h-4"})}),l("developer:access")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Vertragstyp wirklich löschen?")&&u.mutate(m.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]},m.id)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Vertragstypen vorhanden."})]}),s.jsx(ZC,{isOpen:e,onClose:x,category:n})]})}function ZC({isOpen:e,onClose:t,category:n}){const r=ge(),[a,i]=j.useState({code:"",name:"",icon:"FileText",color:"#607D8B",sortOrder:0,isActive:!0});j.useEffect(()=>{e&&i(n?{code:n.code,name:n.name,icon:n.icon||"FileText",color:n.color||"#607D8B",sortOrder:n.sortOrder,isActive:n.isActive}:{code:"",name:"",icon:"FileText",color:"#607D8B",sortOrder:0,isActive:!0})},[e,n]);const l=G({mutationFn:cl.create,onSuccess:()=>{r.invalidateQueries({queryKey:["contract-categories"]}),t()},onError:u=>{alert(u.message)}}),o=G({mutationFn:u=>cl.update(n.id,u),onSuccess:()=>{r.invalidateQueries({queryKey:["contract-categories"]}),t()},onError:u=>{alert(u.message)}}),c=u=>{u.preventDefault(),n?o.mutate(a):l.mutate(a)},d=l.isPending||o.isPending;return s.jsx(qe,{isOpen:e,onClose:t,title:n?"Vertragstyp bearbeiten":"Neuer Vertragstyp",children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(H,{label:"Code (technisch) *",value:a.code,onChange:u=>i({...a,code:u.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"")}),required:!0,placeholder:"z.B. ELECTRICITY, MOBILE_BUSINESS",disabled:!!n}),s.jsx(H,{label:"Anzeigename *",value:a.name,onChange:u=>i({...a,name:u.target.value}),required:!0,placeholder:"z.B. Strom, Mobilfunk Business"}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Icon"}),s.jsx("div",{className:"grid grid-cols-4 gap-2",children:HC.map(u=>s.jsxs("button",{type:"button",onClick:()=>i({...a,icon:u.value}),className:`p-3 border rounded-lg flex flex-col items-center gap-1 text-xs ${a.icon===u.value?"border-blue-500 bg-blue-50":"border-gray-200 hover:bg-gray-50"}`,children:[Ju[u.value],s.jsx("span",{className:"truncate w-full text-center",children:u.label.split(" ")[0]})]},u.value))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Farbe"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:WC.map(u=>s.jsx("button",{type:"button",onClick:()=>i({...a,color:u.value}),className:`w-8 h-8 rounded-full border-2 ${a.color===u.value?"border-gray-800 ring-2 ring-offset-2 ring-gray-400":"border-transparent"}`,style:{backgroundColor:u.value},title:u.label},u.value))})]}),s.jsx(H,{label:"Sortierung",type:"number",value:a.sortOrder,onChange:u=>i({...a,sortOrder:parseInt(u.target.value)||0}),placeholder:"0"}),n&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:a.isActive,onChange:u=>i({...a,isActive:u.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:d,children:d?"Speichern...":"Speichern"})]})]})})}const JC=[{value:"0.1",label:"10%"},{value:"0.2",label:"20%"},{value:"0.3",label:"30%"},{value:"0.4",label:"40%"},{value:"0.5",label:"50%"},{value:"0.6",label:"60%"},{value:"0.7",label:"70% (Standard)"},{value:"0.8",label:"80%"},{value:"0.9",label:"90%"},{value:"999",label:"Deaktiviert"}];function XC(){const{settings:e,updateSettings:t}=bv();return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:s.jsx(Vs,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ae,{className:"w-6 h-6"}),s.jsx("h1",{className:"text-2xl font-bold",children:"Ansicht"})]})]}),s.jsx(X,{title:"Scroll-Verhalten",children:s.jsx("div",{className:"space-y-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:"Nach-oben-Button"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Ab welcher Scroll-Position der Button unten rechts erscheinen soll"})]}),s.jsx("div",{className:"w-48",children:s.jsx(Ie,{options:JC,value:e.scrollToTopThreshold.toString(),onChange:n=>t({scrollToTopThreshold:parseFloat(n.target.value)})})})]})})})]})}function YC(){const e=ge(),{data:t,isLoading:n}=fe({queryKey:["app-settings"],queryFn:()=>Xr.getAll()}),[r,a]=j.useState(!1);j.useEffect(()=>{t!=null&&t.data&&a(t.data.customerSupportTicketsEnabled==="true")},[t]);const i=G({mutationFn:o=>Xr.update(o),onSuccess:()=>{e.invalidateQueries({queryKey:["app-settings"]}),e.invalidateQueries({queryKey:["app-settings-public"]})}}),l=o=>{a(o),i.mutate({customerSupportTicketsEnabled:o?"true":"false"})};return n?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx("div",{className:"text-gray-500",children:"Laden..."})}):s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",className:"text-gray-500 hover:text-gray-700",children:s.jsx(Vs,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(uh,{className:"w-6 h-6"}),s.jsx("h1",{className:"text-2xl font-bold",children:"Kundenportal"})]})]}),s.jsxs(X,{title:"Support-Anfragen",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ul,{className:"w-5 h-5 text-gray-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:"Kunden können Support-Anfragen erstellen"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Wenn aktiviert, können Kunden im Portal Support-Anfragen zu ihren Verträgen erstellen. Diese erscheinen als Aufgaben in der Vertragsdetailansicht."})]})]}),s.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:o=>l(o.target.checked),disabled:i.isPending,className:"sr-only peer"}),s.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"})]})]}),r&&s.jsx("div",{className:"mt-4 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:s.jsxs("p",{className:"text-sm text-blue-800",children:[s.jsx("strong",{children:"Hinweis:"}),' Kunden sehen diese Anfragen als "Support-Anfragen" in ihrem Portal. Sie können die Anfrage mit einem Titel und einer Beschreibung erstellen. Ihre Mitarbeiter können dann mit Antworten (Unteraufgaben) reagieren.']})})]})]})}function e4(){const e=ge(),{data:t,isLoading:n}=fe({queryKey:["app-settings"],queryFn:()=>Xr.getAll()}),[r,a]=j.useState("14"),[i,l]=j.useState("42"),[o,c]=j.useState("90"),[d,u]=j.useState(!1);j.useEffect(()=>{t!=null&&t.data&&(a(t.data.deadlineCriticalDays||"14"),l(t.data.deadlineWarningDays||"42"),c(t.data.deadlineOkDays||"90"),u(!1))},[t]);const h=G({mutationFn:f=>Xr.update(f),onSuccess:()=>{e.invalidateQueries({queryKey:["app-settings"]}),e.invalidateQueries({queryKey:["contract-cockpit"]}),u(!1)}}),x=()=>{const f=parseInt(r),p=parseInt(i),b=parseInt(o);if(isNaN(f)||isNaN(p)||isNaN(b)){alert("Bitte gültige Zahlen eingeben");return}if(f>=p||p>=b){alert("Die Werte müssen aufsteigend sein: Kritisch < Warnung < OK");return}h.mutate({deadlineCriticalDays:r,deadlineWarningDays:i,deadlineOkDays:o})},m=(f,p)=>{f(p),u(!0)};return n?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx("div",{className:"text-gray-500",children:"Laden..."})}):s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",className:"text-gray-500 hover:text-gray-700",children:s.jsx(Vs,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(on,{className:"w-6 h-6"}),s.jsx("h1",{className:"text-2xl font-bold",children:"Fristenschwellen"})]})]}),s.jsxs(X,{title:"Farbkodierung für Fristen",children:[s.jsx("p",{className:"text-gray-600 mb-6",children:"Definiere, ab wann Vertragsfristen als kritisch (rot), Warnung (gelb) oder OK (grün) angezeigt werden sollen. Die Werte geben die Anzahl der Tage bis zur Frist an."}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-4 p-4 bg-red-50 border border-red-200 rounded-lg",children:[s.jsx(kn,{className:"w-8 h-8 text-red-500 flex-shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block font-medium text-red-800 mb-1",children:"Kritisch (Rot)"}),s.jsx("p",{className:"text-sm text-red-600 mb-2",children:"Fristen mit weniger als X Tagen werden rot markiert"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(H,{type:"number",min:"1",value:r,onChange:f=>m(a,f.target.value),className:"w-24"}),s.jsx("span",{className:"text-red-700",children:"Tage"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 p-4 bg-yellow-50 border border-yellow-200 rounded-lg",children:[s.jsx(hs,{className:"w-8 h-8 text-yellow-500 flex-shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block font-medium text-yellow-800 mb-1",children:"Warnung (Gelb)"}),s.jsx("p",{className:"text-sm text-yellow-600 mb-2",children:"Fristen mit weniger als X Tagen werden gelb markiert"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(H,{type:"number",min:"1",value:i,onChange:f=>m(l,f.target.value),className:"w-24"}),s.jsx("span",{className:"text-yellow-700",children:"Tage"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 p-4 bg-green-50 border border-green-200 rounded-lg",children:[s.jsx(As,{className:"w-8 h-8 text-green-500 flex-shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block font-medium text-green-800 mb-1",children:"OK (Grün)"}),s.jsx("p",{className:"text-sm text-green-600 mb-2",children:"Fristen mit weniger als X Tagen werden grün markiert (darüber nicht angezeigt)"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(H,{type:"number",min:"1",value:o,onChange:f=>m(c,f.target.value),className:"w-24"}),s.jsx("span",{className:"text-green-700",children:"Tage"})]})]})]})]}),s.jsxs("div",{className:"mt-6 pt-4 border-t flex justify-between items-center",children:[s.jsx("p",{className:"text-sm text-gray-500",children:"Beispiel: Bei 14/42/90 Tagen wird eine Frist die in 10 Tagen abläuft rot, eine in 30 Tagen gelb, und eine in 60 Tagen grün markiert."}),s.jsx(T,{onClick:x,disabled:!d||h.isPending,children:h.isPending?"Speichere...":"Speichern"})]})]})]})}const t4=[{value:"PLESK",label:"Plesk"},{value:"CPANEL",label:"cPanel"},{value:"DIRECTADMIN",label:"DirectAdmin"}],Ux=[{value:"SSL",label:"SSL/TLS",description:"Verschlüsselung von Anfang an"},{value:"STARTTLS",label:"STARTTLS",description:"Startet unverschlüsselt, dann Upgrade"},{value:"NONE",label:"Keine",description:"Keine Verschlüsselung"}],bd={name:"",type:"PLESK",apiUrl:"",apiKey:"",username:"",password:"",domain:"stressfrei-wechseln.de",defaultForwardEmail:"",imapEncryption:"SSL",smtpEncryption:"SSL",allowSelfSignedCerts:!1,isActive:!0,isDefault:!1};function s4(){const e=Yt(),t=ge(),[n,r]=j.useState(!1),[a,i]=j.useState(null),[l,o]=j.useState(bd),[c,d]=j.useState(!1),[u,h]=j.useState(null),[x,m]=j.useState(!1),[f,p]=j.useState({}),[b,g]=j.useState(null),{data:y,isLoading:v}=fe({queryKey:["email-provider-configs"],queryFn:()=>yn.getConfigs()}),N=G({mutationFn:k=>yn.createConfig(k),onSuccess:()=>{t.invalidateQueries({queryKey:["email-provider-configs"]}),A()}}),E=G({mutationFn:({id:k,data:K})=>yn.updateConfig(k,K),onSuccess:()=>{t.invalidateQueries({queryKey:["email-provider-configs"]}),A()}}),P=G({mutationFn:k=>yn.deleteConfig(k),onSuccess:()=>{t.invalidateQueries({queryKey:["email-provider-configs"]})}}),I=(y==null?void 0:y.data)||[],w=()=>{o(bd),i(null),d(!1),h(null),r(!0)},S=k=>{o({name:k.name,type:k.type,apiUrl:k.apiUrl,apiKey:k.apiKey||"",username:k.username||"",password:"",domain:k.domain,defaultForwardEmail:k.defaultForwardEmail||"",imapEncryption:k.imapEncryption??"SSL",smtpEncryption:k.smtpEncryption??"SSL",allowSelfSignedCerts:k.allowSelfSignedCerts??!1,isActive:k.isActive,isDefault:k.isDefault}),i(k.id),d(!1),h(null),r(!0)},A=()=>{r(!1),i(null),o(bd),d(!1),h(null)},O=async k=>{var K,B,_;g(k.id),p(Q=>({...Q,[k.id]:null}));try{const Q=await yn.testConnection({id:k.id}),le={success:((K=Q.data)==null?void 0:K.success)||!1,message:(B=Q.data)==null?void 0:B.message,error:(_=Q.data)==null?void 0:_.error};p(de=>({...de,[k.id]:le}))}catch(Q){p(le=>({...le,[k.id]:{success:!1,error:Q instanceof Error?Q.message:"Unbekannter Fehler beim Testen"}}))}finally{g(null)}},R=async()=>{var k,K,B;if(!l.apiUrl||!l.domain){h({success:!1,error:"Bitte geben Sie API-URL und Domain ein."});return}m(!0),h(null);try{const _=await yn.testConnection({testData:{type:l.type,apiUrl:l.apiUrl,apiKey:l.apiKey||void 0,username:l.username||void 0,password:l.password||void 0,domain:l.domain}});h({success:((k=_.data)==null?void 0:k.success)||!1,message:(K=_.data)==null?void 0:K.message,error:(B=_.data)==null?void 0:B.error})}catch(_){h({success:!1,error:_ instanceof Error?_.message:"Unbekannter Fehler beim Verbindungstest"})}finally{m(!1)}},q=k=>{k.preventDefault();const K={name:l.name,type:l.type,apiUrl:l.apiUrl,apiKey:l.apiKey,username:l.username,domain:l.domain,defaultForwardEmail:l.defaultForwardEmail,imapEncryption:l.imapEncryption,smtpEncryption:l.smtpEncryption,allowSelfSignedCerts:l.allowSelfSignedCerts,isActive:l.isActive,isDefault:l.isDefault};l.password&&(K.password=l.password),a?E.mutate({id:a,data:K}):N.mutate(K)},D=(k,K)=>{confirm(`Möchten Sie den Provider "${K}" wirklich löschen?`)&&P.mutate(k)},z=k=>k.error?k.error:k.message?k.message:"Verbindung fehlgeschlagen";return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs(T,{variant:"ghost",onClick:()=>e("/settings"),children:[s.jsx(Vs,{className:"w-4 h-4 mr-2"}),"Zurück"]}),s.jsx("h1",{className:"text-2xl font-bold",children:"Email-Provisionierung"})]}),s.jsxs(X,{className:"mb-6",children:[s.jsx("p",{className:"text-gray-600 mb-4",children:'Hier konfigurieren Sie die automatische Erstellung von Stressfrei-Wechseln E-Mail-Adressen. Wenn beim Anlegen einer Stressfrei-Adresse die Option "Bei Provider anlegen" aktiviert ist, wird die E-Mail-Weiterleitung automatisch erstellt.'}),s.jsxs(T,{onClick:w,children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Provider hinzufügen"]})]}),v?s.jsx("div",{className:"text-center py-8",children:"Laden..."}):I.length===0?s.jsx(X,{children:s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Noch keine Email-Provider konfiguriert."})}):s.jsx("div",{className:"space-y-4",children:I.map(k=>{const K=f[k.id],B=b===k.id;return s.jsx(X,{children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"font-semibold text-lg",children:k.name}),s.jsx("span",{className:"px-2 py-1 text-xs rounded bg-blue-100 text-blue-800",children:k.type}),k.isDefault&&s.jsx("span",{className:"px-2 py-1 text-xs rounded bg-green-100 text-green-800",children:"Standard"}),!k.isActive&&s.jsx("span",{className:"px-2 py-1 text-xs rounded bg-gray-100 text-gray-600",children:"Inaktiv"})]}),s.jsxs("dl",{className:"mt-3 grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"API-URL"}),s.jsx("dd",{className:"font-mono text-xs truncate",children:k.apiUrl})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"Domain"}),s.jsx("dd",{children:k.domain})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"Benutzer"}),s.jsx("dd",{children:k.username||"-"})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"Standard-Weiterleitung"}),s.jsx("dd",{className:"truncate",children:k.defaultForwardEmail||"-"})]})]}),K&&s.jsx("div",{className:`mt-3 p-3 rounded-lg text-sm ${K.success?"bg-green-50 text-green-800":"bg-red-50 text-red-800"}`,children:K.success?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(xr,{className:"w-4 h-4 flex-shrink-0"}),s.jsx("span",{children:"Verbindung erfolgreich!"})]}):s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(xx,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),s.jsx("span",{children:z(K)})]})})]}),s.jsxs("div",{className:"flex gap-2 ml-4",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>O(k),disabled:B,title:"Verbindung testen",children:B?s.jsx("span",{className:"w-4 h-4 border-2 border-gray-400 border-t-transparent rounded-full animate-spin"}):s.jsx(Ea,{className:"w-4 h-4 text-blue-500"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>S(k),children:s.jsx(He,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>D(k.id,k.name),children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]})},k.id)})}),n&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsx("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-lg mx-4 max-h-[90vh] overflow-y-auto",children:s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h2",{className:"text-xl font-semibold",children:a?"Provider bearbeiten":"Neuer Provider"}),s.jsx("button",{onClick:A,className:"text-gray-400 hover:text-gray-600",children:s.jsx(qt,{className:"w-5 h-5"})})]}),(N.error||E.error)&&s.jsx("div",{className:"mb-4 p-3 rounded-lg bg-red-50 text-red-800 text-sm",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(qt,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),s.jsx("span",{children:N.error instanceof Error?N.error.message:E.error instanceof Error?E.error.message:"Fehler beim Speichern"})]})}),s.jsxs("form",{onSubmit:q,className:"space-y-4",children:[s.jsx(H,{label:"Name *",value:l.name,onChange:k=>o({...l,name:k.target.value}),placeholder:"z.B. Plesk Hauptserver",required:!0}),s.jsx(Ie,{label:"Provider-Typ *",value:l.type,onChange:k=>o({...l,type:k.target.value}),options:t4}),s.jsx(H,{label:"API-URL *",value:l.apiUrl,onChange:k=>o({...l,apiUrl:k.target.value}),placeholder:"https://server.de:8443",required:!0}),s.jsx(H,{label:"API-Key",value:l.apiKey,onChange:k=>o({...l,apiKey:k.target.value}),placeholder:"Optional - alternativ zu Benutzername/Passwort"}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(H,{label:"Benutzername",value:l.username,onChange:k=>o({...l,username:k.target.value}),placeholder:"admin"}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:a?"Neues Passwort (leer = beibehalten)":"Passwort"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:c?"text":"password",value:l.password,onChange:k=>o({...l,password:k.target.value}),className:"block w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("button",{type:"button",onClick:()=>d(!c),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600",children:c?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Ae,{className:"w-4 h-4"})})]})]})]}),s.jsx(H,{label:"Domain *",value:l.domain,onChange:k=>o({...l,domain:k.target.value}),placeholder:"stressfrei-wechseln.de",required:!0}),s.jsx(H,{label:"Standard-Weiterleitungsadresse",value:l.defaultForwardEmail,onChange:k=>o({...l,defaultForwardEmail:k.target.value}),placeholder:"info@meinefirma.de",type:"email"}),s.jsx("p",{className:"text-xs text-gray-500 -mt-2",children:"Diese E-Mail-Adresse wird zusätzlich zur Kunden-E-Mail als Weiterleitungsziel hinzugefügt."}),s.jsxs("div",{className:"pt-4 border-t",children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-3",children:"E-Mail-Verbindungseinstellungen"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["IMAP Verschlüsselung",s.jsxs("span",{className:"text-gray-400 font-normal ml-1",children:["(Port ",l.imapEncryption==="SSL"?"993":"143",")"]})]}),s.jsx("select",{value:l.imapEncryption,onChange:k=>o({...l,imapEncryption:k.target.value}),className:"block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm",children:Ux.map(k=>s.jsxs("option",{value:k.value,children:[k.label," - ",k.description]},k.value))})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["SMTP Verschlüsselung",s.jsxs("span",{className:"text-gray-400 font-normal ml-1",children:["(Port ",l.smtpEncryption==="SSL"?"465":l.smtpEncryption==="STARTTLS"?"587":"25",")"]})]}),s.jsx("select",{value:l.smtpEncryption,onChange:k=>o({...l,smtpEncryption:k.target.value}),className:"block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm",children:Ux.map(k=>s.jsxs("option",{value:k.value,children:[k.label," - ",k.description]},k.value))})]})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:l.allowSelfSignedCerts,onChange:k=>o({...l,allowSelfSignedCerts:k.target.checked}),className:"rounded border-gray-300"}),s.jsx("span",{className:"text-sm",children:"Selbstsignierte Zertifikate erlauben"})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"Aktivieren Sie diese Option für Testumgebungen mit selbstsignierten SSL-Zertifikaten."})]})]}),s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:l.isActive,onChange:k=>o({...l,isActive:k.target.checked}),className:"rounded border-gray-300"}),s.jsx("span",{className:"text-sm",children:"Aktiv"})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:l.isDefault,onChange:k=>o({...l,isDefault:k.target.checked}),className:"rounded border-gray-300"}),s.jsx("span",{className:"text-sm",children:"Als Standard verwenden"})]})]}),s.jsxs("div",{className:"pt-4 border-t",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:R,disabled:x,className:"w-full",children:x?"Teste Verbindung...":s.jsxs(s.Fragment,{children:[s.jsx(Ea,{className:"w-4 h-4 mr-2"}),"Verbindung testen"]})}),u&&s.jsx("div",{className:`mt-2 p-3 rounded-lg text-sm ${u.success?"bg-green-50 text-green-800":"bg-red-50 text-red-800"}`,children:u.success?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(xr,{className:"w-4 h-4 flex-shrink-0"}),s.jsx("span",{children:"Verbindung erfolgreich!"})]}):s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(xx,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),s.jsx("span",{children:z(u)})]})})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:A,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:N.isPending||E.isPending,children:N.isPending||E.isPending?"Speichern...":"Speichern"})]})]})]})})})]})}function n4(){const[e,t]=j.useState(null),[n,r]=j.useState(null),[a,i]=j.useState(!1),[l,o]=j.useState(""),[c,d]=j.useState(null),u=j.useRef(null),h=ge(),{logout:x}=We(),{data:m,isLoading:f}=fe({queryKey:["backups"],queryFn:()=>br.list()}),p=(m==null?void 0:m.data)||[],b=G({mutationFn:()=>br.create(),onSuccess:()=>{h.invalidateQueries({queryKey:["backups"]})}}),g=G({mutationFn:S=>br.restore(S),onSuccess:()=>{h.invalidateQueries({queryKey:["backups"]}),t(null)}}),y=G({mutationFn:S=>br.delete(S),onSuccess:()=>{h.invalidateQueries({queryKey:["backups"]}),r(null)}}),v=G({mutationFn:S=>br.upload(S),onSuccess:()=>{h.invalidateQueries({queryKey:["backups"]}),d(null),u.current&&(u.current.value="")},onError:S=>{d(S.message||"Upload fehlgeschlagen")}}),N=G({mutationFn:()=>br.factoryReset(),onSuccess:()=>{i(!1),o(""),x()}}),E=S=>{var O;const A=(O=S.target.files)==null?void 0:O[0];if(A){if(!A.name.endsWith(".zip")){d("Nur ZIP-Dateien sind erlaubt");return}d(null),v.mutate(A)}},P=async S=>{const A=localStorage.getItem("token"),O=br.getDownloadUrl(S);try{const R=await fetch(O,{headers:{Authorization:`Bearer ${A}`}});if(!R.ok)throw new Error("Download fehlgeschlagen");const q=await R.blob(),D=window.URL.createObjectURL(q),z=document.createElement("a");z.href=D,z.download=`opencrm-backup-${S}.zip`,document.body.appendChild(z),z.click(),document.body.removeChild(z),window.URL.revokeObjectURL(D)}catch(R){console.error("Download error:",R)}},I=S=>new Date(S).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),w=S=>S<1024?`${S} B`:S<1024*1024?`${(S/1024).toFixed(1)} KB`:`${(S/(1024*1024)).toFixed(1)} MB`;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-lg font-semibold text-gray-900 flex items-center gap-2",children:[s.jsx(Ic,{className:"w-5 h-5"}),"Datenbank & Zurücksetzen"]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Backups erstellen, wiederherstellen oder auf Werkseinstellungen zurücksetzen."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"file",ref:u,accept:".zip",onChange:E,className:"hidden"}),s.jsx(T,{variant:"secondary",onClick:()=>{var S;return(S=u.current)==null?void 0:S.click()},disabled:v.isPending,children:v.isPending?s.jsxs(s.Fragment,{children:[s.jsx(Sr,{className:"w-4 h-4 mr-2 animate-spin"}),"Hochladen..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Hu,{className:"w-4 h-4 mr-2"}),"Backup hochladen"]})}),s.jsx(T,{onClick:()=>b.mutate(),disabled:b.isPending,children:b.isPending?s.jsxs(s.Fragment,{children:[s.jsx(Sr,{className:"w-4 h-4 mr-2 animate-spin"}),"Wird erstellt..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ps,{className:"w-4 h-4 mr-2"}),"Neues Backup"]})})]})]}),c&&s.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-red-700",children:c}),s.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[s.jsx("h4",{className:"text-sm font-medium text-blue-800 mb-2",children:"Hinweise zur Datensicherung"}),s.jsxs("ul",{className:"text-sm text-blue-700 space-y-1 list-disc list-inside",children:[s.jsx("li",{children:"Backups enthalten alle Datenbankdaten und hochgeladene Dokumente"}),s.jsx("li",{children:"Erstellen Sie vor Datenbankmigrationen immer ein Backup"}),s.jsx("li",{children:"Backups können als ZIP heruntergeladen und auf einem anderen System wiederhergestellt werden"}),s.jsx("li",{children:"Bei der Wiederherstellung werden bestehende Daten mit dem Backup-Stand überschrieben"})]})]}),s.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 bg-gray-50 border-b border-gray-200",children:s.jsx("h3",{className:"text-sm font-medium text-gray-700",children:"Verfügbare Backups"})}),f?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Sr,{className:"w-6 h-6 animate-spin text-gray-400"})}):p.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(fx,{className:"w-12 h-12 mb-2 opacity-30"}),s.jsx("p",{children:"Keine Backups vorhanden"}),s.jsx("p",{className:"text-sm mt-1",children:"Erstellen Sie Ihr erstes Backup"})]}):s.jsx("div",{className:"divide-y divide-gray-200",children:p.map(S=>s.jsx("div",{className:"p-4 hover:bg-gray-50",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[s.jsx("span",{className:"font-mono text-sm bg-gray-100 px-2 py-1 rounded",children:S.name}),s.jsxs("span",{className:"text-sm text-gray-500 flex items-center gap-1",children:[s.jsx(on,{className:"w-4 h-4"}),I(S.timestamp)]})]}),s.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Be,{className:"w-4 h-4"}),S.totalRecords.toLocaleString("de-DE")," Datensätze"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(fx,{className:"w-4 h-4"}),w(S.sizeBytes)]}),S.hasUploads&&s.jsxs("span",{className:"flex items-center gap-1 text-green-600",children:[s.jsx(R2,{className:"w-4 h-4"}),"Dokumente (",w(S.uploadSizeBytes),")"]})]}),s.jsxs("details",{className:"mt-2",children:[s.jsxs("summary",{className:"text-xs text-gray-500 cursor-pointer hover:text-gray-700",children:["Tabellen anzeigen (",S.tables.filter(A=>A.count>0).length," mit Daten)"]}),s.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:S.tables.filter(A=>A.count>0).map(A=>s.jsxs("span",{className:"text-xs bg-gray-100 px-2 py-0.5 rounded",children:[A.table,": ",A.count]},A.table))})]})]}),s.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>P(S.name),title:"Als ZIP herunterladen",children:s.jsx(E2,{className:"w-4 h-4"})}),s.jsxs(T,{variant:"secondary",size:"sm",onClick:()=>t(S.name),disabled:g.isPending,children:[s.jsx(Hu,{className:"w-4 h-4 mr-1"}),"Wiederherstellen"]}),s.jsx(T,{variant:"danger",size:"sm",onClick:()=>r(S.name),disabled:y.isPending,children:s.jsx(Ne,{className:"w-4 h-4"})})]})]})},S.name))})]}),e&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Backup wiederherstellen?"}),s.jsxs("p",{className:"text-gray-600 mb-4",children:["Möchten Sie das Backup ",s.jsx("strong",{children:e})," wirklich wiederherstellen?"]}),s.jsxs("p",{className:"text-amber-600 text-sm mb-4 bg-amber-50 p-3 rounded-lg",children:[s.jsx("strong",{children:"Achtung:"})," Bestehende Daten und Dokumente werden mit dem Backup-Stand überschrieben. Dies kann nicht rückgängig gemacht werden."]}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:()=>t(null),disabled:g.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"primary",onClick:()=>g.mutate(e),disabled:g.isPending,children:g.isPending?s.jsxs(s.Fragment,{children:[s.jsx(Sr,{className:"w-4 h-4 mr-2 animate-spin"}),"Wird wiederhergestellt..."]}):"Ja, wiederherstellen"})]})]})}),n&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Backup löschen?"}),s.jsxs("p",{className:"text-gray-600 mb-4",children:["Möchten Sie das Backup ",s.jsx("strong",{children:n})," wirklich löschen? Dies kann nicht rückgängig gemacht werden."]}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:()=>r(null),disabled:y.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:()=>y.mutate(n),disabled:y.isPending,children:y.isPending?"Wird gelöscht...":"Ja, löschen"})]})]})}),s.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 mt-8",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-red-100 rounded-lg",children:s.jsx(hs,{className:"w-6 h-6 text-red-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"text-lg font-semibold text-red-800 mb-2",children:"Werkseinstellungen"}),s.jsxs("p",{className:"text-sm text-red-700 mb-4",children:["Setzt das System auf den Ausgangszustand zurück. ",s.jsx("strong",{children:"Alle Daten werden unwiderruflich gelöscht"})," - Kunden, Verträge, Benutzer, Dokumente und Einstellungen. Nur die hier gespeicherten Backups bleiben erhalten."]}),s.jsxs("ul",{className:"text-sm text-red-700 mb-4 list-disc list-inside space-y-1",children:[s.jsx("li",{children:"Alle Kunden und Verträge werden gelöscht"}),s.jsx("li",{children:"Alle Benutzer werden gelöscht"}),s.jsx("li",{children:"Alle hochgeladenen Dokumente werden gelöscht"}),s.jsx("li",{children:"Ein neuer Admin-Benutzer wird erstellt (admin@admin.com / admin)"}),s.jsxs("li",{children:[s.jsx("strong",{children:"Backups bleiben erhalten"})," und können danach wiederhergestellt werden"]})]}),s.jsxs(T,{variant:"danger",onClick:()=>i(!0),children:[s.jsx(hh,{className:"w-4 h-4 mr-2"}),"Werkseinstellungen"]})]})]})}),a&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-lg mx-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"p-2 bg-red-100 rounded-lg",children:s.jsx(hs,{className:"w-6 h-6 text-red-600"})}),s.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Wirklich auf Werkseinstellungen zurücksetzen?"})]}),s.jsxs("p",{className:"text-gray-600 mb-4",children:["Diese Aktion löscht ",s.jsx("strong",{children:"alle Daten unwiderruflich"}),". Es gibt kein Zurück!"]}),s.jsxs("p",{className:"text-sm text-gray-600 mb-4",children:["Geben Sie zur Bestätigung ",s.jsx("strong",{className:"font-mono bg-gray-100 px-1",children:"LÖSCHEN"})," ein:"]}),s.jsx("input",{type:"text",value:l,onChange:S=>o(S.target.value),placeholder:"LÖSCHEN",className:"w-full px-3 py-2 border border-gray-300 rounded-lg mb-4 focus:ring-2 focus:ring-red-500 focus:border-red-500"}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:()=>{i(!1),o("")},disabled:N.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:()=>N.mutate(),disabled:l!=="LÖSCHEN"||N.isPending,children:N.isPending?s.jsxs(s.Fragment,{children:[s.jsx(Sr,{className:"w-4 h-4 mr-2 animate-spin"}),"Wird zurückgesetzt..."]}):"Ja, alles löschen"})]})]})})]})}function r4(){var y;const[e,t]=j.useState(""),[n,r]=j.useState(1),[a,i]=j.useState(!1),[l,o]=j.useState(null),c=ge(),{refreshUser:d}=We(),{data:u,isLoading:h}=fe({queryKey:["users",e,n],queryFn:()=>Li.getAll({search:e||void 0,page:n,limit:20})}),{data:x}=fe({queryKey:["roles"],queryFn:()=>Li.getRoles()}),m=G({mutationFn:Li.delete,onSuccess:()=>{c.invalidateQueries({queryKey:["users"]})},onError:v=>{alert((v==null?void 0:v.message)||"Fehler beim Löschen des Benutzers")}}),f=v=>{var N;return(N=v.roles)==null?void 0:N.some(E=>E.name==="Admin")},p=((y=u==null?void 0:u.data)==null?void 0:y.filter(v=>v.isActive&&f(v)).length)||0,b=v=>{o(v),i(!0)},g=()=>{i(!1),o(null)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Vs,{className:"w-4 h-4"})})}),s.jsx("h1",{className:"text-2xl font-bold flex-1",children:"Benutzer"}),s.jsxs(T,{onClick:()=>i(!0),children:[s.jsx(_e,{className:"w-4 h-4 mr-2"}),"Neuer Benutzer"]})]}),s.jsx(X,{className:"mb-6",children:s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"flex-1",children:s.jsx(H,{placeholder:"Suchen...",value:e,onChange:v=>t(v.target.value)})}),s.jsx(T,{variant:"secondary",children:s.jsx(Tl,{className:"w-4 h-4"})})]})}),s.jsxs("div",{className:"mb-6 bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start gap-3",children:[s.jsx(Ml,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm text-blue-800",children:[s.jsx("strong",{children:"Hinweis:"})," Bei Änderungen an Rollen oder Berechtigungen wird der betroffene Benutzer automatisch ausgeloggt und muss sich erneut anmelden."]})]}),s.jsx(X,{children:h?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):u!=null&&u.data&&u.data.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Name"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"E-Mail"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Rollen"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Status"}),s.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsx("tbody",{children:u.data.map(v=>{var N;return s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[s.jsxs("td",{className:"py-3 px-4",children:[v.firstName," ",v.lastName]}),s.jsx("td",{className:"py-3 px-4",children:v.email}),s.jsx("td",{className:"py-3 px-4",children:s.jsx("div",{className:"flex gap-1 flex-wrap",children:(N=v.roles)==null?void 0:N.filter(E=>E.name!=="Developer").map(E=>s.jsx(ve,{variant:"info",children:E.name},E.id||E.name))})}),s.jsx("td",{className:"py-3 px-4",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ve,{variant:v.isActive?"success":"danger",children:v.isActive?"Aktiv":"Inaktiv"}),v.hasDeveloperAccess&&s.jsxs(ve,{variant:"warning",className:"flex items-center gap-1",children:[s.jsx(Fc,{className:"w-3 h-3"}),"Dev"]})]})}),s.jsx("td",{className:"py-3 px-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>b(v),children:s.jsx(He,{className:"w-4 h-4"})}),(()=>{const E=f(v)&&v.isActive&&p<=1;return s.jsx(T,{variant:"ghost",size:"sm",disabled:E,title:E?"Letzter Administrator kann nicht gelöscht werden":void 0,onClick:()=>{confirm("Benutzer wirklich löschen?")&&m.mutate(v.id)},children:s.jsx(Ne,{className:`w-4 h-4 ${E?"text-gray-300":"text-red-500"}`})})})()]})})]},v.id)})})]})}),u.pagination&&u.pagination.totalPages>1&&s.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["Seite ",u.pagination.page," von ",u.pagination.totalPages]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>r(v=>Math.max(1,v-1)),disabled:n===1,children:"Zurück"}),s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>r(v=>v+1),disabled:n>=u.pagination.totalPages,children:"Weiter"})]})]})]}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Benutzer gefunden."})}),s.jsx(a4,{isOpen:a,onClose:g,user:l,roles:(x==null?void 0:x.data)||[],onUserUpdated:d})]})}function a4({isOpen:e,onClose:t,user:n,roles:r,onUserUpdated:a}){const i=ge(),[l,o]=j.useState(null),[c,d]=j.useState({email:"",password:"",firstName:"",lastName:"",roleIds:[],isActive:!0,hasDeveloperAccess:!1});j.useEffect(()=>{var p;e&&(o(null),d(n?{email:n.email,password:"",firstName:n.firstName,lastName:n.lastName,roleIds:((p=n.roles)==null?void 0:p.filter(b=>b.name!=="Developer").map(b=>b.id))||[],isActive:n.isActive??!0,hasDeveloperAccess:n.hasDeveloperAccess??!1}:{email:"",password:"",firstName:"",lastName:"",roleIds:[],isActive:!0,hasDeveloperAccess:!1}))},[e,n]);const u=G({mutationFn:Li.create,onSuccess:()=>{i.invalidateQueries({queryKey:["users"]}),t()},onError:p=>{o((p==null?void 0:p.message)||"Fehler beim Erstellen des Benutzers")}}),h=G({mutationFn:p=>Li.update(n.id,p),onSuccess:async()=>{i.invalidateQueries({queryKey:["users"]}),await a(),t()},onError:p=>{o((p==null?void 0:p.message)||"Fehler beim Aktualisieren des Benutzers")}}),x=p=>{if(p.preventDefault(),n){const b={email:c.email,firstName:c.firstName,lastName:c.lastName,roleIds:c.roleIds,isActive:c.isActive,hasDeveloperAccess:c.hasDeveloperAccess};c.password&&(b.password=c.password),h.mutate(b)}else u.mutate({email:c.email,password:c.password,firstName:c.firstName,lastName:c.lastName,roleIds:c.roleIds,hasDeveloperAccess:c.hasDeveloperAccess})},m=p=>{d(b=>({...b,roleIds:b.roleIds.includes(p)?b.roleIds.filter(g=>g!==p):[...b.roleIds,p]}))},f=u.isPending||h.isPending;return s.jsx(qe,{isOpen:e,onClose:t,title:n?"Benutzer bearbeiten":"Neuer Benutzer",children:s.jsxs("form",{onSubmit:x,className:"space-y-4",children:[l&&s.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3 flex items-start gap-2",children:[s.jsx(hs,{className:"w-5 h-5 text-red-500 flex-shrink-0 mt-0.5"}),s.jsx("p",{className:"text-red-700 text-sm",children:l})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(H,{label:"Vorname *",value:c.firstName,onChange:p=>d({...c,firstName:p.target.value}),required:!0}),s.jsx(H,{label:"Nachname *",value:c.lastName,onChange:p=>d({...c,lastName:p.target.value}),required:!0})]}),s.jsx(H,{label:"E-Mail *",type:"email",value:c.email,onChange:p=>d({...c,email:p.target.value}),required:!0}),s.jsx(H,{label:n?"Neues Passwort (leer = unverändert)":"Passwort *",type:"password",value:c.password,onChange:p=>d({...c,password:p.target.value}),required:!n}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Rollen"}),s.jsxs("div",{className:"space-y-2",children:[r.filter(p=>p.name!=="Developer").map(p=>s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:c.roleIds.includes(p.id),onChange:()=>m(p.id),className:"rounded"}),s.jsx("span",{children:p.name}),p.description&&s.jsxs("span",{className:"text-sm text-gray-500",children:["(",p.description,")"]})]},p.id)),s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:c.hasDeveloperAccess,onChange:p=>d({...c,hasDeveloperAccess:p.target.checked}),className:"rounded border-purple-300 text-purple-600 focus:ring-purple-500"}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Fc,{className:"w-4 h-4 text-purple-600"}),"Entwicklerzugriff"]}),s.jsx("span",{className:"text-sm text-gray-500",children:"(Datenbanktools)"})]})]}),n&&s.jsxs("p",{className:"mt-2 text-xs text-amber-600 flex items-center gap-1",children:[s.jsx(hs,{className:"w-3 h-3"}),"Bei Rollenänderung wird der Benutzer automatisch ausgeloggt."]})]}),n&&s.jsx("div",{className:"space-y-3 pt-3 border-t",children:s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:c.isActive,onChange:p=>d({...c,isActive:p.target.checked}),className:"rounded"}),"Aktiv"]})}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:f,children:f?"Speichern...":"Speichern"})]})]})})}function i4(){const{hasPermission:e,developerMode:t,setDeveloperMode:n}=We(),r=[{to:"/settings/users",icon:W2,title:"Benutzer",description:"Verwalten Sie Benutzerkonten, Rollen und Berechtigungen.",show:e("users:read")},{to:"/settings/platforms",icon:Q2,title:"Vertriebsplattformen",description:"Verwalten Sie die Plattformen, über die Verträge abgeschlossen werden.",show:e("platforms:read")},{to:"/settings/cancellation-periods",icon:on,title:"Kündigungsfristen",description:"Konfigurieren Sie die verfügbaren Kündigungsfristen für Verträge.",show:e("platforms:read")},{to:"/settings/contract-durations",icon:kv,title:"Vertragslaufzeiten",description:"Konfigurieren Sie die verfügbaren Laufzeiten für Verträge.",show:e("platforms:read")},{to:"/settings/providers",icon:A2,title:"Anbieter & Tarife",description:"Verwalten Sie Anbieter und deren Tarife für Verträge.",show:e("providers:read")||e("platforms:read")},{to:"/settings/contract-categories",icon:I2,title:"Vertragstypen",description:"Konfigurieren Sie die verfügbaren Vertragstypen (Strom, Gas, Mobilfunk, etc.).",show:e("platforms:read")}];return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[s.jsx(Tv,{className:"w-6 h-6"}),s.jsx("h1",{className:"text-2xl font-bold",children:"Einstellungen"})]}),s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-lg font-semibold mb-4 text-gray-700",children:"Stammdaten"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:r.filter(a=>a.show).map(a=>s.jsx(ke,{to:a.to,className:"block p-4 bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md hover:border-blue-300 transition-all group",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors",children:s.jsx(a.icon,{className:"w-6 h-6 text-blue-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("h3",{className:"font-semibold text-gray-900 group-hover:text-blue-600 transition-colors flex items-center gap-2",children:[a.title,s.jsx(Ft,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:a.description})]})]})},a.to))})]}),e("settings:update")&&s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-lg font-semibold mb-4 text-gray-700",children:"System"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(ke,{to:"/settings/portal",className:"block p-4 bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md hover:border-blue-300 transition-all group",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors",children:s.jsx(uh,{className:"w-6 h-6 text-blue-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("h3",{className:"font-semibold text-gray-900 group-hover:text-blue-600 transition-colors flex items-center gap-2",children:["Kundenportal",s.jsx(Ft,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Konfigurieren Sie das Kundenportal und Support-Anfragen."})]})]})}),s.jsx(ke,{to:"/settings/deadlines",className:"block p-4 bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md hover:border-blue-300 transition-all group",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors",children:s.jsx(on,{className:"w-6 h-6 text-blue-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("h3",{className:"font-semibold text-gray-900 group-hover:text-blue-600 transition-colors flex items-center gap-2",children:["Fristenschwellen",s.jsx(Ft,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Konfigurieren Sie die Farbkodierung für Vertragsfristen im Cockpit."})]})]})}),s.jsx(ke,{to:"/settings/email-providers",className:"block p-4 bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md hover:border-blue-300 transition-all group",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors",children:s.jsx(nn,{className:"w-6 h-6 text-blue-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("h3",{className:"font-semibold text-gray-900 group-hover:text-blue-600 transition-colors flex items-center gap-2",children:["Email-Provisionierung",s.jsx(Ft,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Konfigurieren Sie die automatische E-Mail-Erstellung für Stressfrei-Wechseln Adressen."})]})]})}),s.jsx(ke,{to:"/settings/database-backup",className:"block p-4 bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md hover:border-blue-300 transition-all group",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors",children:s.jsx(Ic,{className:"w-6 h-6 text-blue-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("h3",{className:"font-semibold text-gray-900 group-hover:text-blue-600 transition-colors flex items-center gap-2",children:["Datenbank & Zurücksetzen",s.jsx(Ft,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Backups erstellen, wiederherstellen oder auf Werkseinstellungen zurücksetzen."})]})]})})]})]}),s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-lg font-semibold mb-4 text-gray-700",children:"Persönlich"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:s.jsx(ke,{to:"/settings/view",className:"block p-4 bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md hover:border-blue-300 transition-all group",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors",children:s.jsx(Ae,{className:"w-6 h-6 text-blue-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("h3",{className:"font-semibold text-gray-900 group-hover:text-blue-600 transition-colors flex items-center gap-2",children:["Ansicht",s.jsx(Ft,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Passen Sie die Darstellung der Anwendung an."})]})]})})})]}),e("developer:access")&&s.jsxs(X,{title:"Entwickleroptionen",className:"mb-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Fc,{className:"w-5 h-5 text-gray-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:"Entwicklermodus"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Aktiviert erweiterte Funktionen wie direkten Datenbankzugriff"})]})]}),s.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:t,onChange:a=>n(a.target.checked),className:"sr-only peer"}),s.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"})]})]}),t&&s.jsx("div",{className:"mt-4 p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:s.jsxs("p",{className:"text-sm text-yellow-800",children:[s.jsx("strong",{children:"Warnung:"})," Der Entwicklermodus ermöglicht direkten Zugriff auf die Datenbank. Unsachgemäße Änderungen können zu Datenverlust oder Inkonsistenzen führen."]})})]}),s.jsx(X,{title:"Über",children:s.jsxs("dl",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Version"}),s.jsx("dd",{children:"1.0.0"})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"System"}),s.jsx("dd",{children:"OpenCRM"})]})]})})]})}function l4({onSelectTable:e}){const t=j.useRef(null),[n,r]=j.useState(1),[a,i]=j.useState({x:0,y:0}),[l,o]=j.useState(!1),[c,d]=j.useState({x:0,y:0}),[u,h]=j.useState({}),[x,m]=j.useState(null),{data:f,isLoading:p}=fe({queryKey:["developer-schema"],queryFn:Ci.getSchema}),b=(f==null?void 0:f.data)||[];j.useEffect(()=>{if(b.length>0&&Object.keys(u).length===0){const w=Math.ceil(Math.sqrt(b.length)),S={x:280,y:200},A={};b.forEach((O,R)=>{const q=R%w,D=Math.floor(R/w);A[O.name]={x:50+q*S.x,y:50+D*S.y}}),h(A)}},[b,u]);const g=j.useCallback(w=>{(w.target===w.currentTarget||w.target.tagName==="svg")&&(o(!0),d({x:w.clientX-a.x,y:w.clientY-a.y}))},[a]),y=j.useCallback(w=>{var S;if(l&&!x)i({x:w.clientX-c.x,y:w.clientY-c.y});else if(x){const A=(S=t.current)==null?void 0:S.getBoundingClientRect();A&&h(O=>({...O,[x]:{x:(w.clientX-A.left-a.x)/n-100,y:(w.clientY-A.top-a.y)/n-20}}))}},[l,x,c,a,n]),v=j.useCallback(()=>{o(!1),m(null)},[]),N=w=>{r(S=>Math.min(2,Math.max(.3,S+w)))},E=()=>{r(1),i({x:0,y:0})},P=j.useCallback(()=>{const w=[];return b.forEach(S=>{const A=u[S.name];A&&S.foreignKeys.forEach(O=>{const R=u[O.targetTable];if(!R)return;const q=b.find(z=>z.name===O.targetTable),D=q==null?void 0:q.relations.find(z=>z.targetTable===S.name);w.push({from:{table:S.name,x:A.x+100,y:A.y+60},to:{table:O.targetTable,x:R.x+100,y:R.y+60},type:(D==null?void 0:D.type)||"one",label:O.field})})}),w},[b,u]);if(p)return s.jsx("div",{className:"flex items-center justify-center h-full",children:"Laden..."});const I=P();return s.jsxs("div",{className:"relative h-full w-full bg-gray-50 overflow-hidden",ref:t,children:[s.jsxs("div",{className:"absolute top-4 right-4 z-10 flex gap-2 bg-white rounded-lg shadow-md p-2",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>N(.1),title:"Vergrößern",children:s.jsx(Z2,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>N(-.1),title:"Verkleinern",children:s.jsx(J2,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:E,title:"Zurücksetzen",children:s.jsx(B2,{className:"w-4 h-4"})}),s.jsxs("div",{className:"text-xs text-gray-500 flex items-center px-2",children:[Math.round(n*100),"%"]})]}),s.jsxs("div",{className:"absolute top-4 left-4 z-10 bg-white rounded-lg shadow-md p-2 text-xs text-gray-500",children:[s.jsx(U2,{className:"w-3 h-3 inline mr-1"}),"Tabellen ziehen zum Verschieben"]}),s.jsx("svg",{className:"w-full h-full cursor-grab",style:{cursor:l?"grabbing":"grab"},onMouseDown:g,onMouseMove:y,onMouseUp:v,onMouseLeave:v,children:s.jsxs("g",{transform:`translate(${a.x}, ${a.y}) scale(${n})`,children:[s.jsxs("defs",{children:[s.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:"9",refY:"3.5",orient:"auto",children:s.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#6b7280"})}),s.jsx("marker",{id:"many-marker",markerWidth:"12",markerHeight:"12",refX:"6",refY:"6",orient:"auto",children:s.jsx("circle",{cx:"6",cy:"6",r:"3",fill:"#6b7280"})})]}),I.map((w,S)=>{const A=w.to.x-w.from.x,O=w.to.y-w.from.y,R=w.from.x+A/2,q=w.from.y+O/2,D=w.from.x+A*.25,z=w.from.y,k=w.from.x+A*.75,K=w.to.y;return s.jsxs("g",{children:[s.jsx("path",{d:`M ${w.from.x} ${w.from.y} C ${D} ${z}, ${k} ${K}, ${w.to.x} ${w.to.y}`,fill:"none",stroke:"#9ca3af",strokeWidth:"2",markerEnd:"url(#arrowhead)"}),s.jsx("text",{x:R,y:q-8,fontSize:"10",fill:"#6b7280",textAnchor:"middle",className:"select-none",children:w.type==="many"?"1:n":"1:1"})]},S)}),b.map(w=>{const S=u[w.name];if(!S)return null;const A=200,O=32,R=20,q=[...new Set([w.primaryKey,...w.foreignKeys.map(z=>z.field)])],D=O+Math.min(q.length,5)*R+8;return s.jsxs("g",{transform:`translate(${S.x}, ${S.y})`,style:{cursor:"move"},onMouseDown:z=>{z.stopPropagation(),m(w.name)},children:[s.jsx("rect",{x:"3",y:"3",width:A,height:D,rx:"6",fill:"rgba(0,0,0,0.1)"}),s.jsx("rect",{x:"0",y:"0",width:A,height:D,rx:"6",fill:"white",stroke:"#e5e7eb",strokeWidth:"1"}),s.jsx("rect",{x:"0",y:"0",width:A,height:O,rx:"6",fill:"#3b82f6",className:"cursor-pointer",onClick:()=>e==null?void 0:e(w.name)}),s.jsx("rect",{x:"0",y:O-6,width:A,height:"6",fill:"#3b82f6"}),s.jsx("text",{x:A/2,y:"21",fontSize:"13",fontWeight:"bold",fill:"white",textAnchor:"middle",className:"select-none pointer-events-none",children:w.name}),q.slice(0,5).map((z,k)=>{const K=z===w.primaryKey||w.primaryKey.includes(z),B=w.foreignKeys.some(_=>_.field===z);return s.jsx("g",{transform:`translate(8, ${O+4+k*R})`,children:s.jsxs("text",{x:"0",y:"14",fontSize:"11",fill:K?"#dc2626":B?"#2563eb":"#374151",fontFamily:"monospace",className:"select-none",children:[K&&"🔑 ",B&&!K&&"🔗 ",z]})},z)}),q.length>5&&s.jsxs("text",{x:A/2,y:D-4,fontSize:"10",fill:"#9ca3af",textAnchor:"middle",className:"select-none",children:["+",q.length-5," mehr..."]})]},w.name)})]})}),s.jsxs("div",{className:"absolute bottom-4 left-4 bg-white rounded-lg shadow-md p-3 text-xs",children:[s.jsx("div",{className:"font-medium mb-2",children:"Legende"}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-red-600",children:"🔑"}),s.jsx("span",{children:"Primary Key"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-blue-600",children:"🔗"}),s.jsx("span",{children:"Foreign Key"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-0.5 bg-gray-400"}),s.jsx("span",{children:"Beziehung"})]})]})]})]})}function o4(){var I;const[e,t]=j.useState(null),[n,r]=j.useState(1),[a,i]=j.useState(null),[l,o]=j.useState(!1),c=ge(),{data:d,isLoading:u,error:h}=fe({queryKey:["developer-schema"],queryFn:Ci.getSchema});console.log("Schema data:",d),console.log("Schema error:",h);const{data:x,isLoading:m}=fe({queryKey:["developer-table",e,n],queryFn:()=>Ci.getTableData(e,n),enabled:!!e}),f=G({mutationFn:({tableName:w,id:S,data:A})=>Ci.updateRow(w,S,A),onSuccess:()=>{c.invalidateQueries({queryKey:["developer-table",e]}),i(null)},onError:w=>{var S,A;alert(((A=(S=w.response)==null?void 0:S.data)==null?void 0:A.error)||"Fehler beim Speichern")}}),p=G({mutationFn:({tableName:w,id:S})=>Ci.deleteRow(w,S),onSuccess:()=>{c.invalidateQueries({queryKey:["developer-table",e]})},onError:w=>{var S,A;alert(((A=(S=w.response)==null?void 0:S.data)==null?void 0:A.error)||"Fehler beim Löschen")}}),b=(d==null?void 0:d.data)||[],g=b.find(w=>w.name===e),y=(w,S)=>S.primaryKey.includes(",")?S.primaryKey.split(",").map(A=>w[A]).join("-"):String(w[S.primaryKey]),v=w=>w==null?"-":typeof w=="boolean"?w?"Ja":"Nein":typeof w=="object"?w instanceof Date||typeof w=="string"&&w.match(/^\d{4}-\d{2}-\d{2}/)?new Date(w).toLocaleString("de-DE"):JSON.stringify(w):String(w),N=()=>{!a||!e||f.mutate({tableName:e,id:a.id,data:a.data})},E=w=>{e&&confirm("Datensatz wirklich löschen?")&&p.mutate({tableName:e,id:w})};if(u)return s.jsx("div",{className:"text-center py-8",children:"Laden..."});const P=w=>{t(w),r(1),o(!1)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ic,{className:"w-6 h-6"}),s.jsx("h1",{className:"text-2xl font-bold",children:"Datenbankstruktur"})]}),s.jsxs(T,{onClick:()=>o(!0),children:[s.jsx(hx,{className:"w-4 h-4 mr-2"}),"ER-Diagramm"]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[s.jsx(X,{title:"Tabellen",className:"lg:col-span-1",children:s.jsx("div",{className:"space-y-1 max-h-[600px] overflow-y-auto",children:b.map(w=>s.jsxs("button",{onClick:()=>{t(w.name),r(1)},className:`w-full text-left px-3 py-2 rounded-lg flex items-center gap-2 transition-colors ${e===w.name?"bg-blue-100 text-blue-700":"hover:bg-gray-100"}`,children:[s.jsx(H2,{className:"w-4 h-4"}),s.jsx("span",{className:"text-sm font-mono",children:w.name})]},w.name))})}),s.jsx("div",{className:"lg:col-span-3 space-y-6",children:e&&g?s.jsxs(s.Fragment,{children:[s.jsxs(X,{title:`${e} - Beziehungen`,children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium text-gray-500 mb-2",children:"Fremdschlüssel (referenziert)"}),g.foreignKeys.length>0?s.jsx("div",{className:"space-y-1",children:g.foreignKeys.map(w=>s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"font-mono text-gray-600",children:w.field}),s.jsx(wv,{className:"w-4 h-4 text-gray-400"}),s.jsx(ve,{variant:"info",className:"cursor-pointer",onClick:()=>{t(w.targetTable),r(1)},children:w.targetTable})]},w.field))}):s.jsx("p",{className:"text-sm text-gray-400",children:"Keine"})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium text-gray-500 mb-2",children:"Relationen (wird referenziert von)"}),g.relations.length>0?s.jsx("div",{className:"space-y-1",children:g.relations.map(w=>s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"font-mono text-gray-600",children:w.field}),s.jsx(ve,{variant:w.type==="many"?"warning":"default",children:w.type==="many"?"1:n":"1:1"}),s.jsx(ve,{variant:"info",className:"cursor-pointer",onClick:()=>{t(w.targetTable),r(1)},children:w.targetTable})]},w.field))}):s.jsx("p",{className:"text-sm text-gray-400",children:"Keine"})]})]}),s.jsx("div",{className:"mt-4 pt-4 border-t",children:s.jsxs("div",{className:"flex gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"Primary Key:"})," ",s.jsx("span",{className:"font-mono",children:g.primaryKey})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"Readonly:"})," ",s.jsx("span",{className:"font-mono text-red-600",children:g.readonlyFields.join(", ")||"-"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"Required:"})," ",s.jsx("span",{className:"font-mono text-green-600",children:g.requiredFields.join(", ")||"-"})]})]})})]}),s.jsx(X,{title:`${e} - Daten`,children:m?s.jsx("div",{className:"text-center py-4",children:"Laden..."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b bg-gray-50",children:[(x==null?void 0:x.data)&&x.data.length>0&&Object.keys(x.data[0]).map(w=>s.jsxs("th",{className:"text-left py-2 px-3 font-medium text-gray-600 whitespace-nowrap",children:[w,g.readonlyFields.includes(w)&&s.jsx("span",{className:"ml-1 text-red-400 text-xs",children:"*"}),g.requiredFields.includes(w)&&s.jsx("span",{className:"ml-1 text-green-400 text-xs",children:"!"})]},w)),s.jsx("th",{className:"text-right py-2 px-3 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsxs("tbody",{children:[(I=x==null?void 0:x.data)==null?void 0:I.map(w=>{const S=y(w,g);return s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[Object.entries(w).map(([A,O])=>s.jsx("td",{className:"py-2 px-3 font-mono text-xs max-w-[200px] truncate",children:v(O)},A)),s.jsx("td",{className:"py-2 px-3 text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex justify-end gap-1",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>i({id:S,data:{...w}}),children:s.jsx(He,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>E(S),children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})})]},S)}),(!(x!=null&&x.data)||x.data.length===0)&&s.jsx("tr",{children:s.jsx("td",{colSpan:100,className:"py-4 text-center text-gray-500",children:"Keine Daten vorhanden"})})]})]})}),(x==null?void 0:x.pagination)&&x.pagination.totalPages>1&&s.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["Seite ",x.pagination.page," von ",x.pagination.totalPages," (",x.pagination.total," Einträge)"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>r(w=>Math.max(1,w-1)),disabled:n===1,children:s.jsx(T2,{className:"w-4 h-4"})}),s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>r(w=>w+1),disabled:n>=x.pagination.totalPages,children:s.jsx(Ft,{className:"w-4 h-4"})})]})]})]})})]}):s.jsx(X,{children:s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Wähle eine Tabelle aus der Liste aus"})})})]}),s.jsx(qe,{isOpen:!!a,onClose:()=>i(null),title:`${e} bearbeiten`,children:a&&g&&s.jsxs("div",{className:"space-y-4 max-h-[60vh] overflow-y-auto",children:[Object.entries(a.data).map(([w,S])=>{const A=g.readonlyFields.includes(w),O=g.requiredFields.includes(w);return s.jsxs("div",{children:[s.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[w,A&&s.jsx("span",{className:"ml-1 text-red-400",children:"(readonly)"}),O&&s.jsx("span",{className:"ml-1 text-green-600",children:"*"})]}),A?s.jsx("div",{className:"px-3 py-2 bg-gray-100 rounded-lg font-mono text-sm",children:v(S)}):typeof S=="boolean"?s.jsxs("select",{value:String(a.data[w]),onChange:R=>i({...a,data:{...a.data,[w]:R.target.value==="true"}}),className:"w-full px-3 py-2 border rounded-lg",children:[s.jsx("option",{value:"true",children:"Ja"}),s.jsx("option",{value:"false",children:"Nein"})]}):s.jsx("input",{type:typeof S=="number"?"number":"text",value:a.data[w]??"",onChange:R=>i({...a,data:{...a.data,[w]:typeof S=="number"?R.target.value?Number(R.target.value):null:R.target.value||null}}),className:"w-full px-3 py-2 border rounded-lg font-mono text-sm",disabled:A})]},w)}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[s.jsxs(T,{variant:"secondary",onClick:()=>i(null),children:[s.jsx(qt,{className:"w-4 h-4 mr-2"}),"Abbrechen"]}),s.jsxs(T,{onClick:N,disabled:f.isPending,children:[s.jsx(Mv,{className:"w-4 h-4 mr-2"}),f.isPending?"Speichern...":"Speichern"]})]})]})}),l&&s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[s.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>o(!1)}),s.jsxs("div",{className:"relative bg-white rounded-xl shadow-2xl w-[90vw] h-[85vh] flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(hx,{className:"w-5 h-5 text-blue-600"}),s.jsx("h2",{className:"text-lg font-semibold",children:"ER-Diagramm - Datenbankbeziehungen"})]}),s.jsx("button",{onClick:()=>o(!1),className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:s.jsx(qt,{className:"w-5 h-5"})})]}),s.jsx("div",{className:"flex-1 overflow-hidden",children:s.jsx(l4,{onSelectTable:P})})]})]})]})}function c4({children:e}){const{isAuthenticated:t,isLoading:n}=We();return n?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("div",{className:"text-gray-500",children:"Laden..."})}):t?s.jsx(s.Fragment,{children:e}):s.jsx(va,{to:"/login",replace:!0})}function d4({children:e}){const{hasPermission:t,developerMode:n}=We();return!t("developer:access")||!n?s.jsx(va,{to:"/",replace:!0}):s.jsx(s.Fragment,{children:e})}function u4(){const{isAuthenticated:e,isLoading:t}=We();return t?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("div",{className:"text-gray-500",children:"Laden..."})}):s.jsxs(s.Fragment,{children:[s.jsx(w2,{}),s.jsxs(hw,{children:[s.jsx(ze,{path:"/login",element:e?s.jsx(va,{to:"/",replace:!0}):s.jsx(tk,{})}),s.jsxs(ze,{path:"/",element:s.jsx(c4,{children:s.jsx(ek,{})}),children:[s.jsx(ze,{index:!0,element:s.jsx(sk,{})}),s.jsx(ze,{path:"customers",element:s.jsx(rk,{})}),s.jsx(ze,{path:"customers/new",element:s.jsx(Rx,{})}),s.jsx(ze,{path:"customers/:id",element:s.jsx(mk,{})}),s.jsx(ze,{path:"customers/:id/edit",element:s.jsx(Rx,{})}),s.jsx(ze,{path:"contracts",element:s.jsx(Zk,{})}),s.jsx(ze,{path:"contracts/cockpit",element:s.jsx(MC,{})}),s.jsx(ze,{path:"contracts/new",element:s.jsx(Kx,{})}),s.jsx(ze,{path:"contracts/:id",element:s.jsx(bC,{})}),s.jsx(ze,{path:"contracts/:id/edit",element:s.jsx(Kx,{})}),s.jsx(ze,{path:"tasks",element:s.jsx(FC,{})}),s.jsx(ze,{path:"settings",element:s.jsx(i4,{})}),s.jsx(ze,{path:"settings/users",element:s.jsx(r4,{})}),s.jsx(ze,{path:"settings/platforms",element:s.jsx(OC,{})}),s.jsx(ze,{path:"settings/cancellation-periods",element:s.jsx($C,{})}),s.jsx(ze,{path:"settings/contract-durations",element:s.jsx(KC,{})}),s.jsx(ze,{path:"settings/providers",element:s.jsx(UC,{})}),s.jsx(ze,{path:"settings/contract-categories",element:s.jsx(GC,{})}),s.jsx(ze,{path:"settings/view",element:s.jsx(XC,{})}),s.jsx(ze,{path:"settings/portal",element:s.jsx(YC,{})}),s.jsx(ze,{path:"settings/deadlines",element:s.jsx(e4,{})}),s.jsx(ze,{path:"settings/email-providers",element:s.jsx(s4,{})}),s.jsx(ze,{path:"settings/database-backup",element:s.jsx(n4,{})}),s.jsx(ze,{path:"users",element:s.jsx(va,{to:"/settings/users",replace:!0})}),s.jsx(ze,{path:"platforms",element:s.jsx(va,{to:"/settings/platforms",replace:!0})}),s.jsx(ze,{path:"developer/database",element:s.jsx(d4,{children:s.jsx(o4,{})})})]}),s.jsx(ze,{path:"*",element:s.jsx(va,{to:"/",replace:!0})})]})]})}const m4=new Xw({defaultOptions:{queries:{retry:1,staleTime:0,gcTime:0,refetchOnMount:"always"}}});Nd.createRoot(document.getElementById("root")).render(s.jsx(Tt.StrictMode,{children:s.jsx(Yw,{client:m4,children:s.jsx(Nw,{children:s.jsx(N2,{children:s.jsxs(b2,{children:[s.jsx(u4,{}),s.jsx(V1,{position:"top-right",toastOptions:{duration:4e3,style:{background:"#363636",color:"#fff"},success:{iconTheme:{primary:"#10b981",secondary:"#fff"}},error:{iconTheme:{primary:"#ef4444",secondary:"#fff"}}}})]})})})})})); diff --git a/frontend/dist/assets/index-XQdvYOWp.js b/frontend/dist/assets/index-XQdvYOWp.js deleted file mode 100644 index 7eeb4aa8..00000000 --- a/frontend/dist/assets/index-XQdvYOWp.js +++ /dev/null @@ -1,715 +0,0 @@ -var yf=e=>{throw TypeError(e)};var Lc=(e,t,n)=>t.has(e)||yf("Cannot "+n);var M=(e,t,n)=>(Lc(e,t,"read from private field"),n?n.call(e):t.get(e)),me=(e,t,n)=>t.has(e)?yf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),te=(e,t,n,r)=>(Lc(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),be=(e,t,n)=>(Lc(e,t,"access private method"),n);var Ll=(e,t,n,r)=>({set _(a){te(e,t,a,n)},get _(){return M(e,t,r)}});function Vv(e,t){for(var n=0;nr[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function Qv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tg={exports:{}},nc={},sg={exports:{}},Ee={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var jl=Symbol.for("react.element"),Hv=Symbol.for("react.portal"),Wv=Symbol.for("react.fragment"),Gv=Symbol.for("react.strict_mode"),Zv=Symbol.for("react.profiler"),Jv=Symbol.for("react.provider"),Xv=Symbol.for("react.context"),Yv=Symbol.for("react.forward_ref"),ej=Symbol.for("react.suspense"),tj=Symbol.for("react.memo"),sj=Symbol.for("react.lazy"),vf=Symbol.iterator;function nj(e){return e===null||typeof e!="object"?null:(e=vf&&e[vf]||e["@@iterator"],typeof e=="function"?e:null)}var ng={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},rg=Object.assign,ag={};function Ya(e,t,n){this.props=e,this.context=t,this.refs=ag,this.updater=n||ng}Ya.prototype.isReactComponent={};Ya.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ya.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ig(){}ig.prototype=Ya.prototype;function Ju(e,t,n){this.props=e,this.context=t,this.refs=ag,this.updater=n||ng}var Xu=Ju.prototype=new ig;Xu.constructor=Ju;rg(Xu,Ya.prototype);Xu.isPureReactComponent=!0;var jf=Array.isArray,lg=Object.prototype.hasOwnProperty,Yu={current:null},og={key:!0,ref:!0,__self:!0,__source:!0};function cg(e,t,n){var r,a={},i=null,l=null;if(t!=null)for(r in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(i=""+t.key),t)lg.call(t,r)&&!og.hasOwnProperty(r)&&(a[r]=t[r]);var o=arguments.length-2;if(o===1)a.children=n;else if(1>>1,de=B[le];if(0>>1;le<_e;){var qe=2*(le+1)-1,st=B[qe],C=qe+1,nt=B[C];if(0>a(st,Q))Ca(nt,st)?(B[le]=nt,B[C]=Q,le=C):(B[le]=st,B[qe]=Q,le=qe);else if(Ca(nt,Q))B[le]=nt,B[C]=Q,le=C;else break e}}return _}function a(B,_){var Q=B.sortIndex-_.sortIndex;return Q!==0?Q:B.id-_.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,o=l.now();e.unstable_now=function(){return l.now()-o}}var c=[],d=[],u=1,h=null,x=3,m=!1,f=!1,p=!1,b=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(B){for(var _=n(d);_!==null;){if(_.callback===null)r(d);else if(_.startTime<=B)r(d),_.sortIndex=_.expirationTime,t(c,_);else break;_=n(d)}}function N(B){if(p=!1,v(B),!f)if(n(c)!==null)f=!0,k(E);else{var _=n(d);_!==null&&K(N,_.startTime-B)}}function E(B,_){f=!1,p&&(p=!1,g(w),w=-1),m=!0;var Q=x;try{for(v(_),h=n(c);h!==null&&(!(h.expirationTime>_)||B&&!O());){var le=h.callback;if(typeof le=="function"){h.callback=null,x=h.priorityLevel;var de=le(h.expirationTime<=_);_=e.unstable_now(),typeof de=="function"?h.callback=de:h===n(c)&&r(c),v(_)}else r(c);h=n(c)}if(h!==null)var _e=!0;else{var qe=n(d);qe!==null&&K(N,qe.startTime-_),_e=!1}return _e}finally{h=null,x=Q,m=!1}}var A=!1,I=null,w=-1,S=5,P=-1;function O(){return!(e.unstable_now()-PB||125le?(B.sortIndex=Q,t(d,B),n(c)===null&&B===n(d)&&(p?(g(w),w=-1):p=!0,K(N,Q-le))):(B.sortIndex=de,t(c,B),f||m||(f=!0,k(E))),B},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(B){var _=x;return function(){var Q=x;x=_;try{return B.apply(this,arguments)}finally{x=Q}}}})(fg);hg.exports=fg;var pj=hg.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var xj=j,js=pj;function Y(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bd=Object.prototype.hasOwnProperty,gj=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Nf={},wf={};function yj(e){return bd.call(wf,e)?!0:bd.call(Nf,e)?!1:gj.test(e)?wf[e]=!0:(Nf[e]=!0,!1)}function vj(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function jj(e,t,n,r){if(t===null||typeof t>"u"||vj(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Xt(e,t,n,r,a,i,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=l}var Lt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Lt[e]=new Xt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Lt[t]=new Xt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Lt[e]=new Xt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Lt[e]=new Xt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Lt[e]=new Xt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Lt[e]=new Xt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Lt[e]=new Xt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Lt[e]=new Xt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Lt[e]=new Xt(e,5,!1,e.toLowerCase(),null,!1,!1)});var tm=/[\-:]([a-z])/g;function sm(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(tm,sm);Lt[t]=new Xt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(tm,sm);Lt[t]=new Xt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(tm,sm);Lt[t]=new Xt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Lt[e]=new Xt(e,1,!1,e.toLowerCase(),null,!1,!1)});Lt.xlinkHref=new Xt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Lt[e]=new Xt(e,1,!1,e.toLowerCase(),null,!0,!0)});function nm(e,t,n,r){var a=Lt.hasOwnProperty(t)?Lt[t]:null;(a!==null?a.type!==0:r||!(2o||a[l]!==i[o]){var c=` -`+a[l].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=l&&0<=o);break}}}finally{$c=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ji(e):""}function bj(e){switch(e.tag){case 5:return ji(e.type);case 16:return ji("Lazy");case 13:return ji("Suspense");case 19:return ji("SuspenseList");case 0:case 2:case 15:return e=_c(e.type,!1),e;case 11:return e=_c(e.type.render,!1),e;case 1:return e=_c(e.type,!0),e;default:return""}}function kd(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case oa:return"Fragment";case la:return"Portal";case Nd:return"Profiler";case rm:return"StrictMode";case wd:return"Suspense";case Sd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case gg:return(e.displayName||"Context")+".Consumer";case xg:return(e._context.displayName||"Context")+".Provider";case am:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case im:return t=e.displayName||null,t!==null?t:kd(e.type)||"Memo";case $n:t=e._payload,e=e._init;try{return kd(e(t))}catch{}}return null}function Nj(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return kd(t);case 8:return t===rm?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function fr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function vg(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function wj(e){var t=vg(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(l){r=""+l,i.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(l){r=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function $l(e){e._valueTracker||(e._valueTracker=wj(e))}function jg(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=vg(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function wo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Cd(e,t){var n=t.checked;return ot({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function kf(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=fr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function bg(e,t){t=t.checked,t!=null&&nm(e,"checked",t,!1)}function Ed(e,t){bg(e,t);var n=fr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Dd(e,t.type,n):t.hasOwnProperty("defaultValue")&&Dd(e,t.type,fr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Cf(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Dd(e,t,n){(t!=="number"||wo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var bi=Array.isArray;function ja(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=_l.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function $i(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ci={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Sj=["Webkit","ms","Moz","O"];Object.keys(Ci).forEach(function(e){Sj.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ci[t]=Ci[e]})});function kg(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ci.hasOwnProperty(e)&&Ci[e]?(""+t).trim():t+"px"}function Cg(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=kg(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var kj=ot({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Md(e,t){if(t){if(kj[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Y(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Y(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Y(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Y(62))}}function Td(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Fd=null;function lm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Id=null,ba=null,Na=null;function Pf(e){if(e=wl(e)){if(typeof Id!="function")throw Error(Y(280));var t=e.stateNode;t&&(t=oc(t),Id(e.stateNode,e.type,t))}}function Eg(e){ba?Na?Na.push(e):Na=[e]:ba=e}function Dg(){if(ba){var e=ba,t=Na;if(Na=ba=null,Pf(e),t)for(e=0;e>>=0,e===0?32:31-(Lj(e)/Oj|0)|0}var Kl=64,Bl=4194304;function Ni(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Eo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,a=e.suspendedLanes,i=e.pingedLanes,l=n&268435455;if(l!==0){var o=l&~a;o!==0?r=Ni(o):(i&=l,i!==0&&(r=Ni(i)))}else l=n&~a,l!==0?r=Ni(l):i!==0&&(r=Ni(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&a)&&(a=r&-r,i=t&-t,a>=i||a===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function bl(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Bs(t),e[t]=n}function Kj(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Di),zf=" ",$f=!1;function Wg(e,t){switch(e){case"keyup":return pb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ca=!1;function gb(e,t){switch(e){case"compositionend":return Gg(t);case"keypress":return t.which!==32?null:($f=!0,zf);case"textInput":return e=t.data,e===zf&&$f?null:e;default:return null}}function yb(e,t){if(ca)return e==="compositionend"||!pm&&Wg(e,t)?(e=Qg(),lo=mm=tr=null,ca=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Uf(n)}}function Yg(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Yg(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ey(){for(var e=window,t=wo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=wo(e.document)}return t}function xm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Eb(e){var t=ey(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Yg(n.ownerDocument.documentElement,n)){if(r!==null&&xm(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,i=Math.min(r.start,a);r=r.end===void 0?i:Math.min(r.end,a),!e.extend&&i>r&&(a=r,r=i,i=a),a=qf(n,i);var l=qf(n,r);a&&l&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,da=null,_d=null,Ai=null,Kd=!1;function Vf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Kd||da==null||da!==wo(r)||(r=da,"selectionStart"in r&&xm(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ai&&Vi(Ai,r)||(Ai=r,r=Ao(_d,"onSelect"),0ha||(e.current=Hd[ha],Hd[ha]=null,ha--)}function Qe(e,t){ha++,Hd[ha]=e.current,e.current=t}var pr={},Ut=yr(pr),os=yr(!1),qr=pr;function qa(e,t){var n=e.type.contextTypes;if(!n)return pr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in n)a[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function cs(e){return e=e.childContextTypes,e!=null}function To(){Ze(os),Ze(Ut)}function Xf(e,t,n){if(Ut.current!==pr)throw Error(Y(168));Qe(Ut,t),Qe(os,n)}function cy(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var a in r)if(!(a in t))throw Error(Y(108,Nj(e)||"Unknown",a));return ot({},n,r)}function Fo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pr,qr=Ut.current,Qe(Ut,e),Qe(os,os.current),!0}function Yf(e,t,n){var r=e.stateNode;if(!r)throw Error(Y(169));n?(e=cy(e,t,qr),r.__reactInternalMemoizedMergedChildContext=e,Ze(os),Ze(Ut),Qe(Ut,e)):Ze(os),Qe(os,n)}var pn=null,cc=!1,ed=!1;function dy(e){pn===null?pn=[e]:pn.push(e)}function $b(e){cc=!0,dy(e)}function vr(){if(!ed&&pn!==null){ed=!0;var e=0,t=Be;try{var n=pn;for(Be=1;e>=l,a-=l,bn=1<<32-Bs(t)+a|n<w?(S=I,I=null):S=I.sibling;var P=x(g,I,v[w],N);if(P===null){I===null&&(I=S);break}e&&I&&P.alternate===null&&t(g,I),y=i(P,y,w),A===null?E=P:A.sibling=P,A=P,I=S}if(w===v.length)return n(g,I),tt&&Nr(g,w),E;if(I===null){for(;ww?(S=I,I=null):S=I.sibling;var O=x(g,I,P.value,N);if(O===null){I===null&&(I=S);break}e&&I&&O.alternate===null&&t(g,I),y=i(O,y,w),A===null?E=O:A.sibling=O,A=O,I=S}if(P.done)return n(g,I),tt&&Nr(g,w),E;if(I===null){for(;!P.done;w++,P=v.next())P=h(g,P.value,N),P!==null&&(y=i(P,y,w),A===null?E=P:A.sibling=P,A=P);return tt&&Nr(g,w),E}for(I=r(g,I);!P.done;w++,P=v.next())P=m(I,g,w,P.value,N),P!==null&&(e&&P.alternate!==null&&I.delete(P.key===null?w:P.key),y=i(P,y,w),A===null?E=P:A.sibling=P,A=P);return e&&I.forEach(function(R){return t(g,R)}),tt&&Nr(g,w),E}function b(g,y,v,N){if(typeof v=="object"&&v!==null&&v.type===oa&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case zl:e:{for(var E=v.key,A=y;A!==null;){if(A.key===E){if(E=v.type,E===oa){if(A.tag===7){n(g,A.sibling),y=a(A,v.props.children),y.return=g,g=y;break e}}else if(A.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===$n&&sp(E)===A.type){n(g,A.sibling),y=a(A,v.props),y.ref=pi(g,A,v),y.return=g,g=y;break e}n(g,A);break}else t(g,A);A=A.sibling}v.type===oa?(y=Kr(v.props.children,g.mode,N,v.key),y.return=g,g=y):(N=xo(v.type,v.key,v.props,null,g.mode,N),N.ref=pi(g,y,v),N.return=g,g=N)}return l(g);case la:e:{for(A=v.key;y!==null;){if(y.key===A)if(y.tag===4&&y.stateNode.containerInfo===v.containerInfo&&y.stateNode.implementation===v.implementation){n(g,y.sibling),y=a(y,v.children||[]),y.return=g,g=y;break e}else{n(g,y);break}else t(g,y);y=y.sibling}y=od(v,g.mode,N),y.return=g,g=y}return l(g);case $n:return A=v._init,b(g,y,A(v._payload),N)}if(bi(v))return f(g,y,v,N);if(di(v))return p(g,y,v,N);Gl(g,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,y!==null&&y.tag===6?(n(g,y.sibling),y=a(y,v),y.return=g,g=y):(n(g,y),y=ld(v,g.mode,N),y.return=g,g=y),l(g)):n(g,y)}return b}var Qa=fy(!0),py=fy(!1),Lo=yr(null),Oo=null,xa=null,jm=null;function bm(){jm=xa=Oo=null}function Nm(e){var t=Lo.current;Ze(Lo),e._currentValue=t}function Zd(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Sa(e,t){Oo=e,jm=xa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ls=!0),e.firstContext=null)}function Ts(e){var t=e._currentValue;if(jm!==e)if(e={context:e,memoizedValue:t,next:null},xa===null){if(Oo===null)throw Error(Y(308));xa=e,Oo.dependencies={lanes:0,firstContext:e}}else xa=xa.next=e;return t}var Cr=null;function wm(e){Cr===null?Cr=[e]:Cr.push(e)}function xy(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,wm(t)):(n.next=a.next,a.next=n),t.interleaved=n,Dn(e,r)}function Dn(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var _n=!1;function Sm(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function gy(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Sn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function or(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Te&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Dn(e,n)}return a=r.interleaved,a===null?(t.next=t,wm(r)):(t.next=a.next,a.next=t),r.interleaved=t,Dn(e,n)}function co(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,cm(e,n)}}function np(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?a=i=l:i=i.next=l,n=n.next}while(n!==null);i===null?a=i=t:i=i.next=t}else a=i=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function zo(e,t,n,r){var a=e.updateQueue;_n=!1;var i=a.firstBaseUpdate,l=a.lastBaseUpdate,o=a.shared.pending;if(o!==null){a.shared.pending=null;var c=o,d=c.next;c.next=null,l===null?i=d:l.next=d,l=c;var u=e.alternate;u!==null&&(u=u.updateQueue,o=u.lastBaseUpdate,o!==l&&(o===null?u.firstBaseUpdate=d:o.next=d,u.lastBaseUpdate=c))}if(i!==null){var h=a.baseState;l=0,u=d=c=null,o=i;do{var x=o.lane,m=o.eventTime;if((r&x)===x){u!==null&&(u=u.next={eventTime:m,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var f=e,p=o;switch(x=t,m=n,p.tag){case 1:if(f=p.payload,typeof f=="function"){h=f.call(m,h,x);break e}h=f;break e;case 3:f.flags=f.flags&-65537|128;case 0:if(f=p.payload,x=typeof f=="function"?f.call(m,h,x):f,x==null)break e;h=ot({},h,x);break e;case 2:_n=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,x=a.effects,x===null?a.effects=[o]:x.push(o))}else m={eventTime:m,lane:x,tag:o.tag,payload:o.payload,callback:o.callback,next:null},u===null?(d=u=m,c=h):u=u.next=m,l|=x;if(o=o.next,o===null){if(o=a.shared.pending,o===null)break;x=o,o=x.next,x.next=null,a.lastBaseUpdate=x,a.shared.pending=null}}while(!0);if(u===null&&(c=h),a.baseState=c,a.firstBaseUpdate=d,a.lastBaseUpdate=u,t=a.shared.interleaved,t!==null){a=t;do l|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);Hr|=l,e.lanes=l,e.memoizedState=h}}function rp(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=sd.transition;sd.transition={};try{e(!1),t()}finally{Be=n,sd.transition=r}}function Iy(){return Fs().memoizedState}function Ub(e,t,n){var r=dr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ry(e))Ly(t,n);else if(n=xy(e,t,n,r),n!==null){var a=Zt();Us(n,e,r,a),Oy(n,t,r)}}function qb(e,t,n){var r=dr(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ry(e))Ly(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var l=t.lastRenderedState,o=i(l,n);if(a.hasEagerState=!0,a.eagerState=o,qs(o,l)){var c=t.interleaved;c===null?(a.next=a,wm(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=xy(e,t,a,r),n!==null&&(a=Zt(),Us(n,e,r,a),Oy(n,t,r))}}function Ry(e){var t=e.alternate;return e===it||t!==null&&t===it}function Ly(e,t){Mi=_o=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Oy(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,cm(e,n)}}var Ko={readContext:Ts,useCallback:zt,useContext:zt,useEffect:zt,useImperativeHandle:zt,useInsertionEffect:zt,useLayoutEffect:zt,useMemo:zt,useReducer:zt,useRef:zt,useState:zt,useDebugValue:zt,useDeferredValue:zt,useTransition:zt,useMutableSource:zt,useSyncExternalStore:zt,useId:zt,unstable_isNewReconciler:!1},Vb={readContext:Ts,useCallback:function(e,t){return Zs().memoizedState=[e,t===void 0?null:t],e},useContext:Ts,useEffect:ip,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,mo(4194308,4,Py.bind(null,t,e),n)},useLayoutEffect:function(e,t){return mo(4194308,4,e,t)},useInsertionEffect:function(e,t){return mo(4,2,e,t)},useMemo:function(e,t){var n=Zs();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Zs();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Ub.bind(null,it,e),[r.memoizedState,e]},useRef:function(e){var t=Zs();return e={current:e},t.memoizedState=e},useState:ap,useDebugValue:Tm,useDeferredValue:function(e){return Zs().memoizedState=e},useTransition:function(){var e=ap(!1),t=e[0];return e=Bb.bind(null,e[1]),Zs().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=it,a=Zs();if(tt){if(n===void 0)throw Error(Y(407));n=n()}else{if(n=t(),At===null)throw Error(Y(349));Qr&30||by(r,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,ip(wy.bind(null,r,i,e),[e]),r.flags|=2048,Yi(9,Ny.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Zs(),t=At.identifierPrefix;if(tt){var n=Nn,r=bn;n=(r&~(1<<32-Bs(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ji++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),n==="select"&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[tn]=t,e[Wi]=r,Hy(e,t,!1,!1),t.stateNode=e;e:{switch(l=Td(n,r),n){case"dialog":Ge("cancel",e),Ge("close",e),a=r;break;case"iframe":case"object":case"embed":Ge("load",e),a=r;break;case"video":case"audio":for(a=0;aGa&&(t.flags|=128,r=!0,xi(i,!1),t.lanes=4194304)}else{if(!r)if(e=$o(l),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),xi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!l.alternate&&!tt)return $t(t),null}else 2*ft()-i.renderingStartTime>Ga&&n!==1073741824&&(t.flags|=128,r=!0,xi(i,!1),t.lanes=4194304);i.isBackwards?(l.sibling=t.child,t.child=l):(n=i.last,n!==null?n.sibling=l:t.child=l,i.last=l)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ft(),t.sibling=null,n=at.current,Qe(at,r?n&1|2:n&1),t):($t(t),null);case 22:case 23:return zm(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ps&1073741824&&($t(t),t.subtreeFlags&6&&(t.flags|=8192)):$t(t),null;case 24:return null;case 25:return null}throw Error(Y(156,t.tag))}function Yb(e,t){switch(ym(t),t.tag){case 1:return cs(t.type)&&To(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ha(),Ze(os),Ze(Ut),Em(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Cm(t),null;case 13:if(Ze(at),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Y(340));Va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ze(at),null;case 4:return Ha(),null;case 10:return Nm(t.type._context),null;case 22:case 23:return zm(),null;case 24:return null;default:return null}}var Jl=!1,Kt=!1,eN=typeof WeakSet=="function"?WeakSet:Set,he=null;function ga(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){mt(e,t,r)}else n.current=null}function au(e,t,n){try{n()}catch(r){mt(e,t,r)}}var gp=!1;function tN(e,t){if(Bd=Do,e=ey(),xm(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var l=0,o=-1,c=-1,d=0,u=0,h=e,x=null;t:for(;;){for(var m;h!==n||a!==0&&h.nodeType!==3||(o=l+a),h!==i||r!==0&&h.nodeType!==3||(c=l+r),h.nodeType===3&&(l+=h.nodeValue.length),(m=h.firstChild)!==null;)x=h,h=m;for(;;){if(h===e)break t;if(x===n&&++d===a&&(o=l),x===i&&++u===r&&(c=l),(m=h.nextSibling)!==null)break;h=x,x=h.parentNode}h=m}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ud={focusedElem:e,selectionRange:n},Do=!1,he=t;he!==null;)if(t=he,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,he=e;else for(;he!==null;){t=he;try{var f=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(f!==null){var p=f.memoizedProps,b=f.memoizedState,g=t.stateNode,y=g.getSnapshotBeforeUpdate(t.elementType===t.type?p:Rs(t.type,p),b);g.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Y(163))}}catch(N){mt(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,he=e;break}he=t.return}return f=gp,gp=!1,f}function Ti(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&au(t,n,i)}a=a.next}while(a!==r)}}function mc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function iu(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Zy(e){var t=e.alternate;t!==null&&(e.alternate=null,Zy(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[tn],delete t[Wi],delete t[Qd],delete t[Ob],delete t[zb])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Jy(e){return e.tag===5||e.tag===3||e.tag===4}function yp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Jy(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function lu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Mo));else if(r!==4&&(e=e.child,e!==null))for(lu(e,t,n),e=e.sibling;e!==null;)lu(e,t,n),e=e.sibling}function ou(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ou(e,t,n),e=e.sibling;e!==null;)ou(e,t,n),e=e.sibling}var Mt=null,zs=!1;function On(e,t,n){for(n=n.child;n!==null;)Xy(e,t,n),n=n.sibling}function Xy(e,t,n){if(rn&&typeof rn.onCommitFiberUnmount=="function")try{rn.onCommitFiberUnmount(rc,n)}catch{}switch(n.tag){case 5:Kt||ga(n,t);case 6:var r=Mt,a=zs;Mt=null,On(e,t,n),Mt=r,zs=a,Mt!==null&&(zs?(e=Mt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Mt.removeChild(n.stateNode));break;case 18:Mt!==null&&(zs?(e=Mt,n=n.stateNode,e.nodeType===8?Yc(e.parentNode,n):e.nodeType===1&&Yc(e,n),Ui(e)):Yc(Mt,n.stateNode));break;case 4:r=Mt,a=zs,Mt=n.stateNode.containerInfo,zs=!0,On(e,t,n),Mt=r,zs=a;break;case 0:case 11:case 14:case 15:if(!Kt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var i=a,l=i.destroy;i=i.tag,l!==void 0&&(i&2||i&4)&&au(n,t,l),a=a.next}while(a!==r)}On(e,t,n);break;case 1:if(!Kt&&(ga(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){mt(n,t,o)}On(e,t,n);break;case 21:On(e,t,n);break;case 22:n.mode&1?(Kt=(r=Kt)||n.memoizedState!==null,On(e,t,n),Kt=r):On(e,t,n);break;default:On(e,t,n)}}function vp(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new eN),t.forEach(function(r){var a=dN.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function Is(e,t){var n=t.deletions;if(n!==null)for(var r=0;ra&&(a=l),r&=~i}if(r=a,r=ft()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*nN(r/1960))-r,10e?16:e,sr===null)var r=!1;else{if(e=sr,sr=null,qo=0,Te&6)throw Error(Y(331));var a=Te;for(Te|=4,he=e.current;he!==null;){var i=he,l=i.child;if(he.flags&16){var o=i.deletions;if(o!==null){for(var c=0;cft()-Lm?_r(e,0):Rm|=n),ds(e,t)}function i0(e,t){t===0&&(e.mode&1?(t=Bl,Bl<<=1,!(Bl&130023424)&&(Bl=4194304)):t=1);var n=Zt();e=Dn(e,t),e!==null&&(bl(e,t,n),ds(e,n))}function cN(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),i0(e,n)}function dN(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Y(314))}r!==null&&r.delete(t),i0(e,n)}var l0;l0=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||os.current)ls=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ls=!1,Jb(e,t,n);ls=!!(e.flags&131072)}else ls=!1,tt&&t.flags&1048576&&uy(t,Ro,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ho(e,t),e=t.pendingProps;var a=qa(t,Ut.current);Sa(t,n),a=Pm(null,t,r,e,a,n);var i=Am();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,cs(r)?(i=!0,Fo(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Sm(t),a.updater=uc,t.stateNode=a,a._reactInternals=t,Xd(t,r,e,n),t=tu(null,t,r,!0,i,n)):(t.tag=0,tt&&i&&gm(t),Gt(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ho(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=mN(r),e=Rs(r,e),a){case 0:t=eu(null,t,r,e,n);break e;case 1:t=fp(null,t,r,e,n);break e;case 11:t=mp(null,t,r,e,n);break e;case 14:t=hp(null,t,r,Rs(r.type,e),n);break e}throw Error(Y(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Rs(r,a),eu(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Rs(r,a),fp(e,t,r,a,n);case 3:e:{if(qy(t),e===null)throw Error(Y(387));r=t.pendingProps,i=t.memoizedState,a=i.element,gy(e,t),zo(t,r,null,n);var l=t.memoizedState;if(r=l.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=Wa(Error(Y(423)),t),t=pp(e,t,r,n,a);break e}else if(r!==a){a=Wa(Error(Y(424)),t),t=pp(e,t,r,n,a);break e}else for(ys=lr(t.stateNode.containerInfo.firstChild),vs=t,tt=!0,$s=null,n=py(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Va(),r===a){t=Pn(e,t,n);break e}Gt(e,t,r,n)}t=t.child}return t;case 5:return yy(t),e===null&&Gd(t),r=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,l=a.children,qd(r,a)?l=null:i!==null&&qd(r,i)&&(t.flags|=32),Uy(e,t),Gt(e,t,l,n),t.child;case 6:return e===null&&Gd(t),null;case 13:return Vy(e,t,n);case 4:return km(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Qa(t,null,r,n):Gt(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Rs(r,a),mp(e,t,r,a,n);case 7:return Gt(e,t,t.pendingProps,n),t.child;case 8:return Gt(e,t,t.pendingProps.children,n),t.child;case 12:return Gt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,i=t.memoizedProps,l=a.value,Qe(Lo,r._currentValue),r._currentValue=l,i!==null)if(qs(i.value,l)){if(i.children===a.children&&!os.current){t=Pn(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){l=i.child;for(var c=o.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=Sn(-1,n&-n),c.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Zd(i.return,n,t),o.lanes|=n;break}c=c.next}}else if(i.tag===10)l=i.type===t.type?null:i.child;else if(i.tag===18){if(l=i.return,l===null)throw Error(Y(341));l.lanes|=n,o=l.alternate,o!==null&&(o.lanes|=n),Zd(l,n,t),l=i.sibling}else l=i.child;if(l!==null)l.return=i;else for(l=i;l!==null;){if(l===t){l=null;break}if(i=l.sibling,i!==null){i.return=l.return,l=i;break}l=l.return}i=l}Gt(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,Sa(t,n),a=Ts(a),r=r(a),t.flags|=1,Gt(e,t,r,n),t.child;case 14:return r=t.type,a=Rs(r,t.pendingProps),a=Rs(r.type,a),hp(e,t,r,a,n);case 15:return Ky(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Rs(r,a),ho(e,t),t.tag=1,cs(r)?(e=!0,Fo(t)):e=!1,Sa(t,n),zy(t,r,a),Xd(t,r,a,n),tu(null,t,r,!0,e,n);case 19:return Qy(e,t,n);case 22:return By(e,t,n)}throw Error(Y(156,t.tag))};function o0(e,t){return Rg(e,t)}function uN(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ds(e,t,n,r){return new uN(e,t,n,r)}function _m(e){return e=e.prototype,!(!e||!e.isReactComponent)}function mN(e){if(typeof e=="function")return _m(e)?1:0;if(e!=null){if(e=e.$$typeof,e===am)return 11;if(e===im)return 14}return 2}function ur(e,t){var n=e.alternate;return n===null?(n=Ds(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function xo(e,t,n,r,a,i){var l=2;if(r=e,typeof e=="function")_m(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case oa:return Kr(n.children,a,i,t);case rm:l=8,a|=8;break;case Nd:return e=Ds(12,n,t,a|2),e.elementType=Nd,e.lanes=i,e;case wd:return e=Ds(13,n,t,a),e.elementType=wd,e.lanes=i,e;case Sd:return e=Ds(19,n,t,a),e.elementType=Sd,e.lanes=i,e;case yg:return fc(n,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xg:l=10;break e;case gg:l=9;break e;case am:l=11;break e;case im:l=14;break e;case $n:l=16,r=null;break e}throw Error(Y(130,e==null?e:typeof e,""))}return t=Ds(l,n,t,a),t.elementType=e,t.type=r,t.lanes=i,t}function Kr(e,t,n,r){return e=Ds(7,e,r,t),e.lanes=n,e}function fc(e,t,n,r){return e=Ds(22,e,r,t),e.elementType=yg,e.lanes=n,e.stateNode={isHidden:!1},e}function ld(e,t,n){return e=Ds(6,e,null,t),e.lanes=n,e}function od(e,t,n){return t=Ds(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function hN(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Bc(0),this.expirationTimes=Bc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bc(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Km(e,t,n,r,a,i,l,o,c){return e=new hN(e,t,n,o,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ds(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sm(i),e}function fN(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(m0)}catch(e){console.error(e)}}m0(),mg.exports=bs;var vN=mg.exports,Ep=vN;jd.createRoot=Ep.createRoot,jd.hydrateRoot=Ep.hydrateRoot;/** - * @remix-run/router v1.23.2 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function tl(){return tl=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Vm(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function bN(){return Math.random().toString(36).substr(2,8)}function Pp(e,t){return{usr:e.state,key:e.key,idx:t}}function hu(e,t,n,r){return n===void 0&&(n=null),tl({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?si(t):t,{state:n,key:t&&t.key||r||bN()})}function Ho(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function si(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function NN(e,t,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,l=a.history,o=nr.Pop,c=null,d=u();d==null&&(d=0,l.replaceState(tl({},l.state,{idx:d}),""));function u(){return(l.state||{idx:null}).idx}function h(){o=nr.Pop;let b=u(),g=b==null?null:b-d;d=b,c&&c({action:o,location:p.location,delta:g})}function x(b,g){o=nr.Push;let y=hu(p.location,b,g);d=u()+1;let v=Pp(y,d),N=p.createHref(y);try{l.pushState(v,"",N)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;a.location.assign(N)}i&&c&&c({action:o,location:p.location,delta:1})}function m(b,g){o=nr.Replace;let y=hu(p.location,b,g);d=u();let v=Pp(y,d),N=p.createHref(y);l.replaceState(v,"",N),i&&c&&c({action:o,location:p.location,delta:0})}function f(b){let g=a.location.origin!=="null"?a.location.origin:a.location.href,y=typeof b=="string"?b:Ho(b);return y=y.replace(/ $/,"%20"),lt(g,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,g)}let p={get action(){return o},get location(){return e(a,l)},listen(b){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(Dp,h),c=b,()=>{a.removeEventListener(Dp,h),c=null}},createHref(b){return t(a,b)},createURL:f,encodeLocation(b){let g=f(b);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:x,replace:m,go(b){return l.go(b)}};return p}var Ap;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Ap||(Ap={}));function wN(e,t,n){return n===void 0&&(n="/"),SN(e,t,n)}function SN(e,t,n,r){let a=typeof t=="string"?si(t):t,i=Za(a.pathname||"/",n);if(i==null)return null;let l=h0(e);kN(l);let o=null;for(let c=0;o==null&&c{let c={relativePath:o===void 0?i.path||"":o,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};c.relativePath.startsWith("/")&&(lt(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let d=mr([r,c.relativePath]),u=n.concat(c);i.children&&i.children.length>0&&(lt(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),h0(i.children,t,u,d)),!(i.path==null&&!i.index)&&t.push({path:d,score:TN(d,i.index),routesMeta:u})};return e.forEach((i,l)=>{var o;if(i.path===""||!((o=i.path)!=null&&o.includes("?")))a(i,l);else for(let c of f0(i.path))a(i,l,c)}),t}function f0(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let l=f0(r.join("/")),o=[];return o.push(...l.map(c=>c===""?i:[i,c].join("/"))),a&&o.push(...l),o.map(c=>e.startsWith("/")&&c===""?"/":c)}function kN(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:FN(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const CN=/^:[\w-]+$/,EN=3,DN=2,PN=1,AN=10,MN=-2,Mp=e=>e==="*";function TN(e,t){let n=e.split("/"),r=n.length;return n.some(Mp)&&(r+=MN),t&&(r+=DN),n.filter(a=>!Mp(a)).reduce((a,i)=>a+(CN.test(i)?EN:i===""?PN:AN),r)}function FN(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function IN(e,t,n){let{routesMeta:r}=e,a={},i="/",l=[];for(let o=0;o{let{paramName:x,isOptional:m}=u;if(x==="*"){let p=o[h]||"";l=i.slice(0,i.length-p.length).replace(/(.)\/+$/,"$1")}const f=o[h];return m&&!f?d[x]=void 0:d[x]=(f||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:l,pattern:e}}function RN(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Vm(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,o,c)=>(r.push({paramName:o,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function LN(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Vm(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Za(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const ON=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,zN=e=>ON.test(e);function $N(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?si(e):e,i;if(n)if(zN(n))i=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),Vm(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?i=Tp(n.substring(1),"/"):i=Tp(n,t)}else i=t;return{pathname:i,search:BN(r),hash:UN(a)}}function Tp(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function cd(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function _N(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Qm(e,t){let n=_N(e);return t?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Hm(e,t,n,r){r===void 0&&(r=!1);let a;typeof e=="string"?a=si(e):(a=tl({},e),lt(!a.pathname||!a.pathname.includes("?"),cd("?","pathname","search",a)),lt(!a.pathname||!a.pathname.includes("#"),cd("#","pathname","hash",a)),lt(!a.search||!a.search.includes("#"),cd("#","search","hash",a)));let i=e===""||a.pathname==="",l=i?"/":a.pathname,o;if(l==null)o=n;else{let h=t.length-1;if(!r&&l.startsWith("..")){let x=l.split("/");for(;x[0]==="..";)x.shift(),h-=1;a.pathname=x.join("/")}o=h>=0?t[h]:"/"}let c=$N(a,o),d=l&&l!=="/"&&l.endsWith("/"),u=(i||l===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}const mr=e=>e.join("/").replace(/\/\/+/g,"/"),KN=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),BN=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,UN=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function qN(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const p0=["post","put","patch","delete"];new Set(p0);const VN=["get",...p0];new Set(VN);/** - * React Router v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function sl(){return sl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{o.current=!0}),j.useCallback(function(d,u){if(u===void 0&&(u={}),!o.current)return;if(typeof d=="number"){r.go(d);return}let h=Hm(d,JSON.parse(l),i,u.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:mr([t,h.pathname])),(u.replace?r.replace:r.push)(h,u.state,u)},[t,r,l,i,e])}const WN=j.createContext(null);function GN(e){let t=j.useContext(on).outlet;return t&&j.createElement(WN.Provider,{value:e},t)}function bc(){let{matches:e}=j.useContext(on),t=e[e.length-1];return t?t.params:{}}function Nc(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=j.useContext(Fn),{matches:a}=j.useContext(on),{pathname:i}=In(),l=JSON.stringify(Qm(a,r.v7_relativeSplatPath));return j.useMemo(()=>Hm(e,JSON.parse(l),i,n==="path"),[e,l,i,n])}function ZN(e,t){return JN(e,t)}function JN(e,t,n,r){ni()||lt(!1);let{navigator:a}=j.useContext(Fn),{matches:i}=j.useContext(on),l=i[i.length-1],o=l?l.params:{};l&&l.pathname;let c=l?l.pathnameBase:"/";l&&l.route;let d=In(),u;if(t){var h;let b=typeof t=="string"?si(t):t;c==="/"||(h=b.pathname)!=null&&h.startsWith(c)||lt(!1),u=b}else u=d;let x=u.pathname||"/",m=x;if(c!=="/"){let b=c.replace(/^\//,"").split("/");m="/"+x.replace(/^\//,"").split("/").slice(b.length).join("/")}let f=wN(e,{pathname:m}),p=sw(f&&f.map(b=>Object.assign({},b,{params:Object.assign({},o,b.params),pathname:mr([c,a.encodeLocation?a.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?c:mr([c,a.encodeLocation?a.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),i,n,r);return t&&p?j.createElement(jc.Provider,{value:{location:sl({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:nr.Pop}},p):p}function XN(){let e=iw(),t=qN(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return j.createElement(j.Fragment,null,j.createElement("h2",null,"Unexpected Application Error!"),j.createElement("h3",{style:{fontStyle:"italic"}},t),n?j.createElement("pre",{style:a},n):null,null)}const YN=j.createElement(XN,null);class ew extends j.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?j.createElement(on.Provider,{value:this.props.routeContext},j.createElement(g0.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function tw(e){let{routeContext:t,match:n,children:r}=e,a=j.useContext(vc);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),j.createElement(on.Provider,{value:t},r)}function sw(e,t,n,r){var a;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,o=(a=n)==null?void 0:a.errors;if(o!=null){let u=l.findIndex(h=>h.route.id&&(o==null?void 0:o[h.route.id])!==void 0);u>=0||lt(!1),l=l.slice(0,Math.min(l.length,u+1))}let c=!1,d=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u=0?l=l.slice(0,d+1):l=[l[0]];break}}}return l.reduceRight((u,h,x)=>{let m,f=!1,p=null,b=null;n&&(m=o&&h.route.id?o[h.route.id]:void 0,p=h.route.errorElement||YN,c&&(d<0&&x===0?(ow("route-fallback"),f=!0,b=null):d===x&&(f=!0,b=h.route.hydrateFallbackElement||null)));let g=t.concat(l.slice(0,x+1)),y=()=>{let v;return m?v=p:f?v=b:h.route.Component?v=j.createElement(h.route.Component,null):h.route.element?v=h.route.element:v=u,j.createElement(tw,{match:h,routeContext:{outlet:u,matches:g,isDataRoute:n!=null},children:v})};return n&&(h.route.ErrorBoundary||h.route.errorElement||x===0)?j.createElement(ew,{location:n.location,revalidation:n.revalidation,component:p,error:m,children:y(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):y()},null)}var v0=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(v0||{}),j0=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(j0||{});function nw(e){let t=j.useContext(vc);return t||lt(!1),t}function rw(e){let t=j.useContext(x0);return t||lt(!1),t}function aw(e){let t=j.useContext(on);return t||lt(!1),t}function b0(e){let t=aw(),n=t.matches[t.matches.length-1];return n.route.id||lt(!1),n.route.id}function iw(){var e;let t=j.useContext(g0),n=rw(),r=b0();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function lw(){let{router:e}=nw(v0.UseNavigateStable),t=b0(j0.UseNavigateStable),n=j.useRef(!1);return y0(()=>{n.current=!0}),j.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,sl({fromRouteId:t},i)))},[e,t])}const Fp={};function ow(e,t,n){Fp[e]||(Fp[e]=!0)}function cw(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function va(e){let{to:t,replace:n,state:r,relative:a}=e;ni()||lt(!1);let{future:i,static:l}=j.useContext(Fn),{matches:o}=j.useContext(on),{pathname:c}=In(),d=Yt(),u=Hm(t,Qm(o,i.v7_relativeSplatPath),c,a==="path"),h=JSON.stringify(u);return j.useEffect(()=>d(JSON.parse(h),{replace:n,state:r,relative:a}),[d,h,a,n,r]),null}function dw(e){return GN(e.context)}function ze(e){lt(!1)}function uw(e){let{basename:t="/",children:n=null,location:r,navigationType:a=nr.Pop,navigator:i,static:l=!1,future:o}=e;ni()&<(!1);let c=t.replace(/^\/*/,"/"),d=j.useMemo(()=>({basename:c,navigator:i,static:l,future:sl({v7_relativeSplatPath:!1},o)}),[c,o,i,l]);typeof r=="string"&&(r=si(r));let{pathname:u="/",search:h="",hash:x="",state:m=null,key:f="default"}=r,p=j.useMemo(()=>{let b=Za(u,c);return b==null?null:{location:{pathname:b,search:h,hash:x,state:m,key:f},navigationType:a}},[c,u,h,x,m,f,a]);return p==null?null:j.createElement(Fn.Provider,{value:d},j.createElement(jc.Provider,{children:n,value:p}))}function mw(e){let{children:t,location:n}=e;return ZN(pu(t),n)}new Promise(()=>{});function pu(e,t){t===void 0&&(t=[]);let n=[];return j.Children.forEach(e,(r,a)=>{if(!j.isValidElement(r))return;let i=[...t,a];if(r.type===j.Fragment){n.push.apply(n,pu(r.props.children,i));return}r.type!==ze&<(!1),!r.props.index||!r.props.children||lt(!1);let l={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=pu(r.props.children,i)),n.push(l)}),n}/** - * React Router DOM v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Wo(){return Wo=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[a]=e[a]);return n}function hw(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function fw(e,t){return e.button===0&&(!t||t==="_self")&&!hw(e)}function xu(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function pw(e,t){let n=xu(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(i=>{n.append(a,i)})}),n}const xw=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],gw=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],yw="6";try{window.__reactRouterVersion=yw}catch{}const vw=j.createContext({isTransitioning:!1}),jw="startTransition",Ip=oj[jw];function bw(e){let{basename:t,children:n,future:r,window:a}=e,i=j.useRef();i.current==null&&(i.current=jN({window:a,v5Compat:!0}));let l=i.current,[o,c]=j.useState({action:l.action,location:l.location}),{v7_startTransition:d}=r||{},u=j.useCallback(h=>{d&&Ip?Ip(()=>c(h)):c(h)},[c,d]);return j.useLayoutEffect(()=>l.listen(u),[l,u]),j.useEffect(()=>cw(r),[r]),j.createElement(uw,{basename:t,children:n,location:o.location,navigationType:o.action,navigator:l,future:r})}const Nw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ww=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ke=j.forwardRef(function(t,n){let{onClick:r,relative:a,reloadDocument:i,replace:l,state:o,target:c,to:d,preventScrollReset:u,viewTransition:h}=t,x=N0(t,xw),{basename:m}=j.useContext(Fn),f,p=!1;if(typeof d=="string"&&ww.test(d)&&(f=d,Nw))try{let v=new URL(window.location.href),N=d.startsWith("//")?new URL(v.protocol+d):new URL(d),E=Za(N.pathname,m);N.origin===v.origin&&E!=null?d=E+N.search+N.hash:p=!0}catch{}let b=QN(d,{relative:a}),g=kw(d,{replace:l,state:o,target:c,preventScrollReset:u,relative:a,viewTransition:h});function y(v){r&&r(v),v.defaultPrevented||g(v)}return j.createElement("a",Wo({},x,{href:f||b,onClick:p||i?r:y,ref:n,target:c}))}),dd=j.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:a=!1,className:i="",end:l=!1,style:o,to:c,viewTransition:d,children:u}=t,h=N0(t,gw),x=Nc(c,{relative:h.relative}),m=In(),f=j.useContext(x0),{navigator:p,basename:b}=j.useContext(Fn),g=f!=null&&Cw(x)&&d===!0,y=p.encodeLocation?p.encodeLocation(x).pathname:x.pathname,v=m.pathname,N=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;a||(v=v.toLowerCase(),N=N?N.toLowerCase():null,y=y.toLowerCase()),N&&b&&(N=Za(N,b)||N);const E=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let A=v===y||!l&&v.startsWith(y)&&v.charAt(E)==="/",I=N!=null&&(N===y||!l&&N.startsWith(y)&&N.charAt(y.length)==="/"),w={isActive:A,isPending:I,isTransitioning:g},S=A?r:void 0,P;typeof i=="function"?P=i(w):P=[i,A?"active":null,I?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let O=typeof o=="function"?o(w):o;return j.createElement(ke,Wo({},h,{"aria-current":S,className:P,ref:n,style:O,to:c,viewTransition:d}),typeof u=="function"?u(w):u)});var gu;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(gu||(gu={}));var Rp;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Rp||(Rp={}));function Sw(e){let t=j.useContext(vc);return t||lt(!1),t}function kw(e,t){let{target:n,replace:r,state:a,preventScrollReset:i,relative:l,viewTransition:o}=t===void 0?{}:t,c=Yt(),d=In(),u=Nc(e,{relative:l});return j.useCallback(h=>{if(fw(h,n)){h.preventDefault();let x=r!==void 0?r:Ho(d)===Ho(u);c(e,{replace:x,state:a,preventScrollReset:i,relative:l,viewTransition:o})}},[d,c,u,r,a,n,e,i,l,o])}function wc(e){let t=j.useRef(xu(e)),n=j.useRef(!1),r=In(),a=j.useMemo(()=>pw(r.search,n.current?null:t.current),[r.search]),i=Yt(),l=j.useCallback((o,c)=>{const d=xu(typeof o=="function"?o(a):o);n.current=!0,i("?"+d,c)},[i,a]);return[a,l]}function Cw(e,t){t===void 0&&(t={});let n=j.useContext(vw);n==null&<(!1);let{basename:r}=Sw(gu.useViewTransitionState),a=Nc(e,{relative:t.relative});if(!n.isTransitioning)return!1;let i=Za(n.currentLocation.pathname,r)||n.currentLocation.pathname,l=Za(n.nextLocation.pathname,r)||n.nextLocation.pathname;return fu(a.pathname,l)!=null||fu(a.pathname,i)!=null}var ta=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ew={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Vn,Zu,Ux,Dw=(Ux=class{constructor(){me(this,Vn,Ew);me(this,Zu,!1)}setTimeoutProvider(e){te(this,Vn,e)}setTimeout(e,t){return M(this,Vn).setTimeout(e,t)}clearTimeout(e){M(this,Vn).clearTimeout(e)}setInterval(e,t){return M(this,Vn).setInterval(e,t)}clearInterval(e){M(this,Vn).clearInterval(e)}},Vn=new WeakMap,Zu=new WeakMap,Ux),Dr=new Dw;function Pw(e){setTimeout(e,0)}var Gr=typeof window>"u"||"Deno"in globalThis;function _t(){}function Aw(e,t){return typeof e=="function"?e(t):e}function yu(e){return typeof e=="number"&&e>=0&&e!==1/0}function w0(e,t){return Math.max(e+(t||0)-Date.now(),0)}function hr(e,t){return typeof e=="function"?e(t):e}function ks(e,t){return typeof e=="function"?e(t):e}function Lp(e,t){const{type:n="all",exact:r,fetchStatus:a,predicate:i,queryKey:l,stale:o}=e;if(l){if(r){if(t.queryHash!==Wm(l,t.options))return!1}else if(!nl(t.queryKey,l))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||a&&a!==t.state.fetchStatus||i&&!i(t))}function Op(e,t){const{exact:n,status:r,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Zr(t.options.mutationKey)!==Zr(i))return!1}else if(!nl(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function Wm(e,t){return((t==null?void 0:t.queryKeyHashFn)||Zr)(e)}function Zr(e){return JSON.stringify(e,(t,n)=>vu(n)?Object.keys(n).sort().reduce((r,a)=>(r[a]=n[a],r),{}):n)}function nl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>nl(e[n],t[n])):!1}var Mw=Object.prototype.hasOwnProperty;function Gm(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=zp(e)&&zp(t);if(!r&&!(vu(e)&&vu(t)))return t;const i=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),o=l.length,c=r?new Array(o):{};let d=0;for(let u=0;u{Dr.setTimeout(t,e)})}function ju(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Gm(e,t):t}function Fw(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Iw(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Zm=Symbol();function S0(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Zm?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Jm(e,t){return typeof e=="function"?e(...t):!!e}function Rw(e,t,n){let r=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),r||(r=!0,a.aborted?n():a.addEventListener("abort",n,{once:!0})),a)}),e}var Mr,Qn,Da,qx,Lw=(qx=class extends ta{constructor(){super();me(this,Mr);me(this,Qn);me(this,Da);te(this,Da,t=>{if(!Gr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){M(this,Qn)||this.setEventListener(M(this,Da))}onUnsubscribe(){var t;this.hasListeners()||((t=M(this,Qn))==null||t.call(this),te(this,Qn,void 0))}setEventListener(t){var n;te(this,Da,t),(n=M(this,Qn))==null||n.call(this),te(this,Qn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){M(this,Mr)!==t&&(te(this,Mr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof M(this,Mr)=="boolean"?M(this,Mr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Mr=new WeakMap,Qn=new WeakMap,Da=new WeakMap,qx),Xm=new Lw;function bu(){let e,t;const n=new Promise((a,i)=>{e=a,t=i});n.status="pending",n.catch(()=>{});function r(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{r({status:"fulfilled",value:a}),e(a)},n.reject=a=>{r({status:"rejected",reason:a}),t(a)},n}var Ow=Pw;function zw(){let e=[],t=0,n=o=>{o()},r=o=>{o()},a=Ow;const i=o=>{t?e.push(o):a(()=>{n(o)})},l=()=>{const o=e;e=[],o.length&&a(()=>{r(()=>{o.forEach(c=>{n(c)})})})};return{batch:o=>{let c;t++;try{c=o()}finally{t--,t||l()}return c},batchCalls:o=>(...c)=>{i(()=>{o(...c)})},schedule:i,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{a=o}}}var ht=zw(),Pa,Hn,Aa,Vx,$w=(Vx=class extends ta{constructor(){super();me(this,Pa,!0);me(this,Hn);me(this,Aa);te(this,Aa,t=>{if(!Gr&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){M(this,Hn)||this.setEventListener(M(this,Aa))}onUnsubscribe(){var t;this.hasListeners()||((t=M(this,Hn))==null||t.call(this),te(this,Hn,void 0))}setEventListener(t){var n;te(this,Aa,t),(n=M(this,Hn))==null||n.call(this),te(this,Hn,t(this.setOnline.bind(this)))}setOnline(t){M(this,Pa)!==t&&(te(this,Pa,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return M(this,Pa)}},Pa=new WeakMap,Hn=new WeakMap,Aa=new WeakMap,Vx),Go=new $w;function _w(e){return Math.min(1e3*2**e,3e4)}function k0(e){return(e??"online")==="online"?Go.isOnline():!0}var Nu=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function C0(e){let t=!1,n=0,r;const a=bu(),i=()=>a.status!=="pending",l=p=>{var b;if(!i()){const g=new Nu(p);x(g),(b=e.onCancel)==null||b.call(e,g)}},o=()=>{t=!0},c=()=>{t=!1},d=()=>Xm.isFocused()&&(e.networkMode==="always"||Go.isOnline())&&e.canRun(),u=()=>k0(e.networkMode)&&e.canRun(),h=p=>{i()||(r==null||r(),a.resolve(p))},x=p=>{i()||(r==null||r(),a.reject(p))},m=()=>new Promise(p=>{var b;r=g=>{(i()||d())&&p(g)},(b=e.onPause)==null||b.call(e)}).then(()=>{var p;r=void 0,i()||(p=e.onContinue)==null||p.call(e)}),f=()=>{if(i())return;let p;const b=n===0?e.initialPromise:void 0;try{p=b??e.fn()}catch(g){p=Promise.reject(g)}Promise.resolve(p).then(h).catch(g=>{var A;if(i())return;const y=e.retry??(Gr?0:3),v=e.retryDelay??_w,N=typeof v=="function"?v(n,g):v,E=y===!0||typeof y=="number"&&nd()?void 0:m()).then(()=>{t?x(g):f()})})};return{promise:a,status:()=>a.status,cancel:l,continue:()=>(r==null||r(),a),cancelRetry:o,continueRetry:c,canStart:u,start:()=>(u()?f():m().then(f),a)}}var Tr,Qx,E0=(Qx=class{constructor(){me(this,Tr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),yu(this.gcTime)&&te(this,Tr,Dr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Gr?1/0:5*60*1e3))}clearGcTimeout(){M(this,Tr)&&(Dr.clearTimeout(M(this,Tr)),te(this,Tr,void 0))}},Tr=new WeakMap,Qx),Fr,Ma,ws,Ir,Ct,ul,Rr,Ls,hn,Hx,Kw=(Hx=class extends E0{constructor(t){super();me(this,Ls);me(this,Fr);me(this,Ma);me(this,ws);me(this,Ir);me(this,Ct);me(this,ul);me(this,Rr);te(this,Rr,!1),te(this,ul,t.defaultOptions),this.setOptions(t.options),this.observers=[],te(this,Ir,t.client),te(this,ws,M(this,Ir).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,te(this,Fr,Kp(this.options)),this.state=t.state??M(this,Fr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=M(this,Ct))==null?void 0:t.promise}setOptions(t){if(this.options={...M(this,ul),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Kp(this.options);n.data!==void 0&&(this.setState(_p(n.data,n.dataUpdatedAt)),te(this,Fr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&M(this,ws).remove(this)}setData(t,n){const r=ju(this.state.data,t,this.options);return be(this,Ls,hn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){be(this,Ls,hn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,a;const n=(r=M(this,Ct))==null?void 0:r.promise;return(a=M(this,Ct))==null||a.cancel(t),n?n.then(_t).catch(_t):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(M(this,Fr))}isActive(){return this.observers.some(t=>ks(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Zm||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>hr(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!w0(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=M(this,Ct))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=M(this,Ct))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),M(this,ws).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(M(this,Ct)&&(M(this,Rr)?M(this,Ct).cancel({revert:!0}):M(this,Ct).cancelRetry()),this.scheduleGc()),M(this,ws).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||be(this,Ls,hn).call(this,{type:"invalidate"})}async fetch(t,n){var c,d,u,h,x,m,f,p,b,g,y,v;if(this.state.fetchStatus!=="idle"&&((c=M(this,Ct))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(M(this,Ct))return M(this,Ct).continueRetry(),M(this,Ct).promise}if(t&&this.setOptions(t),!this.options.queryFn){const N=this.observers.find(E=>E.options.queryFn);N&&this.setOptions(N.options)}const r=new AbortController,a=N=>{Object.defineProperty(N,"signal",{enumerable:!0,get:()=>(te(this,Rr,!0),r.signal)})},i=()=>{const N=S0(this.options,n),A=(()=>{const I={client:M(this,Ir),queryKey:this.queryKey,meta:this.meta};return a(I),I})();return te(this,Rr,!1),this.options.persister?this.options.persister(N,A,this):N(A)},o=(()=>{const N={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:M(this,Ir),state:this.state,fetchFn:i};return a(N),N})();(d=this.options.behavior)==null||d.onFetch(o,this),te(this,Ma,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&be(this,Ls,hn).call(this,{type:"fetch",meta:(h=o.fetchOptions)==null?void 0:h.meta}),te(this,Ct,C0({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:N=>{N instanceof Nu&&N.revert&&this.setState({...M(this,Ma),fetchStatus:"idle"}),r.abort()},onFail:(N,E)=>{be(this,Ls,hn).call(this,{type:"failed",failureCount:N,error:E})},onPause:()=>{be(this,Ls,hn).call(this,{type:"pause"})},onContinue:()=>{be(this,Ls,hn).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const N=await M(this,Ct).start();if(N===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(N),(m=(x=M(this,ws).config).onSuccess)==null||m.call(x,N,this),(p=(f=M(this,ws).config).onSettled)==null||p.call(f,N,this.state.error,this),N}catch(N){if(N instanceof Nu){if(N.silent)return M(this,Ct).promise;if(N.revert){if(this.state.data===void 0)throw N;return this.state.data}}throw be(this,Ls,hn).call(this,{type:"error",error:N}),(g=(b=M(this,ws).config).onError)==null||g.call(b,N,this),(v=(y=M(this,ws).config).onSettled)==null||v.call(y,this.state.data,N,this),N}finally{this.scheduleGc()}}},Fr=new WeakMap,Ma=new WeakMap,ws=new WeakMap,Ir=new WeakMap,Ct=new WeakMap,ul=new WeakMap,Rr=new WeakMap,Ls=new WeakSet,hn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...D0(r.data,this.options),fetchMeta:t.meta??null};case"success":const a={...r,..._p(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return te(this,Ma,t.manual?a:void 0),a;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ht.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),M(this,ws).notify({query:this,type:"updated",action:t})})},Hx);function D0(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:k0(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function _p(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Kp(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var ns,De,ml,Qt,Lr,Ta,gn,Wn,hl,Fa,Ia,Or,zr,Gn,Ra,$e,Si,wu,Su,ku,Cu,Eu,Du,Pu,P0,Wx,Ym=(Wx=class extends ta{constructor(t,n){super();me(this,$e);me(this,ns);me(this,De);me(this,ml);me(this,Qt);me(this,Lr);me(this,Ta);me(this,gn);me(this,Wn);me(this,hl);me(this,Fa);me(this,Ia);me(this,Or);me(this,zr);me(this,Gn);me(this,Ra,new Set);this.options=n,te(this,ns,t),te(this,Wn,null),te(this,gn,bu()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(M(this,De).addObserver(this),Bp(M(this,De),this.options)?be(this,$e,Si).call(this):this.updateResult(),be(this,$e,Cu).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Au(M(this,De),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Au(M(this,De),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,be(this,$e,Eu).call(this),be(this,$e,Du).call(this),M(this,De).removeObserver(this)}setOptions(t){const n=this.options,r=M(this,De);if(this.options=M(this,ns).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ks(this.options.enabled,M(this,De))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");be(this,$e,Pu).call(this),M(this,De).setOptions(this.options),n._defaulted&&!rl(this.options,n)&&M(this,ns).getQueryCache().notify({type:"observerOptionsUpdated",query:M(this,De),observer:this});const a=this.hasListeners();a&&Up(M(this,De),r,this.options,n)&&be(this,$e,Si).call(this),this.updateResult(),a&&(M(this,De)!==r||ks(this.options.enabled,M(this,De))!==ks(n.enabled,M(this,De))||hr(this.options.staleTime,M(this,De))!==hr(n.staleTime,M(this,De)))&&be(this,$e,wu).call(this);const i=be(this,$e,Su).call(this);a&&(M(this,De)!==r||ks(this.options.enabled,M(this,De))!==ks(n.enabled,M(this,De))||i!==M(this,Gn))&&be(this,$e,ku).call(this,i)}getOptimisticResult(t){const n=M(this,ns).getQueryCache().build(M(this,ns),t),r=this.createResult(n,t);return Uw(this,r)&&(te(this,Qt,r),te(this,Ta,this.options),te(this,Lr,M(this,De).state)),r}getCurrentResult(){return M(this,Qt)}trackResult(t,n){return new Proxy(t,{get:(r,a)=>(this.trackProp(a),n==null||n(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&M(this,gn).status==="pending"&&M(this,gn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,a))})}trackProp(t){M(this,Ra).add(t)}getCurrentQuery(){return M(this,De)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=M(this,ns).defaultQueryOptions(t),r=M(this,ns).getQueryCache().build(M(this,ns),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return be(this,$e,Si).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),M(this,Qt)))}createResult(t,n){var S;const r=M(this,De),a=this.options,i=M(this,Qt),l=M(this,Lr),o=M(this,Ta),d=t!==r?t.state:M(this,ml),{state:u}=t;let h={...u},x=!1,m;if(n._optimisticResults){const P=this.hasListeners(),O=!P&&Bp(t,n),R=P&&Up(t,r,n,a);(O||R)&&(h={...h,...D0(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:f,errorUpdatedAt:p,status:b}=h;m=h.data;let g=!1;if(n.placeholderData!==void 0&&m===void 0&&b==="pending"){let P;i!=null&&i.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(P=i.data,g=!0):P=typeof n.placeholderData=="function"?n.placeholderData((S=M(this,Ia))==null?void 0:S.state.data,M(this,Ia)):n.placeholderData,P!==void 0&&(b="success",m=ju(i==null?void 0:i.data,P,n),x=!0)}if(n.select&&m!==void 0&&!g)if(i&&m===(l==null?void 0:l.data)&&n.select===M(this,hl))m=M(this,Fa);else try{te(this,hl,n.select),m=n.select(m),m=ju(i==null?void 0:i.data,m,n),te(this,Fa,m),te(this,Wn,null)}catch(P){te(this,Wn,P)}M(this,Wn)&&(f=M(this,Wn),m=M(this,Fa),p=Date.now(),b="error");const y=h.fetchStatus==="fetching",v=b==="pending",N=b==="error",E=v&&y,A=m!==void 0,w={status:b,fetchStatus:h.fetchStatus,isPending:v,isSuccess:b==="success",isError:N,isInitialLoading:E,isLoading:E,data:m,dataUpdatedAt:h.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>d.dataUpdateCount||h.errorUpdateCount>d.errorUpdateCount,isFetching:y,isRefetching:y&&!v,isLoadingError:N&&!A,isPaused:h.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:N&&A,isStale:eh(t,n),refetch:this.refetch,promise:M(this,gn),isEnabled:ks(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const P=w.data!==void 0,O=w.status==="error"&&!P,R=z=>{O?z.reject(w.error):P&&z.resolve(w.data)},q=()=>{const z=te(this,gn,w.promise=bu());R(z)},D=M(this,gn);switch(D.status){case"pending":t.queryHash===r.queryHash&&R(D);break;case"fulfilled":(O||w.data!==D.value)&&q();break;case"rejected":(!O||w.error!==D.reason)&&q();break}}return w}updateResult(){const t=M(this,Qt),n=this.createResult(M(this,De),this.options);if(te(this,Lr,M(this,De).state),te(this,Ta,this.options),M(this,Lr).data!==void 0&&te(this,Ia,M(this,De)),rl(n,t))return;te(this,Qt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!M(this,Ra).size)return!0;const l=new Set(i??M(this,Ra));return this.options.throwOnError&&l.add("error"),Object.keys(M(this,Qt)).some(o=>{const c=o;return M(this,Qt)[c]!==t[c]&&l.has(c)})};be(this,$e,P0).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&be(this,$e,Cu).call(this)}},ns=new WeakMap,De=new WeakMap,ml=new WeakMap,Qt=new WeakMap,Lr=new WeakMap,Ta=new WeakMap,gn=new WeakMap,Wn=new WeakMap,hl=new WeakMap,Fa=new WeakMap,Ia=new WeakMap,Or=new WeakMap,zr=new WeakMap,Gn=new WeakMap,Ra=new WeakMap,$e=new WeakSet,Si=function(t){be(this,$e,Pu).call(this);let n=M(this,De).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(_t)),n},wu=function(){be(this,$e,Eu).call(this);const t=hr(this.options.staleTime,M(this,De));if(Gr||M(this,Qt).isStale||!yu(t))return;const r=w0(M(this,Qt).dataUpdatedAt,t)+1;te(this,Or,Dr.setTimeout(()=>{M(this,Qt).isStale||this.updateResult()},r))},Su=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(M(this,De)):this.options.refetchInterval)??!1},ku=function(t){be(this,$e,Du).call(this),te(this,Gn,t),!(Gr||ks(this.options.enabled,M(this,De))===!1||!yu(M(this,Gn))||M(this,Gn)===0)&&te(this,zr,Dr.setInterval(()=>{(this.options.refetchIntervalInBackground||Xm.isFocused())&&be(this,$e,Si).call(this)},M(this,Gn)))},Cu=function(){be(this,$e,wu).call(this),be(this,$e,ku).call(this,be(this,$e,Su).call(this))},Eu=function(){M(this,Or)&&(Dr.clearTimeout(M(this,Or)),te(this,Or,void 0))},Du=function(){M(this,zr)&&(Dr.clearInterval(M(this,zr)),te(this,zr,void 0))},Pu=function(){const t=M(this,ns).getQueryCache().build(M(this,ns),this.options);if(t===M(this,De))return;const n=M(this,De);te(this,De,t),te(this,ml,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},P0=function(t){ht.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(M(this,Qt))}),M(this,ns).getQueryCache().notify({query:M(this,De),type:"observerResultsUpdated"})})},Wx);function Bw(e,t){return ks(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Bp(e,t){return Bw(e,t)||e.state.data!==void 0&&Au(e,t,t.refetchOnMount)}function Au(e,t,n){if(ks(t.enabled,e)!==!1&&hr(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&eh(e,t)}return!1}function Up(e,t,n,r){return(e!==t||ks(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&eh(e,n)}function eh(e,t){return ks(t.enabled,e)!==!1&&e.isStaleByTime(hr(t.staleTime,e))}function Uw(e,t){return!rl(e.getCurrentResult(),t)}function qp(e){return{onFetch:(t,n)=>{var u,h,x,m,f;const r=t.options,a=(x=(h=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:h.fetchMore)==null?void 0:x.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],l=((f=t.state.data)==null?void 0:f.pageParams)||[];let o={pages:[],pageParams:[]},c=0;const d=async()=>{let p=!1;const b=v=>{Rw(v,()=>t.signal,()=>p=!0)},g=S0(t.options,t.fetchOptions),y=async(v,N,E)=>{if(p)return Promise.reject();if(N==null&&v.pages.length)return Promise.resolve(v);const I=(()=>{const O={client:t.client,queryKey:t.queryKey,pageParam:N,direction:E?"backward":"forward",meta:t.options.meta};return b(O),O})(),w=await g(I),{maxPages:S}=t.options,P=E?Iw:Fw;return{pages:P(v.pages,w,S),pageParams:P(v.pageParams,N,S)}};if(a&&i.length){const v=a==="backward",N=v?qw:Vp,E={pages:i,pageParams:l},A=N(r,E);o=await y(E,A,v)}else{const v=e??i.length;do{const N=c===0?l[0]??r.initialPageParam:Vp(r,o);if(c>0&&N==null)break;o=await y(o,N),c++}while(c{var p,b;return(b=(p=t.options).persister)==null?void 0:b.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function Vp(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function qw(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var fl,Xs,Ht,$r,Ys,zn,Gx,Vw=(Gx=class extends E0{constructor(t){super();me(this,Ys);me(this,fl);me(this,Xs);me(this,Ht);me(this,$r);te(this,fl,t.client),this.mutationId=t.mutationId,te(this,Ht,t.mutationCache),te(this,Xs,[]),this.state=t.state||A0(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){M(this,Xs).includes(t)||(M(this,Xs).push(t),this.clearGcTimeout(),M(this,Ht).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){te(this,Xs,M(this,Xs).filter(n=>n!==t)),this.scheduleGc(),M(this,Ht).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){M(this,Xs).length||(this.state.status==="pending"?this.scheduleGc():M(this,Ht).remove(this))}continue(){var t;return((t=M(this,$r))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,o,c,d,u,h,x,m,f,p,b,g,y,v,N,E,A,I,w,S;const n=()=>{be(this,Ys,zn).call(this,{type:"continue"})},r={client:M(this,fl),meta:this.options.meta,mutationKey:this.options.mutationKey};te(this,$r,C0({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(P,O)=>{be(this,Ys,zn).call(this,{type:"failed",failureCount:P,error:O})},onPause:()=>{be(this,Ys,zn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>M(this,Ht).canRun(this)}));const a=this.state.status==="pending",i=!M(this,$r).canStart();try{if(a)n();else{be(this,Ys,zn).call(this,{type:"pending",variables:t,isPaused:i}),await((o=(l=M(this,Ht).config).onMutate)==null?void 0:o.call(l,t,this,r));const O=await((d=(c=this.options).onMutate)==null?void 0:d.call(c,t,r));O!==this.state.context&&be(this,Ys,zn).call(this,{type:"pending",context:O,variables:t,isPaused:i})}const P=await M(this,$r).start();return await((h=(u=M(this,Ht).config).onSuccess)==null?void 0:h.call(u,P,t,this.state.context,this,r)),await((m=(x=this.options).onSuccess)==null?void 0:m.call(x,P,t,this.state.context,r)),await((p=(f=M(this,Ht).config).onSettled)==null?void 0:p.call(f,P,null,this.state.variables,this.state.context,this,r)),await((g=(b=this.options).onSettled)==null?void 0:g.call(b,P,null,t,this.state.context,r)),be(this,Ys,zn).call(this,{type:"success",data:P}),P}catch(P){try{await((v=(y=M(this,Ht).config).onError)==null?void 0:v.call(y,P,t,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((E=(N=this.options).onError)==null?void 0:E.call(N,P,t,this.state.context,r))}catch(O){Promise.reject(O)}try{await((I=(A=M(this,Ht).config).onSettled)==null?void 0:I.call(A,void 0,P,this.state.variables,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((S=(w=this.options).onSettled)==null?void 0:S.call(w,void 0,P,t,this.state.context,r))}catch(O){Promise.reject(O)}throw be(this,Ys,zn).call(this,{type:"error",error:P}),P}finally{M(this,Ht).runNext(this)}}},fl=new WeakMap,Xs=new WeakMap,Ht=new WeakMap,$r=new WeakMap,Ys=new WeakSet,zn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ht.batch(()=>{M(this,Xs).forEach(r=>{r.onMutationUpdate(t)}),M(this,Ht).notify({mutation:this,type:"updated",action:t})})},Gx);function A0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var yn,Os,pl,Zx,Qw=(Zx=class extends ta{constructor(t={}){super();me(this,yn);me(this,Os);me(this,pl);this.config=t,te(this,yn,new Set),te(this,Os,new Map),te(this,pl,0)}build(t,n,r){const a=new Vw({client:t,mutationCache:this,mutationId:++Ll(this,pl)._,options:t.defaultMutationOptions(n),state:r});return this.add(a),a}add(t){M(this,yn).add(t);const n=eo(t);if(typeof n=="string"){const r=M(this,Os).get(n);r?r.push(t):M(this,Os).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(M(this,yn).delete(t)){const n=eo(t);if(typeof n=="string"){const r=M(this,Os).get(n);if(r)if(r.length>1){const a=r.indexOf(t);a!==-1&&r.splice(a,1)}else r[0]===t&&M(this,Os).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=eo(t);if(typeof n=="string"){const r=M(this,Os).get(n),a=r==null?void 0:r.find(i=>i.state.status==="pending");return!a||a===t}else return!0}runNext(t){var r;const n=eo(t);if(typeof n=="string"){const a=(r=M(this,Os).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ht.batch(()=>{M(this,yn).forEach(t=>{this.notify({type:"removed",mutation:t})}),M(this,yn).clear(),M(this,Os).clear()})}getAll(){return Array.from(M(this,yn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Op(n,r))}findAll(t={}){return this.getAll().filter(n=>Op(t,n))}notify(t){ht.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ht.batch(()=>Promise.all(t.map(n=>n.continue().catch(_t))))}},yn=new WeakMap,Os=new WeakMap,pl=new WeakMap,Zx);function eo(e){var t;return(t=e.options.scope)==null?void 0:t.id}var vn,Zn,rs,jn,kn,go,Mu,Jx,Hw=(Jx=class extends ta{constructor(n,r){super();me(this,kn);me(this,vn);me(this,Zn);me(this,rs);me(this,jn);te(this,vn,n),this.setOptions(r),this.bindMethods(),be(this,kn,go).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var a;const r=this.options;this.options=M(this,vn).defaultMutationOptions(n),rl(this.options,r)||M(this,vn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:M(this,rs),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Zr(r.mutationKey)!==Zr(this.options.mutationKey)?this.reset():((a=M(this,rs))==null?void 0:a.state.status)==="pending"&&M(this,rs).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=M(this,rs))==null||n.removeObserver(this)}onMutationUpdate(n){be(this,kn,go).call(this),be(this,kn,Mu).call(this,n)}getCurrentResult(){return M(this,Zn)}reset(){var n;(n=M(this,rs))==null||n.removeObserver(this),te(this,rs,void 0),be(this,kn,go).call(this),be(this,kn,Mu).call(this)}mutate(n,r){var a;return te(this,jn,r),(a=M(this,rs))==null||a.removeObserver(this),te(this,rs,M(this,vn).getMutationCache().build(M(this,vn),this.options)),M(this,rs).addObserver(this),M(this,rs).execute(n)}},vn=new WeakMap,Zn=new WeakMap,rs=new WeakMap,jn=new WeakMap,kn=new WeakSet,go=function(){var r;const n=((r=M(this,rs))==null?void 0:r.state)??A0();te(this,Zn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Mu=function(n){ht.batch(()=>{var r,a,i,l,o,c,d,u;if(M(this,jn)&&this.hasListeners()){const h=M(this,Zn).variables,x=M(this,Zn).context,m={client:M(this,vn),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(a=(r=M(this,jn)).onSuccess)==null||a.call(r,n.data,h,x,m)}catch(f){Promise.reject(f)}try{(l=(i=M(this,jn)).onSettled)==null||l.call(i,n.data,null,h,x,m)}catch(f){Promise.reject(f)}}else if((n==null?void 0:n.type)==="error"){try{(c=(o=M(this,jn)).onError)==null||c.call(o,n.error,h,x,m)}catch(f){Promise.reject(f)}try{(u=(d=M(this,jn)).onSettled)==null||u.call(d,void 0,n.error,h,x,m)}catch(f){Promise.reject(f)}}}this.listeners.forEach(h=>{h(M(this,Zn))})})},Jx);function Qp(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}function Ww(e,t,n){const r=e.slice(0);return r[t]=n,r}var La,fs,Oa,za,Ss,Jn,xl,gl,yl,vl,Ot,Tu,Fu,Iu,Ru,Lu,Xx,Gw=(Xx=class extends ta{constructor(t,n,r){super();me(this,Ot);me(this,La);me(this,fs);me(this,Oa);me(this,za);me(this,Ss);me(this,Jn);me(this,xl);me(this,gl);me(this,yl);me(this,vl,[]);te(this,La,t),te(this,za,r),te(this,Oa,[]),te(this,Ss,[]),te(this,fs,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&M(this,Ss).forEach(t=>{t.subscribe(n=>{be(this,Ot,Ru).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,M(this,Ss).forEach(t=>{t.destroy()})}setQueries(t,n){te(this,Oa,t),te(this,za,n),ht.batch(()=>{const r=M(this,Ss),a=be(this,Ot,Iu).call(this,M(this,Oa));a.forEach(h=>h.observer.setOptions(h.defaultedQueryOptions));const i=a.map(h=>h.observer),l=i.map(h=>h.getCurrentResult()),o=r.length!==i.length,c=i.some((h,x)=>h!==r[x]),d=o||c,u=d?!0:l.some((h,x)=>{const m=M(this,fs)[x];return!m||!rl(h,m)});!d&&!u||(d&&(te(this,vl,a),te(this,Ss,i)),te(this,fs,l),this.hasListeners()&&(d&&(Qp(r,i).forEach(h=>{h.destroy()}),Qp(i,r).forEach(h=>{h.subscribe(x=>{be(this,Ot,Ru).call(this,h,x)})})),be(this,Ot,Lu).call(this)))})}getCurrentResult(){return M(this,fs)}getQueries(){return M(this,Ss).map(t=>t.getCurrentQuery())}getObservers(){return M(this,Ss)}getOptimisticResult(t,n){const r=be(this,Ot,Iu).call(this,t),a=r.map(l=>l.observer.getOptimisticResult(l.defaultedQueryOptions)),i=r.map(l=>l.defaultedQueryOptions.queryHash);return[a,l=>be(this,Ot,Fu).call(this,l??a,n,i),()=>be(this,Ot,Tu).call(this,a,r)]}},La=new WeakMap,fs=new WeakMap,Oa=new WeakMap,za=new WeakMap,Ss=new WeakMap,Jn=new WeakMap,xl=new WeakMap,gl=new WeakMap,yl=new WeakMap,vl=new WeakMap,Ot=new WeakSet,Tu=function(t,n){return n.map((r,a)=>{const i=t[a];return r.defaultedQueryOptions.notifyOnChangeProps?i:r.observer.trackResult(i,l=>{n.forEach(o=>{o.observer.trackProp(l)})})})},Fu=function(t,n,r){if(n){const a=M(this,yl),i=r!==void 0&&a!==void 0&&(a.length!==r.length||r.some((l,o)=>l!==a[o]));return(!M(this,Jn)||M(this,fs)!==M(this,gl)||i||n!==M(this,xl))&&(te(this,xl,n),te(this,gl,M(this,fs)),r!==void 0&&te(this,yl,r),te(this,Jn,Gm(M(this,Jn),n(t)))),M(this,Jn)}return t},Iu=function(t){const n=new Map;M(this,Ss).forEach(a=>{const i=a.options.queryHash;if(!i)return;const l=n.get(i);l?l.push(a):n.set(i,[a])});const r=[];return t.forEach(a=>{var c;const i=M(this,La).defaultQueryOptions(a),o=((c=n.get(i.queryHash))==null?void 0:c.shift())??new Ym(M(this,La),i);r.push({defaultedQueryOptions:i,observer:o})}),r},Ru=function(t,n){const r=M(this,Ss).indexOf(t);r!==-1&&(te(this,fs,Ww(M(this,fs),r,n)),be(this,Ot,Lu).call(this))},Lu=function(){var t;if(this.hasListeners()){const n=M(this,Jn),r=be(this,Ot,Tu).call(this,M(this,fs),M(this,vl)),a=be(this,Ot,Fu).call(this,r,(t=M(this,za))==null?void 0:t.combine);n!==a&&ht.batch(()=>{this.listeners.forEach(i=>{i(M(this,fs))})})}},Xx),en,Yx,Zw=(Yx=class extends ta{constructor(t={}){super();me(this,en);this.config=t,te(this,en,new Map)}build(t,n,r){const a=n.queryKey,i=n.queryHash??Wm(a,n);let l=this.get(i);return l||(l=new Kw({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(a)}),this.add(l)),l}add(t){M(this,en).has(t.queryHash)||(M(this,en).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=M(this,en).get(t.queryHash);n&&(t.destroy(),n===t&&M(this,en).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ht.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return M(this,en).get(t)}getAll(){return[...M(this,en).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Lp(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Lp(t,r)):n}notify(t){ht.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ht.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ht.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},en=new WeakMap,Yx),dt,Xn,Yn,$a,_a,er,Ka,Ba,eg,Jw=(eg=class{constructor(e={}){me(this,dt);me(this,Xn);me(this,Yn);me(this,$a);me(this,_a);me(this,er);me(this,Ka);me(this,Ba);te(this,dt,e.queryCache||new Zw),te(this,Xn,e.mutationCache||new Qw),te(this,Yn,e.defaultOptions||{}),te(this,$a,new Map),te(this,_a,new Map),te(this,er,0)}mount(){Ll(this,er)._++,M(this,er)===1&&(te(this,Ka,Xm.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(this,dt).onFocus())})),te(this,Ba,Go.subscribe(async e=>{e&&(await this.resumePausedMutations(),M(this,dt).onOnline())})))}unmount(){var e,t;Ll(this,er)._--,M(this,er)===0&&((e=M(this,Ka))==null||e.call(this),te(this,Ka,void 0),(t=M(this,Ba))==null||t.call(this),te(this,Ba,void 0))}isFetching(e){return M(this,dt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return M(this,Xn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=M(this,dt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=M(this,dt).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(hr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return M(this,dt).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),a=M(this,dt).get(r.queryHash),i=a==null?void 0:a.state.data,l=Aw(t,i);if(l!==void 0)return M(this,dt).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return ht.batch(()=>M(this,dt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=M(this,dt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=M(this,dt);ht.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=M(this,dt);return ht.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ht.batch(()=>M(this,dt).findAll(e).map(a=>a.cancel(n)));return Promise.all(r).then(_t).catch(_t)}invalidateQueries(e,t={}){return ht.batch(()=>(M(this,dt).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ht.batch(()=>M(this,dt).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,n);return n.throwOnError||(i=i.catch(_t)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(_t)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=M(this,dt).build(this,t);return n.isStaleByTime(hr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_t).catch(_t)}fetchInfiniteQuery(e){return e.behavior=qp(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_t).catch(_t)}ensureInfiniteQueryData(e){return e.behavior=qp(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Go.isOnline()?M(this,Xn).resumePausedMutations():Promise.resolve()}getQueryCache(){return M(this,dt)}getMutationCache(){return M(this,Xn)}getDefaultOptions(){return M(this,Yn)}setDefaultOptions(e){te(this,Yn,e)}setQueryDefaults(e,t){M(this,$a).set(Zr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...M(this,$a).values()],n={};return t.forEach(r=>{nl(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){M(this,_a).set(Zr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...M(this,_a).values()],n={};return t.forEach(r=>{nl(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...M(this,Yn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Wm(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Zm&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...M(this,Yn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){M(this,dt).clear(),M(this,Xn).clear()}},dt=new WeakMap,Xn=new WeakMap,Yn=new WeakMap,$a=new WeakMap,_a=new WeakMap,er=new WeakMap,Ka=new WeakMap,Ba=new WeakMap,eg),M0=j.createContext(void 0),ge=e=>{const t=j.useContext(M0);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Xw=({client:e,children:t})=>(j.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(M0.Provider,{value:e,children:t})),T0=j.createContext(!1),F0=()=>j.useContext(T0);T0.Provider;function Yw(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var e1=j.createContext(Yw()),I0=()=>j.useContext(e1),R0=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Jm(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},L0=e=>{j.useEffect(()=>{e.clearReset()},[e])},O0=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||Jm(n,[e.error,r])),z0=e=>{if(e.suspense){const n=a=>a==="static"?a:Math.max(a??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...a)=>n(r(...a)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},$0=(e,t)=>e.isLoading&&e.isFetching&&!t,Ou=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Zo=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function t1({queries:e,...t},n){const r=ge(),a=F0(),i=I0(),l=j.useMemo(()=>e.map(p=>{const b=r.defaultQueryOptions(p);return b._optimisticResults=a?"isRestoring":"optimistic",b}),[e,r,a]);l.forEach(p=>{z0(p);const b=r.getQueryCache().get(p.queryHash);R0(p,i,b)}),L0(i);const[o]=j.useState(()=>new Gw(r,l,t)),[c,d,u]=o.getOptimisticResult(l,t.combine),h=!a&&t.subscribed!==!1;j.useSyncExternalStore(j.useCallback(p=>h?o.subscribe(ht.batchCalls(p)):_t,[o,h]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),j.useEffect(()=>{o.setQueries(l,t)},[l,t,o]);const m=c.some((p,b)=>Ou(l[b],p))?c.flatMap((p,b)=>{const g=l[b];if(g){const y=new Ym(r,g);if(Ou(g,p))return Zo(g,y,i);$0(p,a)&&Zo(g,y,i)}return[]}):[];if(m.length>0)throw Promise.all(m);const f=c.find((p,b)=>{const g=l[b];return g&&O0({result:p,errorResetBoundary:i,throwOnError:g.throwOnError,query:r.getQueryCache().get(g.queryHash),suspense:g.suspense})});if(f!=null&&f.error)throw f.error;return d(u())}function s1(e,t,n){var x,m,f,p;const r=F0(),a=I0(),i=ge(),l=i.defaultQueryOptions(e);(m=(x=i.getDefaultOptions().queries)==null?void 0:x._experimental_beforeQuery)==null||m.call(x,l);const o=i.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",z0(l),R0(l,a,o),L0(a);const c=!i.getQueryCache().get(l.queryHash),[d]=j.useState(()=>new t(i,l)),u=d.getOptimisticResult(l),h=!r&&e.subscribed!==!1;if(j.useSyncExternalStore(j.useCallback(b=>{const g=h?d.subscribe(ht.batchCalls(b)):_t;return d.updateResult(),g},[d,h]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),j.useEffect(()=>{d.setOptions(l)},[l,d]),Ou(l,u))throw Zo(l,d,a);if(O0({result:u,errorResetBoundary:a,throwOnError:l.throwOnError,query:o,suspense:l.suspense}))throw u.error;if((p=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_afterQuery)==null||p.call(f,l,u),l.experimental_prefetchInRender&&!Gr&&$0(u,r)){const b=c?Zo(l,d,a):o==null?void 0:o.promise;b==null||b.catch(_t).finally(()=>{d.updateResult()})}return l.notifyOnChangeProps?u:d.trackResult(u)}function fe(e,t){return s1(e,Ym)}function G(e,t){const n=ge(),[r]=j.useState(()=>new Hw(n,e));j.useEffect(()=>{r.setOptions(e)},[r,e]);const a=j.useSyncExternalStore(j.useCallback(l=>r.subscribe(ht.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=j.useCallback((l,o)=>{r.mutate(l,o).catch(_t)},[r]);if(a.error&&Jm(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:i,mutateAsync:a.mutate}}let n1={data:""},r1=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||n1},a1=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,i1=/\/\*[^]*?\*\/| +/g,Hp=/\n+/g,Un=(e,t)=>{let n="",r="",a="";for(let i in e){let l=e[i];i[0]=="@"?i[1]=="i"?n=i+" "+l+";":r+=i[1]=="f"?Un(l,i):i+"{"+Un(l,i[1]=="k"?"":t)+"}":typeof l=="object"?r+=Un(l,t?t.replace(/([^,])+/g,o=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,o):o?o+" "+c:c)):i):l!=null&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=Un.p?Un.p(i,l):i+":"+l+";")}return n+(t&&a?t+"{"+a+"}":a)+r},un={},_0=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+_0(e[n]);return t}return e},l1=(e,t,n,r,a)=>{let i=_0(e),l=un[i]||(un[i]=(c=>{let d=0,u=11;for(;d>>0;return"go"+u})(i));if(!un[l]){let c=i!==e?e:(d=>{let u,h,x=[{}];for(;u=a1.exec(d.replace(i1,""));)u[4]?x.shift():u[3]?(h=u[3].replace(Hp," ").trim(),x.unshift(x[0][h]=x[0][h]||{})):x[0][u[1]]=u[2].replace(Hp," ").trim();return x[0]})(e);un[l]=Un(a?{["@keyframes "+l]:c}:c,n?"":"."+l)}let o=n&&un.g?un.g:null;return n&&(un.g=un[l]),((c,d,u,h)=>{h?d.data=d.data.replace(h,c):d.data.indexOf(c)===-1&&(d.data=u?c+d.data:d.data+c)})(un[l],t,r,o),l},o1=(e,t,n)=>e.reduce((r,a,i)=>{let l=t[i];if(l&&l.call){let o=l(n),c=o&&o.props&&o.props.className||/^go/.test(o)&&o;l=c?"."+c:o&&typeof o=="object"?o.props?"":Un(o,""):o===!1?"":o}return r+a+(l??"")},"");function Sc(e){let t=this||{},n=e.call?e(t.p):e;return l1(n.unshift?n.raw?o1(n,[].slice.call(arguments,1),t.p):n.reduce((r,a)=>Object.assign(r,a&&a.call?a(t.p):a),{}):n,r1(t.target),t.g,t.o,t.k)}let K0,zu,$u;Sc.bind({g:1});let An=Sc.bind({k:1});function c1(e,t,n,r){Un.p=t,K0=e,zu=n,$u=r}function jr(e,t){let n=this||{};return function(){let r=arguments;function a(i,l){let o=Object.assign({},i),c=o.className||a.className;n.p=Object.assign({theme:zu&&zu()},o),n.o=/ *go\d+/.test(c),o.className=Sc.apply(n,r)+(c?" "+c:"");let d=e;return e[0]&&(d=o.as||e,delete o.as),$u&&d[0]&&$u(o),K0(d,o)}return a}}var d1=e=>typeof e=="function",Jo=(e,t)=>d1(e)?e(t):e,u1=(()=>{let e=0;return()=>(++e).toString()})(),B0=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),m1=20,th="default",U0=(e,t)=>{let{toastLimit:n}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,n)};case 1:return{...e,toasts:e.toasts.map(l=>l.id===t.toast.id?{...l,...t.toast}:l)};case 2:let{toast:r}=t;return U0(e,{type:e.toasts.find(l=>l.id===r.id)?1:0,toast:r});case 3:let{toastId:a}=t;return{...e,toasts:e.toasts.map(l=>l.id===a||a===void 0?{...l,dismissed:!0,visible:!1}:l)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(l=>l.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(l=>({...l,pauseDuration:l.pauseDuration+i}))}}},yo=[],q0={toasts:[],pausedAt:void 0,settings:{toastLimit:m1}},sn={},V0=(e,t=th)=>{sn[t]=U0(sn[t]||q0,e),yo.forEach(([n,r])=>{n===t&&r(sn[t])})},Q0=e=>Object.keys(sn).forEach(t=>V0(e,t)),h1=e=>Object.keys(sn).find(t=>sn[t].toasts.some(n=>n.id===e)),kc=(e=th)=>t=>{V0(t,e)},f1={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},p1=(e={},t=th)=>{let[n,r]=j.useState(sn[t]||q0),a=j.useRef(sn[t]);j.useEffect(()=>(a.current!==sn[t]&&r(sn[t]),yo.push([t,r]),()=>{let l=yo.findIndex(([o])=>o===t);l>-1&&yo.splice(l,1)}),[t]);let i=n.toasts.map(l=>{var o,c,d;return{...e,...e[l.type],...l,removeDelay:l.removeDelay||((o=e[l.type])==null?void 0:o.removeDelay)||(e==null?void 0:e.removeDelay),duration:l.duration||((c=e[l.type])==null?void 0:c.duration)||(e==null?void 0:e.duration)||f1[l.type],style:{...e.style,...(d=e[l.type])==null?void 0:d.style,...l.style}}});return{...n,toasts:i}},x1=(e,t="blank",n)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...n,id:(n==null?void 0:n.id)||u1()}),kl=e=>(t,n)=>{let r=x1(t,e,n);return kc(r.toasterId||h1(r.id))({type:2,toast:r}),r.id},wt=(e,t)=>kl("blank")(e,t);wt.error=kl("error");wt.success=kl("success");wt.loading=kl("loading");wt.custom=kl("custom");wt.dismiss=(e,t)=>{let n={type:3,toastId:e};t?kc(t)(n):Q0(n)};wt.dismissAll=e=>wt.dismiss(void 0,e);wt.remove=(e,t)=>{let n={type:4,toastId:e};t?kc(t)(n):Q0(n)};wt.removeAll=e=>wt.remove(void 0,e);wt.promise=(e,t,n)=>{let r=wt.loading(t.loading,{...n,...n==null?void 0:n.loading});return typeof e=="function"&&(e=e()),e.then(a=>{let i=t.success?Jo(t.success,a):void 0;return i?wt.success(i,{id:r,...n,...n==null?void 0:n.success}):wt.dismiss(r),a}).catch(a=>{let i=t.error?Jo(t.error,a):void 0;i?wt.error(i,{id:r,...n,...n==null?void 0:n.error}):wt.dismiss(r)}),e};var g1=1e3,y1=(e,t="default")=>{let{toasts:n,pausedAt:r}=p1(e,t),a=j.useRef(new Map).current,i=j.useCallback((h,x=g1)=>{if(a.has(h))return;let m=setTimeout(()=>{a.delete(h),l({type:4,toastId:h})},x);a.set(h,m)},[]);j.useEffect(()=>{if(r)return;let h=Date.now(),x=n.map(m=>{if(m.duration===1/0)return;let f=(m.duration||0)+m.pauseDuration-(h-m.createdAt);if(f<0){m.visible&&wt.dismiss(m.id);return}return setTimeout(()=>wt.dismiss(m.id,t),f)});return()=>{x.forEach(m=>m&&clearTimeout(m))}},[n,r,t]);let l=j.useCallback(kc(t),[t]),o=j.useCallback(()=>{l({type:5,time:Date.now()})},[l]),c=j.useCallback((h,x)=>{l({type:1,toast:{id:h,height:x}})},[l]),d=j.useCallback(()=>{r&&l({type:6,time:Date.now()})},[r,l]),u=j.useCallback((h,x)=>{let{reverseOrder:m=!1,gutter:f=8,defaultPosition:p}=x||{},b=n.filter(v=>(v.position||p)===(h.position||p)&&v.height),g=b.findIndex(v=>v.id===h.id),y=b.filter((v,N)=>Nv.visible).slice(...m?[y+1]:[0,y]).reduce((v,N)=>v+(N.height||0)+f,0)},[n]);return j.useEffect(()=>{n.forEach(h=>{if(h.dismissed)i(h.id,h.removeDelay);else{let x=a.get(h.id);x&&(clearTimeout(x),a.delete(h.id))}})},[n,i]),{toasts:n,handlers:{updateHeight:c,startPause:o,endPause:d,calculateOffset:u}}},v1=An` -from { - transform: scale(0) rotate(45deg); - opacity: 0; -} -to { - transform: scale(1) rotate(45deg); - opacity: 1; -}`,j1=An` -from { - transform: scale(0); - opacity: 0; -} -to { - transform: scale(1); - opacity: 1; -}`,b1=An` -from { - transform: scale(0) rotate(90deg); - opacity: 0; -} -to { - transform: scale(1) rotate(90deg); - opacity: 1; -}`,N1=jr("div")` - width: 20px; - opacity: 0; - height: 20px; - border-radius: 10px; - background: ${e=>e.primary||"#ff4b4b"}; - position: relative; - transform: rotate(45deg); - - animation: ${v1} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) - forwards; - animation-delay: 100ms; - - &:after, - &:before { - content: ''; - animation: ${j1} 0.15s ease-out forwards; - animation-delay: 150ms; - position: absolute; - border-radius: 3px; - opacity: 0; - background: ${e=>e.secondary||"#fff"}; - bottom: 9px; - left: 4px; - height: 2px; - width: 12px; - } - - &:before { - animation: ${b1} 0.15s ease-out forwards; - animation-delay: 180ms; - transform: rotate(90deg); - } -`,w1=An` - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -`,S1=jr("div")` - width: 12px; - height: 12px; - box-sizing: border-box; - border: 2px solid; - border-radius: 100%; - border-color: ${e=>e.secondary||"#e0e0e0"}; - border-right-color: ${e=>e.primary||"#616161"}; - animation: ${w1} 1s linear infinite; -`,k1=An` -from { - transform: scale(0) rotate(45deg); - opacity: 0; -} -to { - transform: scale(1) rotate(45deg); - opacity: 1; -}`,C1=An` -0% { - height: 0; - width: 0; - opacity: 0; -} -40% { - height: 0; - width: 6px; - opacity: 1; -} -100% { - opacity: 1; - height: 10px; -}`,E1=jr("div")` - width: 20px; - opacity: 0; - height: 20px; - border-radius: 10px; - background: ${e=>e.primary||"#61d345"}; - position: relative; - transform: rotate(45deg); - - animation: ${k1} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) - forwards; - animation-delay: 100ms; - &:after { - content: ''; - box-sizing: border-box; - animation: ${C1} 0.2s ease-out forwards; - opacity: 0; - animation-delay: 200ms; - position: absolute; - border-right: 2px solid; - border-bottom: 2px solid; - border-color: ${e=>e.secondary||"#fff"}; - bottom: 6px; - left: 6px; - height: 10px; - width: 6px; - } -`,D1=jr("div")` - position: absolute; -`,P1=jr("div")` - position: relative; - display: flex; - justify-content: center; - align-items: center; - min-width: 20px; - min-height: 20px; -`,A1=An` -from { - transform: scale(0.6); - opacity: 0.4; -} -to { - transform: scale(1); - opacity: 1; -}`,M1=jr("div")` - position: relative; - transform: scale(0.6); - opacity: 0.4; - min-width: 20px; - animation: ${A1} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) - forwards; -`,T1=({toast:e})=>{let{icon:t,type:n,iconTheme:r}=e;return t!==void 0?typeof t=="string"?j.createElement(M1,null,t):t:n==="blank"?null:j.createElement(P1,null,j.createElement(S1,{...r}),n!=="loading"&&j.createElement(D1,null,n==="error"?j.createElement(N1,{...r}):j.createElement(E1,{...r})))},F1=e=>` -0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;} -100% {transform: translate3d(0,0,0) scale(1); opacity:1;} -`,I1=e=>` -0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} -100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;} -`,R1="0%{opacity:0;} 100%{opacity:1;}",L1="0%{opacity:1;} 100%{opacity:0;}",O1=jr("div")` - display: flex; - align-items: center; - background: #fff; - color: #363636; - line-height: 1.3; - will-change: transform; - box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); - max-width: 350px; - pointer-events: auto; - padding: 8px 10px; - border-radius: 8px; -`,z1=jr("div")` - display: flex; - justify-content: center; - margin: 4px 10px; - color: inherit; - flex: 1 1 auto; - white-space: pre-line; -`,$1=(e,t)=>{let n=e.includes("top")?1:-1,[r,a]=B0()?[R1,L1]:[F1(n),I1(n)];return{animation:t?`${An(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${An(a)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},_1=j.memo(({toast:e,position:t,style:n,children:r})=>{let a=e.height?$1(e.position||t||"top-center",e.visible):{opacity:0},i=j.createElement(T1,{toast:e}),l=j.createElement(z1,{...e.ariaProps},Jo(e.message,e));return j.createElement(O1,{className:e.className,style:{...a,...n,...e.style}},typeof r=="function"?r({icon:i,message:l}):j.createElement(j.Fragment,null,i,l))});c1(j.createElement);var K1=({id:e,className:t,style:n,onHeightUpdate:r,children:a})=>{let i=j.useCallback(l=>{if(l){let o=()=>{let c=l.getBoundingClientRect().height;r(e,c)};o(),new MutationObserver(o).observe(l,{subtree:!0,childList:!0,characterData:!0})}},[e,r]);return j.createElement("div",{ref:i,className:t,style:n},a)},B1=(e,t)=>{let n=e.includes("top"),r=n?{top:0}:{bottom:0},a=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:B0()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(n?1:-1)}px)`,...r,...a}},U1=Sc` - z-index: 9999; - > * { - pointer-events: auto; - } -`,to=16,q1=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:a,toasterId:i,containerStyle:l,containerClassName:o})=>{let{toasts:c,handlers:d}=y1(n,i);return j.createElement("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:to,left:to,right:to,bottom:to,pointerEvents:"none",...l},className:o,onMouseEnter:d.startPause,onMouseLeave:d.endPause},c.map(u=>{let h=u.position||t,x=d.calculateOffset(u,{reverseOrder:e,gutter:r,defaultPosition:t}),m=B1(h,x);return j.createElement(K1,{id:u.id,key:u.id,onHeightUpdate:d.updateHeight,className:u.visible?U1:"",style:m},u.type==="custom"?Jo(u.message,u):a?a(u):j.createElement(_1,{toast:u,position:h}))}))},Re=wt;function H0(e,t){return function(){return e.apply(t,arguments)}}const{toString:V1}=Object.prototype,{getPrototypeOf:sh}=Object,{iterator:Cc,toStringTag:W0}=Symbol,Ec=(e=>t=>{const n=V1.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Qs=e=>(e=e.toLowerCase(),t=>Ec(t)===e),Dc=e=>t=>typeof t===e,{isArray:ri}=Array,Ja=Dc("undefined");function Cl(e){return e!==null&&!Ja(e)&&e.constructor!==null&&!Ja(e.constructor)&&us(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const G0=Qs("ArrayBuffer");function Q1(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&G0(e.buffer),t}const H1=Dc("string"),us=Dc("function"),Z0=Dc("number"),El=e=>e!==null&&typeof e=="object",W1=e=>e===!0||e===!1,vo=e=>{if(Ec(e)!=="object")return!1;const t=sh(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(W0 in e)&&!(Cc in e)},G1=e=>{if(!El(e)||Cl(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Z1=Qs("Date"),J1=Qs("File"),X1=Qs("Blob"),Y1=Qs("FileList"),eS=e=>El(e)&&us(e.pipe),tS=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||us(e.append)&&((t=Ec(e))==="formdata"||t==="object"&&us(e.toString)&&e.toString()==="[object FormData]"))},sS=Qs("URLSearchParams"),[nS,rS,aS,iS]=["ReadableStream","Request","Response","Headers"].map(Qs),lS=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Dl(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,a;if(typeof e!="object"&&(e=[e]),ri(e))for(r=0,a=e.length;r0;)if(a=n[r],t===a.toLowerCase())return a;return null}const Pr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,X0=e=>!Ja(e)&&e!==Pr;function _u(){const{caseless:e,skipUndefined:t}=X0(this)&&this||{},n={},r=(a,i)=>{const l=e&&J0(n,i)||i;vo(n[l])&&vo(a)?n[l]=_u(n[l],a):vo(a)?n[l]=_u({},a):ri(a)?n[l]=a.slice():(!t||!Ja(a))&&(n[l]=a)};for(let a=0,i=arguments.length;a(Dl(t,(a,i)=>{n&&us(a)?e[i]=H0(a,n):e[i]=a},{allOwnKeys:r}),e),cS=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),dS=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},uS=(e,t,n,r)=>{let a,i,l;const o={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),i=a.length;i-- >0;)l=a[i],(!r||r(l,e,t))&&!o[l]&&(t[l]=e[l],o[l]=!0);e=n!==!1&&sh(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},mS=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},hS=e=>{if(!e)return null;if(ri(e))return e;let t=e.length;if(!Z0(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},fS=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&sh(Uint8Array)),pS=(e,t)=>{const r=(e&&e[Cc]).call(e);let a;for(;(a=r.next())&&!a.done;){const i=a.value;t.call(e,i[0],i[1])}},xS=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},gS=Qs("HTMLFormElement"),yS=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,a){return r.toUpperCase()+a}),Wp=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),vS=Qs("RegExp"),Y0=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Dl(n,(a,i)=>{let l;(l=t(a,i,e))!==!1&&(r[i]=l||a)}),Object.defineProperties(e,r)},jS=e=>{Y0(e,(t,n)=>{if(us(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(us(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},bS=(e,t)=>{const n={},r=a=>{a.forEach(i=>{n[i]=!0})};return ri(e)?r(e):r(String(e).split(t)),n},NS=()=>{},wS=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function SS(e){return!!(e&&us(e.append)&&e[W0]==="FormData"&&e[Cc])}const kS=e=>{const t=new Array(10),n=(r,a)=>{if(El(r)){if(t.indexOf(r)>=0)return;if(Cl(r))return r;if(!("toJSON"in r)){t[a]=r;const i=ri(r)?[]:{};return Dl(r,(l,o)=>{const c=n(l,a+1);!Ja(c)&&(i[o]=c)}),t[a]=void 0,i}}return r};return n(e,0)},CS=Qs("AsyncFunction"),ES=e=>e&&(El(e)||us(e))&&us(e.then)&&us(e.catch),ev=((e,t)=>e?setImmediate:t?((n,r)=>(Pr.addEventListener("message",({source:a,data:i})=>{a===Pr&&i===n&&r.length&&r.shift()()},!1),a=>{r.push(a),Pr.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",us(Pr.postMessage)),DS=typeof queueMicrotask<"u"?queueMicrotask.bind(Pr):typeof process<"u"&&process.nextTick||ev,PS=e=>e!=null&&us(e[Cc]),V={isArray:ri,isArrayBuffer:G0,isBuffer:Cl,isFormData:tS,isArrayBufferView:Q1,isString:H1,isNumber:Z0,isBoolean:W1,isObject:El,isPlainObject:vo,isEmptyObject:G1,isReadableStream:nS,isRequest:rS,isResponse:aS,isHeaders:iS,isUndefined:Ja,isDate:Z1,isFile:J1,isBlob:X1,isRegExp:vS,isFunction:us,isStream:eS,isURLSearchParams:sS,isTypedArray:fS,isFileList:Y1,forEach:Dl,merge:_u,extend:oS,trim:lS,stripBOM:cS,inherits:dS,toFlatObject:uS,kindOf:Ec,kindOfTest:Qs,endsWith:mS,toArray:hS,forEachEntry:pS,matchAll:xS,isHTMLForm:gS,hasOwnProperty:Wp,hasOwnProp:Wp,reduceDescriptors:Y0,freezeMethods:jS,toObjectSet:bS,toCamelCase:yS,noop:NS,toFiniteNumber:wS,findKey:J0,global:Pr,isContextDefined:X0,isSpecCompliantForm:SS,toJSONObject:kS,isAsyncFn:CS,isThenable:ES,setImmediate:ev,asap:DS,isIterable:PS};function Se(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}V.inherits(Se,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:V.toJSONObject(this.config),code:this.code,status:this.status}}});const tv=Se.prototype,sv={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{sv[e]={value:e}});Object.defineProperties(Se,sv);Object.defineProperty(tv,"isAxiosError",{value:!0});Se.from=(e,t,n,r,a,i)=>{const l=Object.create(tv);V.toFlatObject(e,l,function(u){return u!==Error.prototype},d=>d!=="isAxiosError");const o=e&&e.message?e.message:"Error",c=t==null&&e?e.code:t;return Se.call(l,o,c,n,r,a),e&&l.cause==null&&Object.defineProperty(l,"cause",{value:e,configurable:!0}),l.name=e&&e.name||"Error",i&&Object.assign(l,i),l};const AS=null;function Ku(e){return V.isPlainObject(e)||V.isArray(e)}function nv(e){return V.endsWith(e,"[]")?e.slice(0,-2):e}function Gp(e,t,n){return e?e.concat(t).map(function(a,i){return a=nv(a),!n&&i?"["+a+"]":a}).join(n?".":""):t}function MS(e){return V.isArray(e)&&!e.some(Ku)}const TS=V.toFlatObject(V,{},null,function(t){return/^is[A-Z]/.test(t)});function Pc(e,t,n){if(!V.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=V.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,b){return!V.isUndefined(b[p])});const r=n.metaTokens,a=n.visitor||u,i=n.dots,l=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&V.isSpecCompliantForm(t);if(!V.isFunction(a))throw new TypeError("visitor must be a function");function d(f){if(f===null)return"";if(V.isDate(f))return f.toISOString();if(V.isBoolean(f))return f.toString();if(!c&&V.isBlob(f))throw new Se("Blob is not supported. Use a Buffer instead.");return V.isArrayBuffer(f)||V.isTypedArray(f)?c&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,p,b){let g=f;if(f&&!b&&typeof f=="object"){if(V.endsWith(p,"{}"))p=r?p:p.slice(0,-2),f=JSON.stringify(f);else if(V.isArray(f)&&MS(f)||(V.isFileList(f)||V.endsWith(p,"[]"))&&(g=V.toArray(f)))return p=nv(p),g.forEach(function(v,N){!(V.isUndefined(v)||v===null)&&t.append(l===!0?Gp([p],N,i):l===null?p:p+"[]",d(v))}),!1}return Ku(f)?!0:(t.append(Gp(b,p,i),d(f)),!1)}const h=[],x=Object.assign(TS,{defaultVisitor:u,convertValue:d,isVisitable:Ku});function m(f,p){if(!V.isUndefined(f)){if(h.indexOf(f)!==-1)throw Error("Circular reference detected in "+p.join("."));h.push(f),V.forEach(f,function(g,y){(!(V.isUndefined(g)||g===null)&&a.call(t,g,V.isString(y)?y.trim():y,p,x))===!0&&m(g,p?p.concat(y):[y])}),h.pop()}}if(!V.isObject(e))throw new TypeError("data must be an object");return m(e),t}function Zp(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function nh(e,t){this._pairs=[],e&&Pc(e,this,t)}const rv=nh.prototype;rv.append=function(t,n){this._pairs.push([t,n])};rv.toString=function(t){const n=t?function(r){return t.call(this,r,Zp)}:Zp;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function FS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function av(e,t,n){if(!t)return e;const r=n&&n.encode||FS;V.isFunction(n)&&(n={serialize:n});const a=n&&n.serialize;let i;if(a?i=a(t,n):i=V.isURLSearchParams(t)?t.toString():new nh(t,n).toString(r),i){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Jp{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){V.forEach(this.handlers,function(r){r!==null&&t(r)})}}const iv={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},IS=typeof URLSearchParams<"u"?URLSearchParams:nh,RS=typeof FormData<"u"?FormData:null,LS=typeof Blob<"u"?Blob:null,OS={isBrowser:!0,classes:{URLSearchParams:IS,FormData:RS,Blob:LS},protocols:["http","https","file","blob","url","data"]},rh=typeof window<"u"&&typeof document<"u",Bu=typeof navigator=="object"&&navigator||void 0,zS=rh&&(!Bu||["ReactNative","NativeScript","NS"].indexOf(Bu.product)<0),$S=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",_S=rh&&window.location.href||"http://localhost",KS=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:rh,hasStandardBrowserEnv:zS,hasStandardBrowserWebWorkerEnv:$S,navigator:Bu,origin:_S},Symbol.toStringTag,{value:"Module"})),Bt={...KS,...OS};function BS(e,t){return Pc(e,new Bt.classes.URLSearchParams,{visitor:function(n,r,a,i){return Bt.isNode&&V.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function US(e){return V.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function qS(e){const t={},n=Object.keys(e);let r;const a=n.length;let i;for(r=0;r=n.length;return l=!l&&V.isArray(a)?a.length:l,c?(V.hasOwnProp(a,l)?a[l]=[a[l],r]:a[l]=r,!o):((!a[l]||!V.isObject(a[l]))&&(a[l]=[]),t(n,r,a[l],i)&&V.isArray(a[l])&&(a[l]=qS(a[l])),!o)}if(V.isFormData(e)&&V.isFunction(e.entries)){const n={};return V.forEachEntry(e,(r,a)=>{t(US(r),a,n,0)}),n}return null}function VS(e,t,n){if(V.isString(e))try{return(t||JSON.parse)(e),V.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Pl={transitional:iv,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",a=r.indexOf("application/json")>-1,i=V.isObject(t);if(i&&V.isHTMLForm(t)&&(t=new FormData(t)),V.isFormData(t))return a?JSON.stringify(lv(t)):t;if(V.isArrayBuffer(t)||V.isBuffer(t)||V.isStream(t)||V.isFile(t)||V.isBlob(t)||V.isReadableStream(t))return t;if(V.isArrayBufferView(t))return t.buffer;if(V.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return BS(t,this.formSerializer).toString();if((o=V.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Pc(o?{"files[]":t}:t,c&&new c,this.formSerializer)}}return i||a?(n.setContentType("application/json",!1),VS(t)):t}],transformResponse:[function(t){const n=this.transitional||Pl.transitional,r=n&&n.forcedJSONParsing,a=this.responseType==="json";if(V.isResponse(t)||V.isReadableStream(t))return t;if(t&&V.isString(t)&&(r&&!this.responseType||a)){const l=!(n&&n.silentJSONParsing)&&a;try{return JSON.parse(t,this.parseReviver)}catch(o){if(l)throw o.name==="SyntaxError"?Se.from(o,Se.ERR_BAD_RESPONSE,this,null,this.response):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Bt.classes.FormData,Blob:Bt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};V.forEach(["delete","get","head","post","put","patch"],e=>{Pl.headers[e]={}});const QS=V.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),HS=e=>{const t={};let n,r,a;return e&&e.split(` -`).forEach(function(l){a=l.indexOf(":"),n=l.substring(0,a).trim().toLowerCase(),r=l.substring(a+1).trim(),!(!n||t[n]&&QS[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Xp=Symbol("internals");function yi(e){return e&&String(e).trim().toLowerCase()}function jo(e){return e===!1||e==null?e:V.isArray(e)?e.map(jo):String(e)}function WS(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const GS=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ud(e,t,n,r,a){if(V.isFunction(r))return r.call(this,t,n);if(a&&(t=n),!!V.isString(t)){if(V.isString(r))return t.indexOf(r)!==-1;if(V.isRegExp(r))return r.test(t)}}function ZS(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function JS(e,t){const n=V.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(a,i,l){return this[r].call(this,t,a,i,l)},configurable:!0})})}let ms=class{constructor(t){t&&this.set(t)}set(t,n,r){const a=this;function i(o,c,d){const u=yi(c);if(!u)throw new Error("header name must be a non-empty string");const h=V.findKey(a,u);(!h||a[h]===void 0||d===!0||d===void 0&&a[h]!==!1)&&(a[h||c]=jo(o))}const l=(o,c)=>V.forEach(o,(d,u)=>i(d,u,c));if(V.isPlainObject(t)||t instanceof this.constructor)l(t,n);else if(V.isString(t)&&(t=t.trim())&&!GS(t))l(HS(t),n);else if(V.isObject(t)&&V.isIterable(t)){let o={},c,d;for(const u of t){if(!V.isArray(u))throw TypeError("Object iterator must return a key-value pair");o[d=u[0]]=(c=o[d])?V.isArray(c)?[...c,u[1]]:[c,u[1]]:u[1]}l(o,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=yi(t),t){const r=V.findKey(this,t);if(r){const a=this[r];if(!n)return a;if(n===!0)return WS(a);if(V.isFunction(n))return n.call(this,a,r);if(V.isRegExp(n))return n.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=yi(t),t){const r=V.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||ud(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let a=!1;function i(l){if(l=yi(l),l){const o=V.findKey(r,l);o&&(!n||ud(r,r[o],o,n))&&(delete r[o],a=!0)}}return V.isArray(t)?t.forEach(i):i(t),a}clear(t){const n=Object.keys(this);let r=n.length,a=!1;for(;r--;){const i=n[r];(!t||ud(this,this[i],i,t,!0))&&(delete this[i],a=!0)}return a}normalize(t){const n=this,r={};return V.forEach(this,(a,i)=>{const l=V.findKey(r,i);if(l){n[l]=jo(a),delete n[i];return}const o=t?ZS(i):String(i).trim();o!==i&&delete n[i],n[o]=jo(a),r[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return V.forEach(this,(r,a)=>{r!=null&&r!==!1&&(n[a]=t&&V.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(a=>r.set(a)),r}static accessor(t){const r=(this[Xp]=this[Xp]={accessors:{}}).accessors,a=this.prototype;function i(l){const o=yi(l);r[o]||(JS(a,l),r[o]=!0)}return V.isArray(t)?t.forEach(i):i(t),this}};ms.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);V.reduceDescriptors(ms.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});V.freezeMethods(ms);function md(e,t){const n=this||Pl,r=t||n,a=ms.from(r.headers);let i=r.data;return V.forEach(e,function(o){i=o.call(n,i,a.normalize(),t?t.status:void 0)}),a.normalize(),i}function ov(e){return!!(e&&e.__CANCEL__)}function ai(e,t,n){Se.call(this,e??"canceled",Se.ERR_CANCELED,t,n),this.name="CanceledError"}V.inherits(ai,Se,{__CANCEL__:!0});function cv(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Se("Request failed with status code "+n.status,[Se.ERR_BAD_REQUEST,Se.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function XS(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function YS(e,t){e=e||10;const n=new Array(e),r=new Array(e);let a=0,i=0,l;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),u=r[i];l||(l=d),n[a]=c,r[a]=d;let h=i,x=0;for(;h!==a;)x+=n[h++],h=h%e;if(a=(a+1)%e,a===i&&(i=(i+1)%e),d-l{n=u,a=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),h=u-n;h>=r?l(d,u):(a=d,i||(i=setTimeout(()=>{i=null,l(a)},r-h)))},()=>a&&l(a)]}const Xo=(e,t,n=3)=>{let r=0;const a=YS(50,250);return e2(i=>{const l=i.loaded,o=i.lengthComputable?i.total:void 0,c=l-r,d=a(c),u=l<=o;r=l;const h={loaded:l,total:o,progress:o?l/o:void 0,bytes:c,rate:d||void 0,estimated:d&&o&&u?(o-l)/d:void 0,event:i,lengthComputable:o!=null,[t?"download":"upload"]:!0};e(h)},n)},Yp=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ex=e=>(...t)=>V.asap(()=>e(...t)),t2=Bt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Bt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Bt.origin),Bt.navigator&&/(msie|trident)/i.test(Bt.navigator.userAgent)):()=>!0,s2=Bt.hasStandardBrowserEnv?{write(e,t,n,r,a,i,l){if(typeof document>"u")return;const o=[`${e}=${encodeURIComponent(t)}`];V.isNumber(n)&&o.push(`expires=${new Date(n).toUTCString()}`),V.isString(r)&&o.push(`path=${r}`),V.isString(a)&&o.push(`domain=${a}`),i===!0&&o.push("secure"),V.isString(l)&&o.push(`SameSite=${l}`),document.cookie=o.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function n2(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function r2(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function dv(e,t,n){let r=!n2(t);return e&&(r||n==!1)?r2(e,t):t}const tx=e=>e instanceof ms?{...e}:e;function Jr(e,t){t=t||{};const n={};function r(d,u,h,x){return V.isPlainObject(d)&&V.isPlainObject(u)?V.merge.call({caseless:x},d,u):V.isPlainObject(u)?V.merge({},u):V.isArray(u)?u.slice():u}function a(d,u,h,x){if(V.isUndefined(u)){if(!V.isUndefined(d))return r(void 0,d,h,x)}else return r(d,u,h,x)}function i(d,u){if(!V.isUndefined(u))return r(void 0,u)}function l(d,u){if(V.isUndefined(u)){if(!V.isUndefined(d))return r(void 0,d)}else return r(void 0,u)}function o(d,u,h){if(h in t)return r(d,u);if(h in e)return r(void 0,d)}const c={url:i,method:i,data:i,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:o,headers:(d,u,h)=>a(tx(d),tx(u),h,!0)};return V.forEach(Object.keys({...e,...t}),function(u){const h=c[u]||a,x=h(e[u],t[u],u);V.isUndefined(x)&&h!==o||(n[u]=x)}),n}const uv=e=>{const t=Jr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:i,headers:l,auth:o}=t;if(t.headers=l=ms.from(l),t.url=av(dv(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),o&&l.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),V.isFormData(n)){if(Bt.hasStandardBrowserEnv||Bt.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(V.isFunction(n.getHeaders)){const c=n.getHeaders(),d=["content-type","content-length"];Object.entries(c).forEach(([u,h])=>{d.includes(u.toLowerCase())&&l.set(u,h)})}}if(Bt.hasStandardBrowserEnv&&(r&&V.isFunction(r)&&(r=r(t)),r||r!==!1&&t2(t.url))){const c=a&&i&&s2.read(i);c&&l.set(a,c)}return t},a2=typeof XMLHttpRequest<"u",i2=a2&&function(e){return new Promise(function(n,r){const a=uv(e);let i=a.data;const l=ms.from(a.headers).normalize();let{responseType:o,onUploadProgress:c,onDownloadProgress:d}=a,u,h,x,m,f;function p(){m&&m(),f&&f(),a.cancelToken&&a.cancelToken.unsubscribe(u),a.signal&&a.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(a.method.toUpperCase(),a.url,!0),b.timeout=a.timeout;function g(){if(!b)return;const v=ms.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),E={data:!o||o==="text"||o==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:v,config:e,request:b};cv(function(I){n(I),p()},function(I){r(I),p()},E),b=null}"onloadend"in b?b.onloadend=g:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(g)},b.onabort=function(){b&&(r(new Se("Request aborted",Se.ECONNABORTED,e,b)),b=null)},b.onerror=function(N){const E=N&&N.message?N.message:"Network Error",A=new Se(E,Se.ERR_NETWORK,e,b);A.event=N||null,r(A),b=null},b.ontimeout=function(){let N=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const E=a.transitional||iv;a.timeoutErrorMessage&&(N=a.timeoutErrorMessage),r(new Se(N,E.clarifyTimeoutError?Se.ETIMEDOUT:Se.ECONNABORTED,e,b)),b=null},i===void 0&&l.setContentType(null),"setRequestHeader"in b&&V.forEach(l.toJSON(),function(N,E){b.setRequestHeader(E,N)}),V.isUndefined(a.withCredentials)||(b.withCredentials=!!a.withCredentials),o&&o!=="json"&&(b.responseType=a.responseType),d&&([x,f]=Xo(d,!0),b.addEventListener("progress",x)),c&&b.upload&&([h,m]=Xo(c),b.upload.addEventListener("progress",h),b.upload.addEventListener("loadend",m)),(a.cancelToken||a.signal)&&(u=v=>{b&&(r(!v||v.type?new ai(null,e,b):v),b.abort(),b=null)},a.cancelToken&&a.cancelToken.subscribe(u),a.signal&&(a.signal.aborted?u():a.signal.addEventListener("abort",u)));const y=XS(a.url);if(y&&Bt.protocols.indexOf(y)===-1){r(new Se("Unsupported protocol "+y+":",Se.ERR_BAD_REQUEST,e));return}b.send(i||null)})},l2=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,a;const i=function(d){if(!a){a=!0,o();const u=d instanceof Error?d:this.reason;r.abort(u instanceof Se?u:new ai(u instanceof Error?u.message:u))}};let l=t&&setTimeout(()=>{l=null,i(new Se(`timeout ${t} of ms exceeded`,Se.ETIMEDOUT))},t);const o=()=>{e&&(l&&clearTimeout(l),l=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),e=null)};e.forEach(d=>d.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>V.asap(o),c}},o2=function*(e,t){let n=e.byteLength;if(n{const a=c2(e,t);let i=0,l,o=c=>{l||(l=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await a.next();if(d){o(),c.close();return}let h=u.byteLength;if(n){let x=i+=h;n(x)}c.enqueue(new Uint8Array(u))}catch(d){throw o(d),d}},cancel(c){return o(c),a.return()}},{highWaterMark:2})},nx=64*1024,{isFunction:so}=V,u2=(({Request:e,Response:t})=>({Request:e,Response:t}))(V.global),{ReadableStream:rx,TextEncoder:ax}=V.global,ix=(e,...t)=>{try{return!!e(...t)}catch{return!1}},m2=e=>{e=V.merge.call({skipUndefined:!0},u2,e);const{fetch:t,Request:n,Response:r}=e,a=t?so(t):typeof fetch=="function",i=so(n),l=so(r);if(!a)return!1;const o=a&&so(rx),c=a&&(typeof ax=="function"?(f=>p=>f.encode(p))(new ax):async f=>new Uint8Array(await new n(f).arrayBuffer())),d=i&&o&&ix(()=>{let f=!1;const p=new n(Bt.origin,{body:new rx,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!p}),u=l&&o&&ix(()=>V.isReadableStream(new r("").body)),h={stream:u&&(f=>f.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!h[f]&&(h[f]=(p,b)=>{let g=p&&p[f];if(g)return g.call(p);throw new Se(`Response type '${f}' is not supported`,Se.ERR_NOT_SUPPORT,b)})});const x=async f=>{if(f==null)return 0;if(V.isBlob(f))return f.size;if(V.isSpecCompliantForm(f))return(await new n(Bt.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(V.isArrayBufferView(f)||V.isArrayBuffer(f))return f.byteLength;if(V.isURLSearchParams(f)&&(f=f+""),V.isString(f))return(await c(f)).byteLength},m=async(f,p)=>{const b=V.toFiniteNumber(f.getContentLength());return b??x(p)};return async f=>{let{url:p,method:b,data:g,signal:y,cancelToken:v,timeout:N,onDownloadProgress:E,onUploadProgress:A,responseType:I,headers:w,withCredentials:S="same-origin",fetchOptions:P}=uv(f),O=t||fetch;I=I?(I+"").toLowerCase():"text";let R=l2([y,v&&v.toAbortSignal()],N),q=null;const D=R&&R.unsubscribe&&(()=>{R.unsubscribe()});let z;try{if(A&&d&&b!=="get"&&b!=="head"&&(z=await m(w,g))!==0){let le=new n(p,{method:"POST",body:g,duplex:"half"}),de;if(V.isFormData(g)&&(de=le.headers.get("content-type"))&&w.setContentType(de),le.body){const[_e,qe]=Yp(z,Xo(ex(A)));g=sx(le.body,nx,_e,qe)}}V.isString(S)||(S=S?"include":"omit");const k=i&&"credentials"in n.prototype,K={...P,signal:R,method:b.toUpperCase(),headers:w.normalize().toJSON(),body:g,duplex:"half",credentials:k?S:void 0};q=i&&new n(p,K);let B=await(i?O(q,P):O(p,K));const _=u&&(I==="stream"||I==="response");if(u&&(E||_&&D)){const le={};["status","statusText","headers"].forEach(st=>{le[st]=B[st]});const de=V.toFiniteNumber(B.headers.get("content-length")),[_e,qe]=E&&Yp(de,Xo(ex(E),!0))||[];B=new r(sx(B.body,nx,_e,()=>{qe&&qe(),D&&D()}),le)}I=I||"text";let Q=await h[V.findKey(h,I)||"text"](B,f);return!_&&D&&D(),await new Promise((le,de)=>{cv(le,de,{data:Q,headers:ms.from(B.headers),status:B.status,statusText:B.statusText,config:f,request:q})})}catch(k){throw D&&D(),k&&k.name==="TypeError"&&/Load failed|fetch/i.test(k.message)?Object.assign(new Se("Network Error",Se.ERR_NETWORK,f,q),{cause:k.cause||k}):Se.from(k,k&&k.code,f,q)}}},h2=new Map,mv=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:a}=t,i=[r,a,n];let l=i.length,o=l,c,d,u=h2;for(;o--;)c=i[o],d=u.get(c),d===void 0&&u.set(c,d=o?new Map:m2(t)),u=d;return d};mv();const ah={http:AS,xhr:i2,fetch:{get:mv}};V.forEach(ah,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const lx=e=>`- ${e}`,f2=e=>V.isFunction(e)||e===null||e===!1;function p2(e,t){e=V.isArray(e)?e:[e];const{length:n}=e;let r,a;const i={};for(let l=0;l`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let o=n?l.length>1?`since : -`+l.map(lx).join(` -`):" "+lx(l[0]):"as no adapter specified";throw new Se("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return a}const hv={getAdapter:p2,adapters:ah};function hd(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ai(null,e)}function ox(e){return hd(e),e.headers=ms.from(e.headers),e.data=md.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),hv.getAdapter(e.adapter||Pl.adapter,e)(e).then(function(r){return hd(e),r.data=md.call(e,e.transformResponse,r),r.headers=ms.from(r.headers),r},function(r){return ov(r)||(hd(e),r&&r.response&&(r.response.data=md.call(e,e.transformResponse,r.response),r.response.headers=ms.from(r.response.headers))),Promise.reject(r)})}const fv="1.13.2",Ac={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ac[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const cx={};Ac.transitional=function(t,n,r){function a(i,l){return"[Axios v"+fv+"] Transitional option '"+i+"'"+l+(r?". "+r:"")}return(i,l,o)=>{if(t===!1)throw new Se(a(l," has been removed"+(n?" in "+n:"")),Se.ERR_DEPRECATED);return n&&!cx[l]&&(cx[l]=!0,console.warn(a(l," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,l,o):!0}};Ac.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function x2(e,t,n){if(typeof e!="object")throw new Se("options must be an object",Se.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let a=r.length;for(;a-- >0;){const i=r[a],l=t[i];if(l){const o=e[i],c=o===void 0||l(o,i,e);if(c!==!0)throw new Se("option "+i+" must be "+c,Se.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Se("Unknown option "+i,Se.ERR_BAD_OPTION)}}const bo={assertOptions:x2,validators:Ac},Gs=bo.validators;let Br=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Jp,response:new Jp}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const i=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Jr(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:i}=n;r!==void 0&&bo.assertOptions(r,{silentJSONParsing:Gs.transitional(Gs.boolean),forcedJSONParsing:Gs.transitional(Gs.boolean),clarifyTimeoutError:Gs.transitional(Gs.boolean)},!1),a!=null&&(V.isFunction(a)?n.paramsSerializer={serialize:a}:bo.assertOptions(a,{encode:Gs.function,serialize:Gs.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),bo.assertOptions(n,{baseUrl:Gs.spelling("baseURL"),withXsrfToken:Gs.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=i&&V.merge(i.common,i[n.method]);i&&V.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=ms.concat(l,i);const o=[];let c=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(n)===!1||(c=c&&p.synchronous,o.unshift(p.fulfilled,p.rejected))});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let u,h=0,x;if(!c){const f=[ox.bind(this),void 0];for(f.unshift(...o),f.push(...d),x=f.length,u=Promise.resolve(n);h{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](a);r._listeners=null}),this.promise.then=a=>{let i;const l=new Promise(o=>{r.subscribe(o),i=o}).then(a);return l.cancel=function(){r.unsubscribe(i)},l},t(function(i,l,o){r.reason||(r.reason=new ai(i,l,o),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new pv(function(a){t=a}),cancel:t}}};function y2(e){return function(n){return e.apply(null,n)}}function v2(e){return V.isObject(e)&&e.isAxiosError===!0}const Uu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Uu).forEach(([e,t])=>{Uu[t]=e});function xv(e){const t=new Br(e),n=H0(Br.prototype.request,t);return V.extend(n,Br.prototype,t,{allOwnKeys:!0}),V.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return xv(Jr(e,a))},n}const pt=xv(Pl);pt.Axios=Br;pt.CanceledError=ai;pt.CancelToken=g2;pt.isCancel=ov;pt.VERSION=fv;pt.toFormData=Pc;pt.AxiosError=Se;pt.Cancel=pt.CanceledError;pt.all=function(t){return Promise.all(t)};pt.spread=y2;pt.isAxiosError=v2;pt.mergeConfig=Jr;pt.AxiosHeaders=ms;pt.formToJSON=e=>lv(V.isHTMLForm(e)?new FormData(e):e);pt.getAdapter=hv.getAdapter;pt.HttpStatusCode=Uu;pt.default=pt;const{Axios:m4,AxiosError:h4,CanceledError:f4,isCancel:p4,CancelToken:x4,VERSION:g4,all:y4,Cancel:v4,isAxiosError:j4,spread:b4,toFormData:N4,AxiosHeaders:w4,HttpStatusCode:S4,formToJSON:k4,getAdapter:C4,mergeConfig:E4}=pt,$=pt.create({baseURL:"/api",headers:{"Content-Type":"application/json"}});$.interceptors.request.use(e=>{const t=localStorage.getItem("token");return t&&(e.headers.Authorization=`Bearer ${t}`),e});$.interceptors.response.use(e=>e,e=>{var a,i,l,o,c,d,u;const t=((i=(a=e.config)==null?void 0:a.url)==null?void 0:i.includes("/auth/login"))||((o=(l=e.config)==null?void 0:l.url)==null?void 0:o.includes("/auth/customer-login"));((c=e.response)==null?void 0:c.status)===401&&!t&&(localStorage.removeItem("token"),localStorage.removeItem("user"),window.location.href="/login");const n=((u=(d=e.response)==null?void 0:d.data)==null?void 0:u.error)||e.message||"Ein Fehler ist aufgetreten",r=new Error(n);return Promise.reject(r)});const no={login:async(e,t)=>(await $.post("/auth/login",{email:e,password:t})).data,customerLogin:async(e,t)=>(await $.post("/auth/customer-login",{email:e,password:t})).data,me:async()=>(await $.get("/auth/me")).data},Pt={getAll:async e=>(await $.get("/customers",{params:e})).data,getById:async e=>(await $.get(`/customers/${e}`)).data,create:async e=>(await $.post("/customers",e)).data,update:async(e,t)=>(await $.put(`/customers/${e}`,t)).data,delete:async e=>(await $.delete(`/customers/${e}`)).data,getPortalSettings:async e=>(await $.get(`/customers/${e}/portal`)).data,updatePortalSettings:async(e,t)=>(await $.put(`/customers/${e}/portal`,t)).data,setPortalPassword:async(e,t)=>(await $.post(`/customers/${e}/portal/password`,{password:t})).data,getPortalPassword:async e=>(await $.get(`/customers/${e}/portal/password`)).data,getRepresentatives:async e=>(await $.get(`/customers/${e}/representatives`)).data,addRepresentative:async(e,t,n)=>(await $.post(`/customers/${e}/representatives`,{representativeId:t,notes:n})).data,removeRepresentative:async(e,t)=>(await $.delete(`/customers/${e}/representatives/${t}`)).data,searchForRepresentative:async(e,t)=>(await $.get(`/customers/${e}/representatives/search`,{params:{search:t}})).data},qu={getByCustomer:async e=>(await $.get(`/customers/${e}/addresses`)).data,create:async(e,t)=>(await $.post(`/customers/${e}/addresses`,t)).data,update:async(e,t)=>(await $.put(`/addresses/${e}`,t)).data,delete:async e=>(await $.delete(`/addresses/${e}`)).data},Yo={getByCustomer:async(e,t=!1)=>(await $.get(`/customers/${e}/bank-cards`,{params:{showInactive:t}})).data,create:async(e,t)=>(await $.post(`/customers/${e}/bank-cards`,t)).data,update:async(e,t)=>(await $.put(`/bank-cards/${e}`,t)).data,delete:async e=>(await $.delete(`/bank-cards/${e}`)).data},ec={getByCustomer:async(e,t=!1)=>(await $.get(`/customers/${e}/documents`,{params:{showInactive:t}})).data,create:async(e,t)=>(await $.post(`/customers/${e}/documents`,t)).data,update:async(e,t)=>(await $.put(`/documents/${e}`,t)).data,delete:async e=>(await $.delete(`/documents/${e}`)).data},ln={getByCustomer:async(e,t=!1)=>(await $.get(`/customers/${e}/meters`,{params:{showInactive:t}})).data,create:async(e,t)=>(await $.post(`/customers/${e}/meters`,t)).data,update:async(e,t)=>(await $.put(`/meters/${e}`,t)).data,delete:async e=>(await $.delete(`/meters/${e}`)).data,getReadings:async e=>(await $.get(`/meters/${e}/readings`)).data,addReading:async(e,t)=>(await $.post(`/meters/${e}/readings`,t)).data,updateReading:async(e,t,n)=>(await $.put(`/meters/${e}/readings/${t}`,n)).data,deleteReading:async(e,t)=>(await $.delete(`/meters/${e}/readings/${t}`)).data},aa={getInvoices:async e=>(await $.get(`/energy-details/${e}/invoices`)).data,addInvoice:async(e,t)=>(await $.post(`/energy-details/${e}/invoices`,t)).data,updateInvoice:async(e,t,n)=>(await $.put(`/energy-details/${e}/invoices/${t}`,n)).data,deleteInvoice:async(e,t)=>(await $.delete(`/energy-details/${e}/invoices/${t}`)).data,uploadDocument:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/invoices/${e}`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteDocument:async e=>(await $.delete(`/upload/invoices/${e}`)).data},xs={getByCustomer:async(e,t=!1)=>(await $.get(`/customers/${e}/stressfrei-emails`,{params:{includeInactive:t}})).data,create:async(e,t)=>(await $.post(`/customers/${e}/stressfrei-emails`,t)).data,update:async(e,t)=>(await $.put(`/stressfrei-emails/${e}`,t)).data,delete:async e=>(await $.delete(`/stressfrei-emails/${e}`)).data,enableMailbox:async e=>(await $.post(`/stressfrei-emails/${e}/enable-mailbox`)).data,syncMailboxStatus:async e=>(await $.post(`/stressfrei-emails/${e}/sync-mailbox-status`)).data,getMailboxCredentials:async e=>(await $.get(`/stressfrei-emails/${e}/credentials`)).data,resetPassword:async e=>(await $.post(`/stressfrei-emails/${e}/reset-password`)).data,syncEmails:async(e,t=!1)=>(await $.post(`/stressfrei-emails/${e}/sync`,{},{params:{full:t}})).data,sendEmail:async(e,t)=>(await $.post(`/stressfrei-emails/${e}/send`,t)).data,getFolderCounts:async e=>(await $.get(`/stressfrei-emails/${e}/folder-counts`)).data},Ae={getForCustomer:async(e,t)=>(await $.get(`/customers/${e}/emails`,{params:t})).data,getForContract:async(e,t)=>(await $.get(`/contracts/${e}/emails`,{params:t})).data,getContractFolderCounts:async e=>(await $.get(`/contracts/${e}/emails/folder-counts`)).data,getMailboxAccounts:async e=>(await $.get(`/customers/${e}/mailbox-accounts`)).data,getById:async e=>(await $.get(`/emails/${e}`)).data,getThread:async e=>(await $.get(`/emails/${e}/thread`)).data,markAsRead:async(e,t)=>(await $.patch(`/emails/${e}/read`,{isRead:t})).data,toggleStar:async e=>(await $.post(`/emails/${e}/star`)).data,assignToContract:async(e,t)=>(await $.post(`/emails/${e}/assign`,{contractId:t})).data,unassignFromContract:async e=>(await $.delete(`/emails/${e}/assign`)).data,delete:async e=>(await $.delete(`/emails/${e}`)).data,getAttachmentUrl:(e,t,n)=>{const r=localStorage.getItem("token"),a=encodeURIComponent(t),i=n?"&view=true":"";return`${$.defaults.baseURL}/emails/${e}/attachments/${a}?token=${r}${i}`},getUnreadCount:async e=>(await $.get("/emails/unread-count",{params:e})).data,getTrash:async e=>(await $.get(`/customers/${e}/emails/trash`)).data,getTrashCount:async e=>(await $.get(`/customers/${e}/emails/trash/count`)).data,restore:async e=>(await $.post(`/emails/${e}/restore`)).data,permanentDelete:async e=>(await $.delete(`/emails/${e}/permanent`)).data,getAttachmentTargets:async e=>(await $.get(`/emails/${e}/attachment-targets`)).data,saveAttachmentTo:async(e,t,n)=>{const r=encodeURIComponent(t);return(await $.post(`/emails/${e}/attachments/${r}/save-to`,n)).data},saveEmailAsPdf:async(e,t)=>(await $.post(`/emails/${e}/save-as-pdf`,t)).data,saveEmailAsInvoice:async(e,t)=>(await $.post(`/emails/${e}/save-as-invoice`,t)).data,saveAttachmentAsInvoice:async(e,t,n)=>{const r=encodeURIComponent(t);return(await $.post(`/emails/${e}/attachments/${r}/save-as-invoice`,n)).data}},Oe={getAll:async e=>(await $.get("/contracts",{params:e})).data,getTreeForCustomer:async e=>(await $.get("/contracts",{params:{customerId:e,tree:"true"}})).data,getById:async e=>(await $.get(`/contracts/${e}`)).data,create:async e=>(await $.post("/contracts",e)).data,update:async(e,t)=>(await $.put(`/contracts/${e}`,t)).data,delete:async e=>(await $.delete(`/contracts/${e}`)).data,createFollowUp:async e=>(await $.post(`/contracts/${e}/follow-up`)).data,getPassword:async e=>(await $.get(`/contracts/${e}/password`)).data,getSimCardCredentials:async e=>(await $.get(`/contracts/simcard/${e}/credentials`)).data,getInternetCredentials:async e=>(await $.get(`/contracts/${e}/internet-credentials`)).data,getSipCredentials:async e=>(await $.get(`/contracts/phonenumber/${e}/sip-credentials`)).data,getCockpit:async()=>(await $.get("/contracts/cockpit")).data,snooze:async(e,t)=>(await $.patch(`/contracts/${e}/snooze`,t)).data},et={getAll:async e=>(await $.get("/tasks",{params:e})).data,getStats:async()=>(await $.get("/tasks/stats")).data,getByContract:async(e,t)=>(await $.get(`/contracts/${e}/tasks`,{params:{status:t}})).data,create:async(e,t)=>(await $.post(`/contracts/${e}/tasks`,t)).data,update:async(e,t)=>(await $.put(`/tasks/${e}`,t)).data,complete:async e=>(await $.post(`/tasks/${e}/complete`)).data,reopen:async e=>(await $.post(`/tasks/${e}/reopen`)).data,delete:async e=>(await $.delete(`/tasks/${e}`)).data,createSubtask:async(e,t)=>(await $.post(`/tasks/${e}/subtasks`,{title:t})).data,createReply:async(e,t)=>(await $.post(`/tasks/${e}/reply`,{title:t})).data,updateSubtask:async(e,t)=>(await $.put(`/subtasks/${e}`,{title:t})).data,completeSubtask:async e=>(await $.post(`/subtasks/${e}/complete`)).data,reopenSubtask:async e=>(await $.post(`/subtasks/${e}/reopen`)).data,deleteSubtask:async e=>(await $.delete(`/subtasks/${e}`)).data,createSupportTicket:async(e,t)=>(await $.post(`/contracts/${e}/support-ticket`,t)).data},Xr={getPublic:async()=>(await $.get("/settings/public")).data,getAll:async()=>(await $.get("/settings")).data,update:async e=>(await $.put("/settings",e)).data,updateOne:async(e,t)=>(await $.put(`/settings/${e}`,{value:t})).data},br={list:async()=>(await $.get("/settings/backups")).data,create:async()=>(await $.post("/settings/backup")).data,restore:async e=>(await $.post(`/settings/backup/${e}/restore`)).data,delete:async e=>(await $.delete(`/settings/backup/${e}`)).data,getDownloadUrl:e=>`/api/settings/backup/${e}/download`,upload:async e=>{const t=new FormData;return t.append("backup",e),(await $.post("/settings/backup/upload",t,{headers:{"Content-Type":"multipart/form-data"}})).data},factoryReset:async()=>(await $.post("/settings/factory-reset")).data},al={getAll:async(e=!1)=>(await $.get("/platforms",{params:{includeInactive:e}})).data,getById:async e=>(await $.get(`/platforms/${e}`)).data,create:async e=>(await $.post("/platforms",e)).data,update:async(e,t)=>(await $.put(`/platforms/${e}`,t)).data,delete:async e=>(await $.delete(`/platforms/${e}`)).data},il={getAll:async(e=!1)=>(await $.get("/cancellation-periods",{params:{includeInactive:e}})).data,getById:async e=>(await $.get(`/cancellation-periods/${e}`)).data,create:async e=>(await $.post("/cancellation-periods",e)).data,update:async(e,t)=>(await $.put(`/cancellation-periods/${e}`,t)).data,delete:async e=>(await $.delete(`/cancellation-periods/${e}`)).data},ll={getAll:async(e=!1)=>(await $.get("/contract-durations",{params:{includeInactive:e}})).data,getById:async e=>(await $.get(`/contract-durations/${e}`)).data,create:async e=>(await $.post("/contract-durations",e)).data,update:async(e,t)=>(await $.put(`/contract-durations/${e}`,t)).data,delete:async e=>(await $.delete(`/contract-durations/${e}`)).data},ol={getAll:async(e=!1)=>(await $.get("/contract-categories",{params:{includeInactive:e}})).data,getById:async e=>(await $.get(`/contract-categories/${e}`)).data,create:async e=>(await $.post("/contract-categories",e)).data,update:async(e,t)=>(await $.put(`/contract-categories/${e}`,t)).data,delete:async e=>(await $.delete(`/contract-categories/${e}`)).data},Xa={getAll:async(e=!1)=>(await $.get("/providers",{params:{includeInactive:e}})).data,getById:async e=>(await $.get(`/providers/${e}`)).data,create:async e=>(await $.post("/providers",e)).data,update:async(e,t)=>(await $.put(`/providers/${e}`,t)).data,delete:async e=>(await $.delete(`/providers/${e}`)).data,getTariffs:async(e,t=!1)=>(await $.get(`/providers/${e}/tariffs`,{params:{includeInactive:t}})).data,createTariff:async(e,t)=>(await $.post(`/providers/${e}/tariffs`,t)).data},gv={getById:async e=>(await $.get(`/tariffs/${e}`)).data,update:async(e,t)=>(await $.put(`/tariffs/${e}`,t)).data,delete:async e=>(await $.delete(`/tariffs/${e}`)).data},ut={uploadBankCardDocument:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/bank-cards/${e}`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},uploadIdentityDocument:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/documents/${e}`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteBankCardDocument:async e=>(await $.delete(`/upload/bank-cards/${e}`)).data,deleteIdentityDocument:async e=>(await $.delete(`/upload/documents/${e}`)).data,uploadBusinessRegistration:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/customers/${e}/business-registration`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteBusinessRegistration:async e=>(await $.delete(`/upload/customers/${e}/business-registration`)).data,uploadCommercialRegister:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/customers/${e}/commercial-register`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteCommercialRegister:async e=>(await $.delete(`/upload/customers/${e}/commercial-register`)).data,uploadPrivacyPolicy:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/customers/${e}/privacy-policy`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deletePrivacyPolicy:async e=>(await $.delete(`/upload/customers/${e}/privacy-policy`)).data,uploadCancellationLetter:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/contracts/${e}/cancellation-letter`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteCancellationLetter:async e=>(await $.delete(`/upload/contracts/${e}/cancellation-letter`)).data,uploadCancellationConfirmation:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/contracts/${e}/cancellation-confirmation`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteCancellationConfirmation:async e=>(await $.delete(`/upload/contracts/${e}/cancellation-confirmation`)).data,uploadCancellationLetterOptions:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/contracts/${e}/cancellation-letter-options`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteCancellationLetterOptions:async e=>(await $.delete(`/upload/contracts/${e}/cancellation-letter-options`)).data,uploadCancellationConfirmationOptions:async(e,t)=>{const n=new FormData;return n.append("document",t),(await $.post(`/upload/contracts/${e}/cancellation-confirmation-options`,n,{headers:{"Content-Type":"multipart/form-data"}})).data},deleteCancellationConfirmationOptions:async e=>(await $.delete(`/upload/contracts/${e}/cancellation-confirmation-options`)).data},Ri={getAll:async e=>(await $.get("/users",{params:e})).data,getById:async e=>(await $.get(`/users/${e}`)).data,create:async e=>(await $.post("/users",e)).data,update:async(e,t)=>(await $.put(`/users/${e}`,t)).data,delete:async e=>(await $.delete(`/users/${e}`)).data,getRoles:async()=>(await $.get("/users/roles/list")).data},ki={getSchema:async()=>(await $.get("/developer/schema")).data,getTableData:async(e,t=1,n=50)=>(await $.get(`/developer/table/${e}`,{params:{page:t,limit:n}})).data,updateRow:async(e,t,n)=>(await $.put(`/developer/table/${e}/${t}`,n)).data,deleteRow:async(e,t)=>(await $.delete(`/developer/table/${e}/${t}`)).data,getReference:async e=>(await $.get(`/developer/reference/${e}`)).data},xn={getConfigs:async()=>(await $.get("/email-providers/configs")).data,getConfig:async e=>(await $.get(`/email-providers/configs/${e}`)).data,createConfig:async e=>(await $.post("/email-providers/configs",e)).data,updateConfig:async(e,t)=>(await $.put(`/email-providers/configs/${e}`,t)).data,deleteConfig:async e=>(await $.delete(`/email-providers/configs/${e}`)).data,testConnection:async e=>{const t=e!=null&&e.testData?{...e.testData}:e!=null&&e.id?{id:e.id}:{};return(await $.post("/email-providers/test-connection",t)).data},getDomain:async()=>(await $.get("/email-providers/domain")).data,checkEmailExists:async e=>(await $.get(`/email-providers/check/${e}`)).data,provisionEmail:async(e,t)=>(await $.post("/email-providers/provision",{localPart:e,customerEmail:t})).data,deprovisionEmail:async e=>(await $.delete(`/email-providers/deprovision/${e}`)).data},yv=j.createContext(null);function j2({children:e}){const[t,n]=j.useState(null),[r,a]=j.useState(!0),[i,l]=j.useState(()=>localStorage.getItem("developerMode")==="true"),o=p=>{l(p),localStorage.setItem("developerMode",String(p))};j.useEffect(()=>{var p;console.log("useEffect check - user:",t==null?void 0:t.email,"developerMode:",i,"has developer:access:",(p=t==null?void 0:t.permissions)==null?void 0:p.includes("developer:access")),t&&i&&!t.permissions.includes("developer:access")&&(console.log("Disabling developer mode because user lacks developer:access permission"),o(!1))},[t,i]),j.useEffect(()=>{localStorage.getItem("token")?no.me().then(b=>{b.success&&b.data?n(b.data):localStorage.removeItem("token")}).catch(()=>{localStorage.removeItem("token")}).finally(()=>{a(!1)}):a(!1)},[]);const c=async(p,b)=>{const g=await no.login(p,b);if(g.success&&g.data)localStorage.setItem("token",g.data.token),n(g.data.user);else throw new Error(g.error||"Login fehlgeschlagen")},d=async(p,b)=>{const g=await no.customerLogin(p,b);if(g.success&&g.data)localStorage.setItem("token",g.data.token),n(g.data.user);else throw new Error(g.error||"Login fehlgeschlagen")},u=()=>{localStorage.removeItem("token"),n(null)},h=async()=>{var b;if(localStorage.getItem("token"))try{const g=await no.me();console.log("refreshUser response:",g),console.log("permissions:",(b=g.data)==null?void 0:b.permissions),g.success&&g.data&&n(g.data)}catch(g){console.error("refreshUser error:",g)}},x=p=>t?t.permissions.includes(p):!1,m=!!(t!=null&&t.customerId),f=!!(t!=null&&t.isCustomerPortal);return s.jsx(yv.Provider,{value:{user:t,isLoading:r,isAuthenticated:!!t,login:c,customerLogin:d,logout:u,hasPermission:x,isCustomer:m,isCustomerPortal:f,developerMode:i,setDeveloperMode:o,refreshUser:h},children:e})}function He(){const e=j.useContext(yv);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const fd={scrollToTopThreshold:.7},vv=j.createContext(void 0),dx="opencrm_app_settings";function b2({children:e}){const[t,n]=j.useState(()=>{const a=localStorage.getItem(dx);if(a)try{return{...fd,...JSON.parse(a)}}catch{return fd}return fd});j.useEffect(()=>{localStorage.setItem(dx,JSON.stringify(t))},[t]);const r=a=>{n(i=>({...i,...a}))};return s.jsx(vv.Provider,{value:{settings:t,updateSettings:r},children:e})}function jv(){const e=j.useContext(vv);if(!e)throw new Error("useAppSettings must be used within AppSettingsProvider");return e}function N2(){const{pathname:e}=In();return j.useEffect(()=>{window.scrollTo(0,0)},[e]),null}/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const w2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),bv=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var S2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const k2=j.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:l,...o},c)=>j.createElement("svg",{ref:c,...S2,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:bv("lucide",a),...o},[...l.map(([d,u])=>j.createElement(d,u)),...Array.isArray(i)?i:[i]]));/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const re=(e,t)=>{const n=j.forwardRef(({className:r,...a},i)=>j.createElement(k2,{ref:i,iconNode:t,className:bv(`lucide-${w2(e)}`,r),...a}));return n.displayName=`${e}`,n};/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const C2=re("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vs=re("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Nv=re("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wv=re("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const E2=re("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const D2=re("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const P2=re("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Sv=re("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kv=re("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xr=re("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Rn=re("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const A2=re("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ft=re("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ih=re("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wn=re("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ps=re("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ux=re("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const No=re("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cl=re("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Mn=re("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Mc=re("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lh=re("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oh=re("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Tc=re("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const As=re("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ch=re("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const It=re("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pe=re("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const M2=re("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ke=re("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const T2=re("FileType",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Cv=re("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const F2=re("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ev=re("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mx=re("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dh=re("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const I2=re("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hx=re("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Dv=re("IdCard",[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ur=re("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Al=re("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const R2=re("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const L2=re("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fx=re("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const O2=re("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pv=re("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nn=re("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const z2=re("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $2=re("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dl=re("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _2=re("Move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const K2=re("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Fc=re("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ue=re("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uh=re("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Sr=re("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const B2=re("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mh=re("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Av=re("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ml=re("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Tl=re("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Mv=re("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hh=re("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Je=re("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fh=re("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const U2=re("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const q2=re("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ne=re("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hs=re("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Tv=re("Tv",[["rect",{width:"20",height:"15",x:"2",y:"7",rx:"2",ry:"2",key:"10ag99"}],["polyline",{points:"17 2 12 7 7 2",key:"11pgbg"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Fv=re("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vu=re("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const V2=re("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Q2=re("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Fl=re("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ca=re("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const px=re("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ea=re("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qt=re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ph=re("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const H2=re("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const W2=re("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function G2(){const{user:e,logout:t,hasPermission:n,isCustomer:r,developerMode:a}=He(),i=[{to:"/",icon:L2,label:"Dashboard",show:!0,end:!0},{to:"/customers",icon:Ca,label:"Kunden",show:n("customers:read")&&!r},{to:"/contracts",icon:Ke,label:"Verträge",show:n("contracts:read"),end:!0},{to:"/contracts/cockpit",icon:wn,label:"Vertrags-Cockpit",show:n("contracts:read")&&!r},{to:"/tasks",icon:r?dl:cl,label:r?"Support-Anfragen":"Aufgaben",show:n("contracts:read")}],l=[{to:"/developer/database",icon:Tc,label:"Datenbankstruktur"}];return s.jsxs("aside",{className:"w-64 bg-gray-900 text-white min-h-screen flex flex-col",children:[s.jsx("div",{className:"p-4 border-b border-gray-800",children:s.jsx("h1",{className:"text-xl font-bold",children:"OpenCRM"})}),s.jsxs("nav",{className:"flex-1 p-4 overflow-y-auto",children:[s.jsx("ul",{className:"space-y-2",children:i.filter(o=>o.show).map(o=>s.jsx("li",{children:s.jsxs(dd,{to:o.to,end:o.end,className:({isActive:c})=>`flex items-center gap-3 px-4 py-2 rounded-lg transition-colors ${c?"bg-blue-600 text-white":"text-gray-300 hover:bg-gray-800"}`,children:[s.jsx(o.icon,{className:"w-5 h-5"}),o.label]})},o.to))}),a&&n("developer:access")&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mt-6 mb-2 px-4",children:s.jsxs("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider flex items-center gap-2",children:[s.jsx(Mc,{className:"w-3 h-3"}),"Entwickler"]})}),s.jsx("ul",{className:"space-y-2",children:l.map(o=>s.jsx("li",{children:s.jsxs(dd,{to:o.to,className:({isActive:c})=>`flex items-center gap-3 px-4 py-2 rounded-lg transition-colors ${c?"bg-purple-600 text-white":"text-purple-300 hover:bg-gray-800"}`,children:[s.jsx(o.icon,{className:"w-5 h-5"}),o.label]})},o.to))})]}),s.jsx("div",{className:"mt-6 pt-6 border-t border-gray-800",children:s.jsxs(dd,{to:"/settings",className:({isActive:o})=>`flex items-center gap-3 px-4 py-2 rounded-lg transition-colors ${o?"bg-blue-600 text-white":"text-gray-300 hover:bg-gray-800"}`,children:[s.jsx(Mv,{className:"w-5 h-5"}),"Einstellungen"]})})]}),s.jsxs("div",{className:"p-4 border-t border-gray-800",children:[s.jsxs("div",{className:"mb-4 text-sm",children:[s.jsx("p",{className:"text-gray-400",children:"Angemeldet als"}),s.jsxs("p",{className:"font-medium",children:[e==null?void 0:e.firstName," ",e==null?void 0:e.lastName]})]}),s.jsxs("button",{onClick:t,className:"flex items-center gap-3 w-full px-4 py-2 text-gray-300 hover:bg-gray-800 rounded-lg transition-colors",children:[s.jsx(O2,{className:"w-5 h-5"}),"Abmelden"]})]})]})}function Z2(){const{settings:e}=jv(),[t,n]=j.useState(!1);j.useEffect(()=>{const a=()=>{window.scrollY>window.innerHeight*e.scrollToTopThreshold?n(!0):n(!1)};return window.addEventListener("scroll",a),()=>window.removeEventListener("scroll",a)},[e.scrollToTopThreshold]);const r=()=>{window.scrollTo({top:0,behavior:"smooth"})};return t?s.jsx("button",{onClick:r,className:"fixed bottom-6 right-6 p-3 bg-gray-200 hover:bg-gray-300 text-gray-600 rounded-full shadow-md transition-all duration-300 opacity-70 hover:opacity-100 z-50","aria-label":"Nach oben scrollen",title:"Nach oben",children:s.jsx(ih,{className:"w-5 h-5"})}):null}function J2(){return s.jsxs("div",{className:"flex min-h-screen",children:[s.jsx(G2,{}),s.jsx("main",{className:"flex-1 p-8 overflow-auto",children:s.jsx(dw,{})}),s.jsx(Z2,{})]})}const T=j.forwardRef(({className:e="",variant:t="primary",size:n="md",children:r,disabled:a,...i},l)=>{const o="inline-flex items-center justify-center font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",c={primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-gray-200 text-gray-900 hover:bg-gray-300 focus:ring-gray-500",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",ghost:"bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-500"},d={sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"};return s.jsx("button",{ref:l,className:`${o} ${c[t]} ${d[n]} ${e}`,disabled:a,...i,children:r})});T.displayName="Button";const H=j.forwardRef(({className:e="",label:t,error:n,id:r,onClear:a,...i},l)=>{const o=r||i.name,c=i.type==="date",d=i.value!==void 0&&i.value!==null&&i.value!=="",u=c&&a&&d;return s.jsxs("div",{className:"w-full",children:[t&&s.jsx("label",{htmlFor:o,className:"block text-sm font-medium text-gray-700 mb-1",children:t}),s.jsxs("div",{className:u?"flex gap-2":"",children:[s.jsx("input",{ref:l,id:o,className:`block w-full px-3 py-2 border rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${n?"border-red-500":"border-gray-300"} ${e}`,...i}),u&&s.jsx("button",{type:"button",onClick:a,className:"px-3 py-2 text-gray-400 hover:text-red-500 hover:bg-red-50 border border-gray-300 rounded-lg transition-colors",title:"Datum löschen",children:s.jsx(Ne,{className:"w-4 h-4"})})]}),n&&s.jsx("p",{className:"mt-1 text-sm text-red-600",children:n})]})});H.displayName="Input";function X({children:e,className:t="",title:n,actions:r}){return s.jsxs("div",{className:`bg-white rounded-lg shadow ${t}`,children:[(n||r)&&s.jsxs("div",{className:"px-6 py-4 border-b border-gray-200 flex items-center justify-between",children:[n&&s.jsx("div",{className:"text-lg font-medium text-gray-900",children:n}),r&&s.jsx("div",{className:"flex items-center gap-2",children:r})]}),s.jsx("div",{className:"p-6",children:e})]})}function X2(){const[e,t]=j.useState(""),[n,r]=j.useState(""),[a,i]=j.useState(""),[l,o]=j.useState(!1),{login:c,customerLogin:d}=He(),u=Yt(),h=async x=>{x.preventDefault(),i(""),o(!0);try{await c(e,n),u("/");return}catch{}try{await d(e,n),u("/")}catch{i("Ungültige Anmeldedaten"),o(!1)}};return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:s.jsxs(X,{className:"w-full max-w-md",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"OpenCRM"}),s.jsx("p",{className:"text-gray-600 mt-2",children:"Melden Sie sich an"})]}),a&&s.jsx("div",{className:"mb-4 p-4 bg-red-50 border border-red-200 text-red-700 rounded-lg",children:a}),s.jsxs("form",{onSubmit:h,className:"space-y-4",children:[s.jsx(H,{label:"E-Mail",type:"email",value:e,onChange:x=>t(x.target.value),required:!0,autoComplete:"email"}),s.jsx(H,{label:"Passwort",type:"password",value:n,onChange:x=>r(x.target.value),required:!0,autoComplete:"current-password"}),s.jsx(T,{type:"submit",className:"w-full",disabled:l,children:l?"Anmeldung...":"Anmelden"})]})]})})}function Ve({isOpen:e,onClose:t,title:n,children:r,size:a="md"}){if(j.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),!e)return null;const i={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"};return s.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:s.jsxs("div",{className:"flex min-h-full items-center justify-center p-4",children:[s.jsx("div",{className:"fixed inset-0 bg-black/50",onClick:t}),s.jsxs("div",{className:`relative bg-white rounded-lg shadow-xl w-full ${i[a]}`,children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b",children:[s.jsx("h2",{className:"text-lg font-semibold",children:n}),s.jsx(T,{variant:"ghost",size:"sm",onClick:t,children:s.jsx(qt,{className:"w-5 h-5"})})]}),s.jsx("div",{className:"p-6",children:r})]})]})})}function Y2(){var w,S,P,O,R,q;const{user:e,isCustomer:t,isCustomerPortal:n}=He(),[r,a]=j.useState(!1),{data:i,isLoading:l}=fe({queryKey:["app-settings-public"],queryFn:()=>Xr.getPublic(),enabled:n,staleTime:0}),o=!l&&((w=i==null?void 0:i.data)==null?void 0:w.customerSupportTicketsEnabled)==="true",{data:c}=fe({queryKey:["customers-count"],queryFn:()=>Pt.getAll({limit:1}),enabled:!t}),{data:d}=fe({queryKey:["contracts",t?e==null?void 0:e.customerId:void 0],queryFn:()=>Oe.getAll(t?{customerId:e==null?void 0:e.customerId}:{limit:1})}),{data:u}=fe({queryKey:["contracts-active",t?e==null?void 0:e.customerId:void 0],queryFn:()=>Oe.getAll({status:"ACTIVE",...t?{customerId:e==null?void 0:e.customerId}:{limit:1}})}),{data:h}=fe({queryKey:["contracts-pending",t?e==null?void 0:e.customerId:void 0],queryFn:()=>Oe.getAll({status:"PENDING",...t?{customerId:e==null?void 0:e.customerId}:{limit:1}})}),{data:x}=fe({queryKey:["task-stats"],queryFn:()=>et.getStats()}),{data:m}=fe({queryKey:["contract-cockpit"],queryFn:()=>Oe.getCockpit(),enabled:!t,staleTime:0}),{ownContracts:f,representedContracts:p}=j.useMemo(()=>{if(!n||!(d!=null&&d.data))return{ownContracts:[],representedContracts:[]};const D=[],z={};for(const k of d.data)if(k.customerId===(e==null?void 0:e.customerId))D.push(k);else{const K=k.customerId;if(!z[K]){const B=k.customer?k.customer.companyName||`${k.customer.firstName} ${k.customer.lastName}`:`Kunde ${K}`;z[K]={customerName:B,contracts:[]}}z[K].contracts.push(k)}return{ownContracts:D,representedContracts:Object.values(z).sort((k,K)=>k.customerName.localeCompare(K.customerName))}},[d==null?void 0:d.data,n,e==null?void 0:e.customerId]),b=j.useMemo(()=>f.filter(D=>D.status==="ACTIVE").length,[f]),g=j.useMemo(()=>f.filter(D=>D.status==="PENDING").length,[f]),y=j.useMemo(()=>f.filter(D=>D.status==="EXPIRED").length,[f]),v=j.useMemo(()=>p.reduce((D,z)=>D+z.contracts.length,0),[p]),N=j.useMemo(()=>p.reduce((D,z)=>D+z.contracts.filter(k=>k.status==="ACTIVE").length,0),[p]),E=j.useMemo(()=>p.reduce((D,z)=>D+z.contracts.filter(k=>k.status==="EXPIRED").length,0),[p]),A=((S=x==null?void 0:x.data)==null?void 0:S.openCount)||0,I=D=>s.jsx(X,{className:D.link?"cursor-pointer hover:shadow-md transition-shadow":"",children:D.link?s.jsx(ke,{to:D.link,className:"block",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:`p-3 rounded-lg ${D.color}`,children:s.jsx(D.icon,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"ml-4",children:[s.jsx("p",{className:"text-sm text-gray-500",children:D.label}),s.jsx("p",{className:"text-2xl font-bold",children:D.value})]})]})}):s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:`p-3 rounded-lg ${D.color}`,children:s.jsx(D.icon,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"ml-4",children:[s.jsx("p",{className:"text-sm text-gray-500",children:D.label}),s.jsx("p",{className:"text-2xl font-bold",children:D.value})]})]})},D.label);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("h1",{className:"text-2xl font-bold",children:["Willkommen, ",e==null?void 0:e.firstName,"!"]}),n&&o&&s.jsxs(T,{onClick:()=>a(!0),children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Support-Anfrage"]})]}),n?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Fl,{className:"w-5 h-5 text-blue-600"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Meine Verträge"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[I({label:"Eigene Verträge",value:f.length,icon:Ke,color:"bg-blue-500",link:"/contracts"}),I({label:"Davon aktiv",value:b,icon:Ps,color:"bg-green-500"}),I({label:"Davon ausstehend",value:g,icon:Mn,color:"bg-yellow-500"}),I({label:"Davon abgelaufen",value:y,icon:ux,color:"bg-red-500"})]})]}),v>0&&s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Ca,{className:"w-5 h-5 text-purple-600"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Fremdverträge"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[I({label:"Fremdverträge",value:v,icon:Ca,color:"bg-purple-500",link:"/contracts"}),I({label:"Davon aktiv",value:N,icon:Ps,color:"bg-green-500"}),s.jsx("div",{className:"hidden lg:block"}),I({label:"Davon abgelaufen",value:E,icon:ux,color:"bg-red-500"})]})]}),s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(dl,{className:"w-5 h-5 text-orange-600"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Support-Anfragen"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:I({label:"Offene Anfragen",value:A,icon:dl,color:"bg-orange-500",link:"/tasks"})})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6",children:[I({label:"Kunden",value:((P=c==null?void 0:c.pagination)==null?void 0:P.total)||0,icon:Ca,color:"bg-blue-500",link:"/customers"}),I({label:"Verträge gesamt",value:((O=d==null?void 0:d.pagination)==null?void 0:O.total)||0,icon:Ke,color:"bg-purple-500",link:"/contracts"}),I({label:"Aktive Verträge",value:((R=u==null?void 0:u.pagination)==null?void 0:R.total)||0,icon:Ps,color:"bg-green-500"}),I({label:"Ausstehende Verträge",value:((q=h==null?void 0:h.pagination)==null?void 0:q.total)||0,icon:wn,color:"bg-yellow-500"})]}),(m==null?void 0:m.data)&&s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(wn,{className:"w-5 h-5 text-red-500"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Vertrags-Cockpit"})]}),s.jsx(ke,{to:"/contracts/cockpit",className:"text-sm text-blue-600 hover:underline",children:"Alle anzeigen"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsx(X,{className:"cursor-pointer hover:shadow-md transition-shadow",children:s.jsx(ke,{to:"/contracts/cockpit?filter=critical",className:"block",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"p-3 rounded-lg bg-red-100",children:s.jsx(wn,{className:"w-6 h-6 text-red-500"})}),s.jsxs("div",{className:"ml-4",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["Kritisch (<",m.data.thresholds.criticalDays," Tage)"]}),s.jsx("p",{className:"text-2xl font-bold text-red-600",children:m.data.summary.criticalCount})]})]})})}),s.jsx(X,{className:"cursor-pointer hover:shadow-md transition-shadow",children:s.jsx(ke,{to:"/contracts/cockpit?filter=warning",className:"block",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"p-3 rounded-lg bg-yellow-100",children:s.jsx(hs,{className:"w-6 h-6 text-yellow-500"})}),s.jsxs("div",{className:"ml-4",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["Warnung (<",m.data.thresholds.warningDays," Tage)"]}),s.jsx("p",{className:"text-2xl font-bold text-yellow-600",children:m.data.summary.warningCount})]})]})})}),s.jsx(X,{className:"cursor-pointer hover:shadow-md transition-shadow",children:s.jsx(ke,{to:"/contracts/cockpit?filter=ok",className:"block",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"p-3 rounded-lg bg-green-100",children:s.jsx(Ps,{className:"w-6 h-6 text-green-500"})}),s.jsxs("div",{className:"ml-4",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["OK (<",m.data.thresholds.okDays," Tage)"]}),s.jsx("p",{className:"text-2xl font-bold text-green-600",children:m.data.summary.okCount})]})]})})}),s.jsx(X,{className:"cursor-pointer hover:shadow-md transition-shadow",children:s.jsx(ke,{to:"/contracts/cockpit",className:"block",children:s.jsxs("div",{className:"flex items-center",children:[s.jsx("div",{className:"p-3 rounded-lg bg-gray-100",children:s.jsx(Ke,{className:"w-6 h-6 text-gray-500"})}),s.jsxs("div",{className:"ml-4",children:[s.jsx("p",{className:"text-sm text-gray-500",children:"Handlungsbedarf"}),s.jsx("p",{className:"text-2xl font-bold text-gray-600",children:m.data.summary.totalContracts})]})]})})})]})]}),s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(cl,{className:"w-5 h-5 text-orange-600"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Aufgaben"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:I({label:"Offene Aufgaben",value:A,icon:cl,color:"bg-orange-500",link:"/tasks"})})]})]}),n&&s.jsx(ek,{isOpen:r,onClose:()=>a(!1)})]})}function ek({isOpen:e,onClose:t}){const{user:n}=He(),r=Yt(),a=ge(),[i,l]=j.useState("own"),[o,c]=j.useState(null),[d,u]=j.useState(""),[h,x]=j.useState(""),[m,f]=j.useState(!1),[p,b]=j.useState(""),{data:g}=fe({queryKey:["contracts",n==null?void 0:n.customerId],queryFn:()=>Oe.getAll({customerId:n==null?void 0:n.customerId}),enabled:e}),y=j.useMemo(()=>{if(!(g!=null&&g.data))return{own:[],represented:{}};const w=[],S={};for(const P of g.data)if(P.customerId===(n==null?void 0:n.customerId))w.push(P);else{if(!S[P.customerId]){const O=P.customer?P.customer.companyName||`${P.customer.firstName} ${P.customer.lastName}`:`Kunde ${P.customerId}`;S[P.customerId]={name:O,contracts:[]}}S[P.customerId].contracts.push(P)}return{own:w,represented:S}},[g==null?void 0:g.data,n==null?void 0:n.customerId]),v=Object.keys(y.represented).length>0,N=j.useMemo(()=>{var w;return i==="own"?y.own:((w=y.represented[i])==null?void 0:w.contracts)||[]},[i,y]),E=j.useMemo(()=>{if(!p)return N;const w=p.toLowerCase();return N.filter(S=>S.contractNumber.toLowerCase().includes(w)||(S.providerName||"").toLowerCase().includes(w)||(S.tariffName||"").toLowerCase().includes(w))},[N,p]),A=async()=>{if(!(!o||!d.trim())){f(!0);try{await et.createSupportTicket(o,{title:d.trim(),description:h.trim()||void 0}),a.invalidateQueries({queryKey:["task-stats"]}),a.invalidateQueries({queryKey:["all-tasks"]}),t(),u(""),x(""),c(null),l("own"),r(`/contracts/${o}`)}catch(w){console.error("Fehler beim Erstellen der Support-Anfrage:",w),alert("Fehler beim Erstellen der Support-Anfrage. Bitte versuchen Sie es erneut.")}finally{f(!1)}}},I=()=>{u(""),x(""),c(null),l("own"),b(""),t()};return s.jsx(Ve,{isOpen:e,onClose:I,title:"Neue Support-Anfrage",children:s.jsxs("div",{className:"space-y-4",children:[v&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Kunde"}),s.jsxs("select",{value:i,onChange:w=>{const S=w.target.value;l(S==="own"?"own":parseInt(S)),c(null),b("")},className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:[s.jsx("option",{value:"own",children:"Eigene Verträge"}),Object.entries(y.represented).map(([w,{name:S}])=>s.jsx("option",{value:w,children:S},w))]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Vertrag *"}),s.jsx(H,{placeholder:"Vertrag suchen...",value:p,onChange:w=>b(w.target.value),className:"mb-2"}),s.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-lg",children:E.length>0?E.map(w=>s.jsxs("div",{onClick:()=>c(w.id),className:`p-3 cursor-pointer border-b last:border-b-0 hover:bg-gray-50 ${o===w.id?"bg-blue-50 border-blue-200":""}`,children:[s.jsx("div",{className:"font-medium",children:w.contractNumber}),s.jsxs("div",{className:"text-sm text-gray-500",children:[w.providerName||"Kein Anbieter",w.tariffName&&` - ${w.tariffName}`]})]},w.id)):s.jsx("div",{className:"p-3 text-gray-500 text-center",children:"Keine Verträge gefunden."})})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Titel *"}),s.jsx(H,{value:d,onChange:w=>u(w.target.value),placeholder:"Kurze Beschreibung Ihres Anliegens"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Beschreibung"}),s.jsx("textarea",{value:h,onChange:w=>x(w.target.value),placeholder:"Detaillierte Beschreibung (optional)",rows:4,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:I,children:"Abbrechen"}),s.jsx(T,{onClick:A,disabled:!o||!d.trim()||m,children:m?"Wird erstellt...":"Anfrage erstellen"})]})]})})}function ve({children:e,variant:t="default",className:n="",onClick:r}){const a={default:"bg-gray-100 text-gray-800",success:"bg-green-100 text-green-800",warning:"bg-yellow-100 text-yellow-800",danger:"bg-red-100 text-red-800",info:"bg-blue-100 text-blue-800"};return s.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${a[t]} ${n}`,onClick:r,children:e})}function tk(){const[e,t]=j.useState(""),[n,r]=j.useState(""),[a,i]=j.useState(1),{hasPermission:l}=He(),{data:o,isLoading:c}=fe({queryKey:["customers",e,n,a],queryFn:()=>Pt.getAll({search:e,type:n||void 0,page:a,limit:20})});return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Kunden"}),l("customers:create")&&s.jsx(ke,{to:"/customers/new",children:s.jsxs(T,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Neuer Kunde"]})})]}),s.jsx(X,{className:"mb-6",children:s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx(H,{placeholder:"Suchen...",value:e,onChange:d=>t(d.target.value),className:"flex-1"}),s.jsxs("select",{value:n,onChange:d=>r(d.target.value),className:"px-3 py-2 border border-gray-300 rounded-lg w-28 flex-shrink-0",children:[s.jsx("option",{value:"",children:"Alle"}),s.jsx("option",{value:"PRIVATE",children:"Privat"}),s.jsx("option",{value:"BUSINESS",children:"Firma"})]}),s.jsx(T,{variant:"secondary",className:"flex-shrink-0",children:s.jsx(Ml,{className:"w-4 h-4"})})]})}),s.jsx(X,{children:c?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):o!=null&&o.data&&o.data.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Kundennr."}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Name"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Typ"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"E-Mail"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Verträge"}),s.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsx("tbody",{children:o.data.map(d=>{var u;return s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[s.jsx("td",{className:"py-3 px-4 font-mono text-sm",children:d.customerNumber}),s.jsx("td",{className:"py-3 px-4",children:d.type==="BUSINESS"&&d.companyName?d.companyName:`${d.firstName} ${d.lastName}`}),s.jsx("td",{className:"py-3 px-4",children:s.jsx(ve,{variant:d.type==="BUSINESS"?"info":"default",children:d.type==="BUSINESS"?"Firma":"Privat"})}),s.jsx("td",{className:"py-3 px-4",children:d.email||"-"}),s.jsx("td",{className:"py-3 px-4",children:((u=d._count)==null?void 0:u.contracts)||0}),s.jsx("td",{className:"py-3 px-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ke,{to:`/customers/${d.id}`,children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Pe,{className:"w-4 h-4"})})}),l("customers:update")&&s.jsx(ke,{to:`/customers/${d.id}/edit`,children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Je,{className:"w-4 h-4"})})})]})})]},d.id)})})]})}),o.pagination&&o.pagination.totalPages>1&&s.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["Seite ",o.pagination.page," von ",o.pagination.totalPages," (",o.pagination.total," Einträge)"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>i(d=>Math.max(1,d-1)),disabled:a===1,children:"Zurück"}),s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>i(d=>d+1),disabled:a>=o.pagination.totalPages,children:"Weiter"})]})]})]}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Kunden gefunden."})})]})}function sk({emails:e,selectedEmailId:t,onSelectEmail:n,onEmailDeleted:r,isLoading:a,folder:i="INBOX",accountId:l}){const o=i==="SENT",[c,d]=j.useState(null),{hasPermission:u}=He(),h=S=>{if(o)try{const P=JSON.parse(S.toAddresses);if(P.length>0)return`An: ${P[0]}${P.length>1?` (+${P.length-1})`:""}`}catch{return"An: (Unbekannt)"}return S.fromName||S.fromAddress},x=ge(),m=G({mutationFn:S=>Ae.toggleStar(S),onSuccess:(S,P)=>{x.invalidateQueries({queryKey:["emails"]}),x.invalidateQueries({queryKey:["email",P]})}}),f=G({mutationFn:({emailId:S,isRead:P})=>Ae.markAsRead(S,P),onSuccess:(S,P)=>{x.invalidateQueries({queryKey:["emails"]}),x.invalidateQueries({queryKey:["email",P.emailId]}),l&&x.invalidateQueries({queryKey:["folder-counts",l]})}}),p=G({mutationFn:S=>Ae.delete(S),onSuccess:(S,P)=>{x.invalidateQueries({queryKey:["emails"]}),l&&x.invalidateQueries({queryKey:["folder-counts",l]}),Re.success("E-Mail in Papierkorb verschoben"),d(null),r==null||r(P)},onError:S=>{console.error("Delete error:",S),Re.error(S.message||"Fehler beim Löschen der E-Mail"),d(null)}}),b=G({mutationFn:S=>Ae.unassignFromContract(S),onSuccess:()=>{x.invalidateQueries({queryKey:["emails"]}),Re.success("Vertragszuordnung aufgehoben")},onError:S=>{console.error("Unassign error:",S),Re.error(S.message||"Fehler beim Aufheben der Zuordnung")}}),g=(S,P)=>{S.stopPropagation(),b.mutate(P)},y=(S,P)=>{S.stopPropagation(),d(P)},v=S=>{S.stopPropagation(),c&&p.mutate(c)},N=S=>{S.stopPropagation(),d(null)},E=S=>{const P=new Date(S),O=new Date;return P.toDateString()===O.toDateString()?P.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"}):P.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit"})},A=(S,P)=>{S.stopPropagation(),m.mutate(P)},I=(S,P)=>{S.stopPropagation(),f.mutate({emailId:P.id,isRead:!P.isRead})},w=S=>{S.isRead||f.mutate({emailId:S.id,isRead:!0}),n(S)};return a?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}):e.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500",children:[s.jsx(nn,{className:"w-12 h-12 mb-2 opacity-50"}),s.jsx("p",{children:"Keine E-Mails vorhanden"})]}):s.jsxs("div",{className:"divide-y divide-gray-200",children:[e.map(S=>s.jsxs("div",{onClick:()=>w(S),className:["flex items-start gap-3 p-3 cursor-pointer transition-colors",t===S.id?"bg-blue-100":["hover:bg-gray-100",S.isRead?"bg-gray-50/50":"bg-white"].join(" ")].join(" "),style:{borderLeft:t===S.id?"4px solid #2563eb":"4px solid transparent"},children:[s.jsx("button",{onClick:P=>I(P,S),className:` - flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-gray-200 - ${S.isRead?"text-gray-400":"text-blue-600"} - `,title:S.isRead?"Als ungelesen markieren":"Als gelesen markieren",children:S.isRead?s.jsx(Pv,{className:"w-4 h-4"}):s.jsx(nn,{className:"w-4 h-4"})}),s.jsx("button",{onClick:P=>A(P,S.id),className:` - flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-gray-200 - ${S.isStarred?"text-yellow-500":"text-gray-400"} - `,title:S.isStarred?"Stern entfernen":"Als wichtig markieren",children:s.jsx(fh,{className:`w-4 h-4 ${S.isStarred?"fill-current":""}`})}),u("emails:delete")&&s.jsx("button",{onClick:P=>y(P,S.id),className:"flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-red-100 text-gray-400 hover:text-red-600",title:"E-Mail löschen",children:s.jsx(Ne,{className:"w-4 h-4"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[s.jsx("span",{className:`text-sm truncate ${S.isRead?"text-gray-700":"font-semibold text-gray-900"}`,children:h(S)}),s.jsx("span",{className:"text-xs text-gray-500 flex-shrink-0",children:E(S.receivedAt)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`text-sm truncate ${S.isRead?"text-gray-600":"font-medium text-gray-900"}`,children:S.subject||"(Kein Betreff)"}),S.hasAttachments&&s.jsx(Fc,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})]}),S.contract&&s.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[s.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800",children:S.contract.contractNumber}),(i==="INBOX"||i==="SENT"&&!S.isAutoAssigned)&&s.jsx("button",{onClick:P=>g(P,S.id),className:"p-0.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded",title:"Zuordnung aufheben",disabled:b.isPending,children:s.jsx(qt,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(Ft,{className:"w-4 h-4 text-gray-400 flex-shrink-0 mt-2"})]},S.id)),c&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"E-Mail löschen?"}),s.jsx("p",{className:"text-gray-600 mb-4",children:"Die E-Mail wird in den Papierkorb verschoben."}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:N,disabled:p.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:v,disabled:p.isPending,children:p.isPending?"Löschen...":"Löschen"})]})]})})]})}const Ie=j.forwardRef(({className:e="",label:t,error:n,options:r,id:a,placeholder:i="Bitte wählen...",...l},o)=>{const c=a||l.name,d=/\bw-\d+\b|\bw-\[|\bflex-/.test(e);return s.jsxs("div",{className:d?e:"w-full",children:[t&&s.jsx("label",{htmlFor:c,className:"block text-sm font-medium text-gray-700 mb-1",children:t}),s.jsxs("select",{ref:o,id:c,className:`block w-full px-3 py-2 border rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${n?"border-red-500":"border-gray-300"}`,...l,children:[s.jsx("option",{value:"",children:i}),r.map(u=>s.jsx("option",{value:u.value,children:u.label},u.value))]}),n&&s.jsx("p",{className:"mt-1 text-sm text-red-600",children:n})]})});Ie.displayName="Select";function nk({isOpen:e,onClose:t,emailId:n,attachmentFilename:r,onSuccess:a}){var O,R,q;const[i,l]=j.useState(null),[o,c]=j.useState(new Set(["customer"])),[d,u]=j.useState("document"),[h,x]=j.useState({invoiceDate:new Date().toISOString().split("T")[0],invoiceType:"INTERIM",notes:""}),m=ge(),{data:f,isLoading:p,error:b}=fe({queryKey:["attachment-targets",n],queryFn:()=>Ae.getAttachmentTargets(n),enabled:e}),g=f==null?void 0:f.data,y=((O=g==null?void 0:g.contract)==null?void 0:O.type)==="ELECTRICITY"||((R=g==null?void 0:g.contract)==null?void 0:R.type)==="GAS",v=G({mutationFn:()=>{if(!i)throw new Error("Kein Ziel ausgewählt");return Ae.saveAttachmentTo(n,r,{entityType:i.entityType,entityId:i.entityId,targetKey:i.targetKey})},onSuccess:()=>{var D,z;Re.success("Anhang gespeichert"),m.invalidateQueries({queryKey:["attachment-targets",n]}),m.invalidateQueries({queryKey:["customers"]}),m.invalidateQueries({queryKey:["contracts"]}),(D=g==null?void 0:g.customer)!=null&&D.id&&m.invalidateQueries({queryKey:["customer",g.customer.id.toString()]}),(z=g==null?void 0:g.contract)!=null&&z.id&&m.invalidateQueries({queryKey:["contract",g.contract.id.toString()]}),a==null||a(),E()},onError:D=>{Re.error(D.message||"Fehler beim Speichern")}}),N=G({mutationFn:()=>Ae.saveAttachmentAsInvoice(n,r,{invoiceDate:h.invoiceDate,invoiceType:h.invoiceType,notes:h.notes||void 0}),onSuccess:()=>{var D;Re.success("Anhang als Rechnung gespeichert"),m.invalidateQueries({queryKey:["attachment-targets",n]}),m.invalidateQueries({queryKey:["customers"]}),m.invalidateQueries({queryKey:["contracts"]}),(D=g==null?void 0:g.contract)!=null&&D.id&&m.invalidateQueries({queryKey:["contract",g.contract.id.toString()]}),a==null||a(),E()},onError:D=>{Re.error(D.message||"Fehler beim Speichern der Rechnung")}}),E=()=>{l(null),u("document"),x({invoiceDate:new Date().toISOString().split("T")[0],invoiceType:"INTERIM",notes:""}),t()},A=D=>{const z=new Set(o);z.has(D)?z.delete(D):z.add(D),c(z)},I=(D,z,k,K)=>{l({entityType:D,entityId:k,targetKey:z.key,hasDocument:z.hasDocument,label:K?`${K} → ${z.label}`:z.label})},w=(D,z,k,K)=>D.map(B=>{const _=(i==null?void 0:i.entityType)===z&&(i==null?void 0:i.entityId)===k&&(i==null?void 0:i.targetKey)===B.key;return s.jsxs("div",{onClick:()=>I(z,B,k,K),className:` - flex items-center gap-3 p-3 cursor-pointer transition-colors rounded-lg ml-4 - ${_?"bg-blue-100 ring-2 ring-blue-500":"hover:bg-gray-100"} - `,children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-gray-900",children:B.label}),B.hasDocument&&s.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 text-xs rounded-full bg-yellow-100 text-yellow-800",children:[s.jsx(hs,{className:"w-3 h-3"}),"Vorhanden"]})]})}),_&&s.jsx(xr,{className:"w-5 h-5 text-blue-600"})]},B.key)}),S=(D,z)=>s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-sm font-medium text-gray-700 px-3 py-1 bg-gray-50 rounded",children:D.label}),w(D.slots,z,D.id,D.label)]},D.id),P=(D,z,k,K,B=!1)=>{const _=o.has(z);return s.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[s.jsxs("button",{onClick:()=>A(z),className:"w-full flex items-center gap-2 p-3 bg-gray-50 hover:bg-gray-100 transition-colors",children:[_?s.jsx(Rn,{className:"w-4 h-4 text-gray-500"}):s.jsx(Ft,{className:"w-4 h-4 text-gray-500"}),k,s.jsx("span",{className:"font-medium text-gray-900",children:D})]}),_&&s.jsx("div",{className:"p-2",children:B?s.jsx("p",{className:"text-sm text-gray-500 text-center py-4",children:"Keine Einträge vorhanden"}):K})]})};return s.jsx(Ve,{isOpen:e,onClose:E,title:"Anhang speichern unter",size:"lg",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"p-3 bg-gray-50 rounded-lg",children:s.jsxs("p",{className:"text-sm text-gray-600",children:[s.jsx("span",{className:"font-medium",children:"Datei:"})," ",r]})}),p&&s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"})}),b&&s.jsx("div",{className:"p-4 bg-red-50 text-red-700 rounded-lg",children:"Fehler beim Laden der Dokumentziele"}),g&&s.jsxs(s.Fragment,{children:[y&&s.jsxs("div",{className:"flex gap-2 p-1 bg-gray-100 rounded-lg",children:[s.jsxs("button",{onClick:()=>u("document"),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors ${d==="document"?"bg-white text-blue-600 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Ke,{className:"w-4 h-4"}),"Als Dokument"]}),s.jsxs("button",{onClick:()=>u("invoice"),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors ${d==="invoice"?"bg-white text-green-600 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(uh,{className:"w-4 h-4"}),"Als Rechnung"]})]}),d==="document"&&s.jsxs("div",{className:"space-y-3 max-h-96 overflow-auto",children:[P(`Kunde: ${g.customer.name}`,"customer",s.jsx(Fl,{className:"w-4 h-4 text-blue-600"}),w(g.customer.slots,"customer"),g.customer.slots.length===0),P("Ausweisdokumente","identityDocuments",s.jsx(Dv,{className:"w-4 h-4 text-green-600"}),g.identityDocuments.map(D=>S(D,"identityDocument")),g.identityDocuments.length===0),P("Bankkarten","bankCards",s.jsx(oh,{className:"w-4 h-4 text-purple-600"}),g.bankCards.map(D=>S(D,"bankCard")),g.bankCards.length===0),g.contract&&P(`Vertrag: ${g.contract.contractNumber}`,"contract",s.jsx(Ke,{className:"w-4 h-4 text-orange-600"}),w(g.contract.slots,"contract"),g.contract.slots.length===0),!g.contract&&s.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg text-sm text-gray-600",children:[s.jsx(Ke,{className:"w-4 h-4 inline-block mr-2 text-gray-400"}),"E-Mail ist keinem Vertrag zugeordnet. Ordnen Sie die E-Mail einem Vertrag zu, um Vertragsdokumente als Ziel auswählen zu können."]})]}),d==="invoice"&&y&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"p-3 bg-green-50 rounded-lg",children:s.jsxs("p",{className:"text-sm text-green-700",children:["Der Anhang wird als Rechnung für den Vertrag ",s.jsx("strong",{children:(q=g.contract)==null?void 0:q.contractNumber})," gespeichert."]})}),s.jsx(H,{label:"Rechnungsdatum",type:"date",value:h.invoiceDate,onChange:D=>x({...h,invoiceDate:D.target.value}),required:!0}),s.jsx(Ie,{label:"Rechnungstyp",value:h.invoiceType,onChange:D=>x({...h,invoiceType:D.target.value}),options:[{value:"INTERIM",label:"Zwischenrechnung"},{value:"FINAL",label:"Schlussrechnung"}]}),s.jsx(H,{label:"Notizen (optional)",value:h.notes,onChange:D=>x({...h,notes:D.target.value}),placeholder:"Optionale Anmerkungen..."})]})]}),d==="document"&&(i==null?void 0:i.hasDocument)&&s.jsxs("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg flex items-start gap-2",children:[s.jsx(hs,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm text-yellow-800",children:[s.jsx("strong",{children:"Achtung:"})," An diesem Feld ist bereits ein Dokument hinterlegt. Das vorhandene Dokument wird durch den neuen Anhang ersetzt."]})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:E,children:"Abbrechen"}),d==="document"?s.jsx(T,{onClick:()=>v.mutate(),disabled:!i||v.isPending||N.isPending,children:v.isPending?"Wird gespeichert...":"Speichern"}):s.jsx(T,{onClick:()=>N.mutate(),disabled:!h.invoiceDate||v.isPending||N.isPending,children:N.isPending?"Wird gespeichert...":"Als Rechnung speichern"})]})]})})}function rk({isOpen:e,onClose:t,emailId:n,onSuccess:r}){var O,R,q;const[a,i]=j.useState(null),[l,o]=j.useState(new Set(["customer"])),[c,d]=j.useState("document"),[u,h]=j.useState({invoiceDate:new Date().toISOString().split("T")[0],invoiceType:"INTERIM",notes:""}),x=ge(),{data:m,isLoading:f,error:p}=fe({queryKey:["attachment-targets",n],queryFn:()=>Ae.getAttachmentTargets(n),enabled:e}),b=m==null?void 0:m.data,g=((O=b==null?void 0:b.contract)==null?void 0:O.type)==="ELECTRICITY"||((R=b==null?void 0:b.contract)==null?void 0:R.type)==="GAS",y=G({mutationFn:()=>{if(!a)throw new Error("Kein Ziel ausgewählt");return Ae.saveEmailAsPdf(n,{entityType:a.entityType,entityId:a.entityId,targetKey:a.targetKey})},onSuccess:()=>{var D,z;Re.success("E-Mail als PDF gespeichert"),x.invalidateQueries({queryKey:["attachment-targets",n]}),x.invalidateQueries({queryKey:["customers"]}),x.invalidateQueries({queryKey:["contracts"]}),(D=b==null?void 0:b.customer)!=null&&D.id&&x.invalidateQueries({queryKey:["customer",b.customer.id.toString()]}),(z=b==null?void 0:b.contract)!=null&&z.id&&x.invalidateQueries({queryKey:["contract",b.contract.id.toString()]}),r==null||r(),N()},onError:D=>{Re.error(D.message||"Fehler beim Speichern")}}),v=G({mutationFn:()=>Ae.saveEmailAsInvoice(n,{invoiceDate:u.invoiceDate,invoiceType:u.invoiceType,notes:u.notes||void 0}),onSuccess:()=>{var D;Re.success("E-Mail als Rechnung gespeichert"),x.invalidateQueries({queryKey:["attachment-targets",n]}),x.invalidateQueries({queryKey:["customers"]}),x.invalidateQueries({queryKey:["contracts"]}),(D=b==null?void 0:b.contract)!=null&&D.id&&x.invalidateQueries({queryKey:["contract",b.contract.id.toString()]}),r==null||r(),N()},onError:D=>{Re.error(D.message||"Fehler beim Speichern der Rechnung")}}),N=()=>{i(null),d("document"),h({invoiceDate:new Date().toISOString().split("T")[0],invoiceType:"INTERIM",notes:""}),t()},E=D=>{const z=new Set(l);z.has(D)?z.delete(D):z.add(D),o(z)},A=(D,z,k,K)=>{i({entityType:D,entityId:k,targetKey:z.key,hasDocument:z.hasDocument,label:K?`${K} → ${z.label}`:z.label})},I=(D,z,k,K)=>D.map(B=>{const _=(a==null?void 0:a.entityType)===z&&(a==null?void 0:a.entityId)===k&&(a==null?void 0:a.targetKey)===B.key;return s.jsxs("div",{onClick:()=>A(z,B,k,K),className:` - flex items-center gap-3 p-3 cursor-pointer transition-colors rounded-lg ml-4 - ${_?"bg-blue-100 ring-2 ring-blue-500":"hover:bg-gray-100"} - `,children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-gray-900",children:B.label}),B.hasDocument&&s.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 text-xs rounded-full bg-yellow-100 text-yellow-800",children:[s.jsx(hs,{className:"w-3 h-3"}),"Vorhanden"]})]})}),_&&s.jsx(xr,{className:"w-5 h-5 text-blue-600"})]},B.key)}),w=(D,z)=>s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-sm font-medium text-gray-700 px-3 py-1 bg-gray-50 rounded",children:D.label}),I(D.slots,z,D.id,D.label)]},D.id),S=(D,z,k,K,B=!1)=>{const _=l.has(z);return s.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[s.jsxs("button",{onClick:()=>E(z),className:"w-full flex items-center gap-2 p-3 bg-gray-50 hover:bg-gray-100 transition-colors",children:[_?s.jsx(Rn,{className:"w-4 h-4 text-gray-500"}):s.jsx(Ft,{className:"w-4 h-4 text-gray-500"}),k,s.jsx("span",{className:"font-medium text-gray-900",children:D})]}),_&&s.jsx("div",{className:"p-2",children:B?s.jsx("p",{className:"text-sm text-gray-500 text-center py-4",children:"Keine Einträge vorhanden"}):K})]})},P=y.isPending||v.isPending;return s.jsx(Ve,{isOpen:e,onClose:N,title:"E-Mail als PDF speichern",size:"lg",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"p-3 bg-blue-50 rounded-lg",children:s.jsx("p",{className:"text-sm text-blue-700",children:"Die E-Mail wird als PDF exportiert (inkl. Absender, Empfänger, Datum und Inhalt) und im gewählten Dokumentenfeld gespeichert."})}),f&&s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"})}),p&&s.jsx("div",{className:"p-4 bg-red-50 text-red-700 rounded-lg",children:"Fehler beim Laden der Dokumentziele"}),b&&s.jsxs(s.Fragment,{children:[g&&s.jsxs("div",{className:"flex gap-2 p-1 bg-gray-100 rounded-lg",children:[s.jsxs("button",{onClick:()=>d("document"),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors ${c==="document"?"bg-white text-blue-600 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Ke,{className:"w-4 h-4"}),"Als Dokument"]}),s.jsxs("button",{onClick:()=>d("invoice"),className:`flex-1 flex items-center justify-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors ${c==="invoice"?"bg-white text-green-600 shadow-sm":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(uh,{className:"w-4 h-4"}),"Als Rechnung"]})]}),c==="document"&&s.jsxs("div",{className:"space-y-3 max-h-96 overflow-auto",children:[S(`Kunde: ${b.customer.name}`,"customer",s.jsx(Fl,{className:"w-4 h-4 text-blue-600"}),I(b.customer.slots,"customer"),b.customer.slots.length===0),S("Ausweisdokumente","identityDocuments",s.jsx(Dv,{className:"w-4 h-4 text-green-600"}),b.identityDocuments.map(D=>w(D,"identityDocument")),b.identityDocuments.length===0),S("Bankkarten","bankCards",s.jsx(oh,{className:"w-4 h-4 text-purple-600"}),b.bankCards.map(D=>w(D,"bankCard")),b.bankCards.length===0),b.contract&&S(`Vertrag: ${b.contract.contractNumber}`,"contract",s.jsx(Ke,{className:"w-4 h-4 text-orange-600"}),I(b.contract.slots,"contract"),b.contract.slots.length===0),!b.contract&&s.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg text-sm text-gray-600",children:[s.jsx(Ke,{className:"w-4 h-4 inline-block mr-2 text-gray-400"}),"E-Mail ist keinem Vertrag zugeordnet. Ordnen Sie die E-Mail einem Vertrag zu, um Vertragsdokumente als Ziel auswählen zu können."]})]}),c==="invoice"&&g&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"p-3 bg-green-50 rounded-lg",children:s.jsxs("p",{className:"text-sm text-green-700",children:["Die E-Mail wird als Rechnung für den Vertrag ",s.jsx("strong",{children:(q=b.contract)==null?void 0:q.contractNumber})," gespeichert."]})}),s.jsx(H,{label:"Rechnungsdatum",type:"date",value:u.invoiceDate,onChange:D=>h({...u,invoiceDate:D.target.value}),required:!0}),s.jsx(Ie,{label:"Rechnungstyp",value:u.invoiceType,onChange:D=>h({...u,invoiceType:D.target.value}),options:[{value:"INTERIM",label:"Zwischenrechnung"},{value:"FINAL",label:"Schlussrechnung"}]}),s.jsx(H,{label:"Notizen (optional)",value:u.notes,onChange:D=>h({...u,notes:D.target.value}),placeholder:"Optionale Anmerkungen..."})]})]}),c==="document"&&(a==null?void 0:a.hasDocument)&&s.jsxs("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg flex items-start gap-2",children:[s.jsx(hs,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm text-yellow-800",children:[s.jsx("strong",{children:"Achtung:"})," An diesem Feld ist bereits ein Dokument hinterlegt. Das vorhandene Dokument wird durch die PDF ersetzt."]})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:N,children:"Abbrechen"}),c==="document"?s.jsx(T,{onClick:()=>y.mutate(),disabled:!a||P,children:P?"Wird erstellt...":"Als PDF speichern"}):s.jsx(T,{onClick:()=>v.mutate(),disabled:!u.invoiceDate||P,children:P?"Wird erstellt...":"Als Rechnung speichern"})]})]})})}function Iv({email:e,onReply:t,onAssignContract:n,onDeleted:r,isSentFolder:a=!1,isContractView:i=!1,isTrashView:l=!1,onRestored:o,accountId:c}){const[d,u]=j.useState(!0),[h,x]=j.useState(e.isStarred),[m,f]=j.useState(!1),[p,b]=j.useState(!1),[g,y]=j.useState(!1),[v,N]=j.useState(null),[E,A]=j.useState(!1),I=ge(),{hasPermission:w}=He();j.useEffect(()=>{x(e.isStarred)},[e.id,e.isStarred]);const S=G({mutationFn:()=>Ae.toggleStar(e.id),onMutate:()=>{x(Q=>!Q)},onSuccess:()=>{I.invalidateQueries({queryKey:["emails"]}),I.invalidateQueries({queryKey:["email",e.id]})},onError:()=>{x(e.isStarred)}}),P=G({mutationFn:()=>Ae.unassignFromContract(e.id),onSuccess:()=>{I.invalidateQueries({queryKey:["emails"]}),I.invalidateQueries({queryKey:["email",e.id]}),e.contractId&&I.invalidateQueries({queryKey:["contract-folder-counts",e.contractId]}),Re.success("Vertragszuordnung aufgehoben")},onError:Q=>{console.error("Unassign error:",Q),Re.error(Q.message||"Fehler beim Aufheben der Zuordnung")}}),O=G({mutationFn:()=>Ae.delete(e.id),onSuccess:()=>{I.invalidateQueries({queryKey:["emails"]}),c&&I.invalidateQueries({queryKey:["folder-counts",c]}),e.contractId&&I.invalidateQueries({queryKey:["contract-folder-counts",e.contractId]}),Re.success("E-Mail in Papierkorb verschoben"),f(!1),r==null||r()},onError:Q=>{console.error("Delete error:",Q),Re.error(Q.message||"Fehler beim Löschen der E-Mail"),f(!1)}}),R=G({mutationFn:()=>Ae.restore(e.id),onSuccess:()=>{I.invalidateQueries({queryKey:["emails"]}),c&&I.invalidateQueries({queryKey:["folder-counts",c]}),e.contractId&&I.invalidateQueries({queryKey:["contract-folder-counts",e.contractId]}),Re.success("E-Mail wiederhergestellt"),b(!1),o==null||o()},onError:Q=>{console.error("Restore error:",Q),Re.error(Q.message||"Fehler beim Wiederherstellen der E-Mail"),b(!1)}}),q=G({mutationFn:()=>Ae.permanentDelete(e.id),onSuccess:()=>{I.invalidateQueries({queryKey:["emails"]}),c&&I.invalidateQueries({queryKey:["folder-counts",c]}),Re.success("E-Mail endgültig gelöscht"),y(!1),r==null||r()},onError:Q=>{console.error("Permanent delete error:",Q),Re.error(Q.message||"Fehler beim endgültigen Löschen der E-Mail"),y(!1)}}),D=Q=>new Date(Q).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),z=Q=>{try{return JSON.parse(Q)}catch{return[]}},k=Q=>{if(!Q)return[];try{return JSON.parse(Q)}catch{return[]}},K=z(e.toAddresses),B=e.ccAddresses?z(e.ccAddresses):[],_=k(e.attachmentNames);return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"p-4 border-b border-gray-200 space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:e.subject||"(Kein Betreff)"}),s.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:l?s.jsxs(s.Fragment,{children:[s.jsxs(T,{variant:"secondary",size:"sm",onClick:()=>b(!0),title:"Wiederherstellen",children:[s.jsx(Fv,{className:"w-4 h-4 mr-1"}),"Wiederherstellen"]}),s.jsxs(T,{variant:"danger",size:"sm",onClick:()=>y(!0),title:"Endgültig löschen",children:[s.jsx(Ne,{className:"w-4 h-4 mr-1"}),"Endgültig löschen"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>S.mutate(),className:`p-2 rounded-lg hover:bg-gray-100 ${h?"text-yellow-500":"text-gray-400"}`,title:h?"Stern entfernen":"Als wichtig markieren",children:s.jsx(fh,{className:`w-5 h-5 ${h?"fill-current":""}`})}),s.jsxs(T,{variant:"secondary",size:"sm",onClick:t,children:[s.jsx(B2,{className:"w-4 h-4 mr-1"}),"Antworten"]}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>A(!0),title:"E-Mail als PDF speichern",children:s.jsx(M2,{className:"w-4 h-4"})}),w("emails:delete")&&s.jsx(T,{variant:"danger",size:"sm",onClick:()=>f(!0),title:"E-Mail löschen",children:s.jsx(Ne,{className:"w-4 h-4"})})]})})]}),s.jsxs("div",{className:"text-sm space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-500 w-12",children:"Von:"}),s.jsxs("span",{className:"font-medium text-gray-900",children:[e.fromName&&`${e.fromName} `,s.jsxs("span",{className:"text-gray-600",children:["<",e.fromAddress,">"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-500 w-12",children:"An:"}),s.jsx("span",{className:"text-gray-700",children:K.join(", ")})]}),B.length>0&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-500 w-12",children:"CC:"}),s.jsx("span",{className:"text-gray-700",children:B.join(", ")})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-gray-500 w-12",children:"Am:"}),s.jsx("span",{className:"text-gray-700",children:D(e.receivedAt)})]})]}),s.jsx("div",{className:"flex items-center gap-2 pt-2",children:e.contract?s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-green-50 border border-green-200 rounded-lg",children:[s.jsx(fx,{className:"w-4 h-4 text-green-600"}),s.jsxs("span",{className:"text-sm text-green-800",children:["Zugeordnet zu:"," ",s.jsx(ke,{to:`/contracts/${e.contract.id}`,className:"font-medium hover:underline",children:e.contract.contractNumber})]}),!e.isAutoAssigned&&s.jsx("button",{onClick:()=>P.mutate(),className:"ml-2 p-1 hover:bg-green-100 rounded",title:"Zuordnung aufheben",children:s.jsx(qt,{className:"w-4 h-4 text-green-600"})})]}):!i&&s.jsxs(T,{variant:"secondary",size:"sm",onClick:n,children:[s.jsx(fx,{className:"w-4 h-4 mr-1"}),"Vertrag zuordnen"]})}),_.length>0&&s.jsxs("div",{className:"pt-2",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(Fc,{className:"w-4 h-4 text-gray-400"}),s.jsxs("span",{className:"text-sm text-gray-500",children:[_.length," Anhang",_.length>1?"e":""]})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:_.map((Q,le)=>s.jsxs("div",{className:"inline-flex items-center gap-1 px-3 py-2 bg-gray-100 rounded-lg text-sm text-gray-700",children:[s.jsx("span",{className:"max-w-[200px] truncate mr-1",children:Q}),s.jsx("a",{href:Ae.getAttachmentUrl(e.id,Q,!0),target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-gray-200 rounded transition-colors",title:`${Q} öffnen`,children:s.jsx(ch,{className:"w-4 h-4 text-gray-500"})}),s.jsx("a",{href:Ae.getAttachmentUrl(e.id,Q),download:Q,className:"p-1 hover:bg-gray-200 rounded transition-colors",title:`${Q} herunterladen`,children:s.jsx(As,{className:"w-4 h-4 text-gray-500"})}),!l&&s.jsx("button",{onClick:()=>N(Q),className:"p-1 hover:bg-blue-100 rounded transition-colors",title:`${Q} speichern unter...`,children:s.jsx(Av,{className:"w-4 h-4 text-blue-500"})})]},le))})]})]}),e.htmlBody&&e.textBody&&s.jsxs("div",{className:"px-4 py-2 border-b border-gray-200 flex items-center gap-2",children:[s.jsx("button",{onClick:()=>u(!0),className:`px-3 py-1 text-sm rounded ${d?"bg-blue-100 text-blue-700":"text-gray-600 hover:bg-gray-100"}`,children:"HTML"}),s.jsx("button",{onClick:()=>u(!1),className:`px-3 py-1 text-sm rounded ${d?"text-gray-600 hover:bg-gray-100":"bg-blue-100 text-blue-700"}`,children:"Text"})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:d&&e.htmlBody?s.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:e.htmlBody}}):s.jsx("pre",{className:"whitespace-pre-wrap text-sm text-gray-700 font-sans",children:e.textBody||"Kein Inhalt"})}),m&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"E-Mail löschen?"}),s.jsx("p",{className:"text-gray-600 mb-4",children:"Die E-Mail wird in den Papierkorb verschoben."}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:()=>f(!1),disabled:O.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:()=>O.mutate(),disabled:O.isPending,children:O.isPending?"Löschen...":"Löschen"})]})]})}),p&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"E-Mail wiederherstellen?"}),s.jsxs("p",{className:"text-gray-600 mb-4",children:["Die E-Mail wird wieder in den ursprünglichen Ordner (",e.folder==="SENT"?"Gesendet":"Posteingang",") verschoben."]}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:()=>b(!1),disabled:R.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"primary",onClick:()=>R.mutate(),disabled:R.isPending,children:R.isPending?"Wird wiederhergestellt...":"Wiederherstellen"})]})]})}),g&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"E-Mail endgültig löschen?"}),s.jsx("p",{className:"text-gray-600 mb-4",children:"Diese Aktion kann nicht rückgängig gemacht werden. Die E-Mail wird unwiderruflich gelöscht."}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:()=>y(!1),disabled:q.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:()=>q.mutate(),disabled:q.isPending,children:q.isPending?"Wird gelöscht...":"Endgültig löschen"})]})]})}),v&&s.jsx(nk,{isOpen:!0,onClose:()=>N(null),emailId:e.id,attachmentFilename:v}),E&&s.jsx(rk,{isOpen:!0,onClose:()=>A(!1),emailId:e.id})]})}function Rv({isOpen:e,onClose:t,account:n,replyTo:r,onSuccess:a,contractId:i}){const[l,o]=j.useState(""),[c,d]=j.useState(""),[u,h]=j.useState(""),[x,m]=j.useState(""),[f,p]=j.useState([]),[b,g]=j.useState(null),y=j.useRef(null);j.useEffect(()=>{if(e){if(r){o(r.fromAddress||"");const R=r.subject||"",q=/^(Re|Aw|Fwd|Wg):\s*/i.test(R);h(q?R:`Re: ${R}`);const D=new Date(r.receivedAt).toLocaleString("de-DE"),z=r.textBody?` - ---- Ursprüngliche Nachricht --- -Von: ${r.fromName||r.fromAddress} -Am: ${D} - -${r.textBody}`:"";m(z)}else o(""),h(""),m("");d(""),p([]),g(null)}},[e,r]);const v=10*1024*1024,N=25*1024*1024,E=R=>new Promise((q,D)=>{const z=new FileReader;z.readAsDataURL(R),z.onload=()=>{const K=z.result.split(",")[1];q(K)},z.onerror=D}),A=async R=>{const q=R.target.files;if(!q)return;const D=[];let z=f.reduce((k,K)=>k+K.content.length*.75,0);for(const k of Array.from(q)){if(k.size>v){g(`Datei "${k.name}" ist zu groß (max. 10 MB)`);continue}if(z+k.size>N){g("Maximale Gesamtgröße der Anhänge erreicht (25 MB)");break}try{const K=await E(k);D.push({filename:k.name,content:K,contentType:k.type||"application/octet-stream"}),z+=k.size}catch{g(`Fehler beim Lesen von "${k.name}"`)}}D.length>0&&p(k=>[...k,...D]),y.current&&(y.current.value="")},I=R=>{p(q=>q.filter((D,z)=>z!==R))},w=R=>{const q=R.length*.75;return q<1024?`${Math.round(q)} B`:q<1024*1024?`${(q/1024).toFixed(1)} KB`:`${(q/(1024*1024)).toFixed(1)} MB`},S=G({mutationFn:()=>xs.sendEmail(n.id,{to:l.split(",").map(R=>R.trim()).filter(Boolean),cc:c?c.split(",").map(R=>R.trim()).filter(Boolean):void 0,subject:u,text:x,inReplyTo:r==null?void 0:r.messageId,references:r!=null&&r.messageId?[r.messageId]:void 0,attachments:f.length>0?f:void 0,contractId:i}),onSuccess:()=>{a==null||a(),P()},onError:R=>{g(R instanceof Error?R.message:"Fehler beim Senden")}}),P=()=>{t()},O=()=>{if(!l.trim()){g("Bitte Empfänger angeben");return}if(!u.trim()){g("Bitte Betreff angeben");return}g(null),S.mutate()};return s.jsx(Ve,{isOpen:e,onClose:P,title:r?"Antworten":"Neue E-Mail",size:"lg",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Von"}),s.jsx("div",{className:"px-3 py-2 bg-gray-100 rounded-lg text-sm text-gray-700",children:n.email})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["An ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",value:l,onChange:R=>o(R.target.value),placeholder:"empfaenger@example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),s.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Mehrere Empfänger mit Komma trennen"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"CC"}),s.jsx("input",{type:"text",value:c,onChange:R=>d(R.target.value),placeholder:"cc@example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["Betreff ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",value:u,onChange:R=>h(R.target.value),placeholder:"Betreff eingeben",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Nachricht"}),s.jsx("textarea",{value:x,onChange:R=>m(R.target.value),rows:10,placeholder:"Ihre Nachricht...",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Anhänge"}),s.jsx("input",{type:"file",ref:y,onChange:A,multiple:!0,className:"hidden"}),s.jsxs("button",{type:"button",onClick:()=>{var R;return(R=y.current)==null?void 0:R.click()},className:"inline-flex items-center px-3 py-2 text-sm border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:[s.jsx(Fc,{className:"w-4 h-4 mr-2"}),"Datei anhängen"]}),f.length>0&&s.jsx("div",{className:"mt-2 space-y-2",children:f.map((R,q)=>s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-gray-50 rounded-lg",children:[s.jsxs("div",{className:"flex items-center min-w-0",children:[s.jsx(Ke,{className:"w-4 h-4 text-gray-500 mr-2 flex-shrink-0"}),s.jsx("span",{className:"text-sm text-gray-700 truncate",children:R.filename}),s.jsxs("span",{className:"ml-2 text-xs text-gray-500 flex-shrink-0",children:["(",w(R.content),")"]})]}),s.jsx("button",{type:"button",onClick:()=>I(q),className:"ml-2 p-1 text-gray-400 hover:text-red-500 transition-colors",title:"Anhang entfernen",children:s.jsx(qt,{className:"w-4 h-4"})})]},q))}),s.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Max. 10 MB pro Datei, 25 MB gesamt"})]}),b&&s.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:b}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:P,children:"Abbrechen"}),s.jsxs(T,{onClick:O,disabled:S.isPending,children:[s.jsx(Tl,{className:"w-4 h-4 mr-2"}),S.isPending?"Wird gesendet...":"Senden"]})]})]})})}function ak({isOpen:e,onClose:t,email:n,customerId:r,onSuccess:a}){const[i,l]=j.useState(""),[o,c]=j.useState(null),d=ge(),{data:u,isLoading:h}=fe({queryKey:["contracts","customer",r],queryFn:()=>Oe.getAll({customerId:r}),enabled:e}),m=((u==null?void 0:u.data)||[]).filter(y=>{var N,E,A,I;if(!i)return!0;const v=i.toLowerCase();return y.contractNumber.toLowerCase().includes(v)||((E=(N=y.contractCategory)==null?void 0:N.name)==null?void 0:E.toLowerCase().includes(v))||((I=(A=y.provider)==null?void 0:A.name)==null?void 0:I.toLowerCase().includes(v))}),f=G({mutationFn:y=>Ae.assignToContract(n.id,y),onSuccess:(y,v)=>{d.invalidateQueries({queryKey:["emails"]}),d.invalidateQueries({queryKey:["email",n.id]}),d.invalidateQueries({queryKey:["contract-folder-counts",v]}),a==null||a(),p()}}),p=()=>{l(""),c(null),t()},b=()=>{o&&f.mutate(o)},g=y=>y?new Date(y).toLocaleDateString("de-DE"):"-";return s.jsx(Ve,{isOpen:e,onClose:p,title:"E-Mail Vertrag zuordnen",size:"lg",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg",children:[s.jsxs("p",{className:"text-sm text-gray-600",children:[s.jsx("span",{className:"font-medium",children:"Betreff:"})," ",n.subject||"(Kein Betreff)"]}),s.jsxs("p",{className:"text-sm text-gray-600",children:[s.jsx("span",{className:"font-medium",children:"Von:"})," ",n.fromAddress]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Ml,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx("input",{type:"text",value:i,onChange:y=>l(y.target.value),placeholder:"Vertrag suchen...",className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),s.jsx("div",{className:"border border-gray-200 rounded-lg max-h-80 overflow-auto",children:h?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"})}):m.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-gray-500",children:[s.jsx(Ke,{className:"w-8 h-8 mb-2 opacity-50"}),s.jsx("p",{className:"text-sm",children:"Keine Verträge gefunden"})]}):s.jsx("div",{className:"divide-y divide-gray-200",children:m.map(y=>{var v;return s.jsx("div",{onClick:()=>c(y.id),className:` - flex items-center gap-3 p-3 cursor-pointer transition-colors - ${o===y.id?"bg-blue-50 border-l-2 border-l-blue-500":"hover:bg-gray-50"} - `,children:s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-medium text-gray-900",children:y.contractNumber}),s.jsx("span",{className:` - px-2 py-0.5 text-xs rounded-full - ${y.status==="ACTIVE"?"bg-green-100 text-green-800":y.status==="PENDING"?"bg-yellow-100 text-yellow-800":y.status==="CANCELLED"?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"} - `,children:y.status})]}),s.jsxs("div",{className:"text-sm text-gray-600 truncate",children:[(v=y.contractCategory)==null?void 0:v.name,y.provider&&` - ${y.provider.name}`]}),s.jsxs("div",{className:"text-xs text-gray-500",children:["Start: ",g(y.startDate)]})]})},y.id)})})}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:p,children:"Abbrechen"}),s.jsx(T,{onClick:b,disabled:!o||f.isPending,children:f.isPending?"Wird zugeordnet...":"Zuordnen"})]})]})})}function Lv({emails:e,selectedEmailId:t,onSelectEmail:n,onEmailRestored:r,onEmailDeleted:a,isLoading:i}){const[l,o]=j.useState(null),[c,d]=j.useState(null),u=ge(),h=A=>{if(A.folder==="SENT")try{const I=JSON.parse(A.toAddresses);if(I.length>0)return`An: ${I[0]}${I.length>1?` (+${I.length-1})`:""}`}catch{return"An: (Unbekannt)"}return A.fromName||A.fromAddress},x=G({mutationFn:A=>Ae.restore(A),onSuccess:(A,I)=>{u.invalidateQueries({queryKey:["emails"]}),Re.success("E-Mail wiederhergestellt"),o(null),d(null),r==null||r(I)},onError:A=>{console.error("Restore error:",A),Re.error(A.message||"Fehler beim Wiederherstellen"),o(null),d(null)}}),m=G({mutationFn:A=>Ae.permanentDelete(A),onSuccess:(A,I)=>{u.invalidateQueries({queryKey:["emails"]}),Re.success("E-Mail endgültig gelöscht"),o(null),d(null),a==null||a(I)},onError:A=>{console.error("Permanent delete error:",A),Re.error(A.message||"Fehler beim endgültigen Löschen"),o(null),d(null)}}),f=G({mutationFn:A=>Ae.unassignFromContract(A),onSuccess:()=>{u.invalidateQueries({queryKey:["emails"]}),Re.success("Vertragszuordnung aufgehoben")},onError:A=>{console.error("Unassign error:",A),Re.error(A.message||"Fehler beim Aufheben der Zuordnung")}}),p=(A,I)=>{A.stopPropagation(),f.mutate(I)},b=(A,I)=>{A.stopPropagation(),o(I),d("restore")},g=(A,I)=>{A.stopPropagation(),o(I),d("delete")},y=A=>{A.stopPropagation(),l&&c&&(c==="restore"?x.mutate(l):m.mutate(l))},v=A=>{A.stopPropagation(),o(null),d(null)},N=A=>new Date(A).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit"}),E=A=>{if(!A)return"";const I=new Date(A),w=new Date;return I.toDateString()===w.toDateString()?`Gelöscht um ${I.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"})}`:`Gelöscht am ${I.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit"})}`};return i?s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-red-600"})}):e.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-gray-500",children:[s.jsx(Ne,{className:"w-12 h-12 mb-2 opacity-50"}),s.jsx("p",{children:"Papierkorb ist leer"})]}):s.jsxs("div",{className:"divide-y divide-gray-200",children:[e.map(A=>s.jsxs("div",{onClick:()=>n(A),className:["flex items-start gap-3 p-3 cursor-pointer transition-colors",t===A.id?"bg-red-100":"hover:bg-gray-100 bg-gray-50/50"].join(" "),style:{borderLeft:t===A.id?"4px solid #dc2626":"4px solid transparent"},children:[s.jsx("div",{className:"flex-shrink-0 mt-1 p-1 -ml-1 text-gray-400",title:A.folder==="SENT"?"Aus Gesendet":"Aus Posteingang",children:A.folder==="SENT"?s.jsx(Tl,{className:"w-4 h-4"}):s.jsx(Ur,{className:"w-4 h-4"})}),s.jsx("button",{onClick:I=>b(I,A.id),className:"flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-green-100 text-gray-400 hover:text-green-600",title:"Wiederherstellen",children:s.jsx(Fv,{className:"w-4 h-4"})}),s.jsx("button",{onClick:I=>g(I,A.id),className:"flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-red-100 text-gray-400 hover:text-red-600",title:"Endgültig löschen",children:s.jsx(Ne,{className:"w-4 h-4"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[s.jsx("span",{className:"text-sm truncate text-gray-700",children:h(A)}),s.jsx("span",{className:"text-xs text-gray-500 flex-shrink-0",children:N(A.receivedAt)})]}),s.jsx("div",{className:"text-sm truncate text-gray-600",children:A.subject||"(Kein Betreff)"}),s.jsx("div",{className:"text-xs text-red-500 mt-1",children:E(A.deletedAt)}),A.contract&&s.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[s.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800",children:A.contract.contractNumber}),(A.folder==="INBOX"||A.folder==="SENT"&&!A.isAutoAssigned)&&s.jsx("button",{onClick:I=>p(I,A.id),className:"p-0.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded",title:"Zuordnung aufheben",disabled:f.isPending,children:s.jsx(qt,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(Ft,{className:"w-4 h-4 text-gray-400 flex-shrink-0 mt-2"})]},A.id)),l&&c&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:c==="restore"?"E-Mail wiederherstellen?":"E-Mail endgültig löschen?"}),s.jsx("p",{className:"text-gray-600 mb-4",children:c==="restore"?"Die E-Mail wird wieder in den ursprünglichen Ordner verschoben.":"Die E-Mail wird unwiderruflich gelöscht. Diese Aktion kann nicht rückgängig gemacht werden."}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:v,disabled:x.isPending||m.isPending,children:"Abbrechen"}),s.jsx(T,{variant:c==="restore"?"primary":"danger",onClick:y,disabled:x.isPending||m.isPending,children:x.isPending||m.isPending?"Wird ausgeführt...":c==="restore"?"Wiederherstellen":"Endgültig löschen"})]})]})})]})}function ik({customerId:e}){const[t,n]=j.useState(null),[r,a]=j.useState("INBOX"),[i,l]=j.useState(null),[o,c]=j.useState(!1),[d,u]=j.useState(!1),[h,x]=j.useState(null),m=ge(),{hasPermission:f}=He(),p=f("emails:delete"),{data:b,isLoading:g}=fe({queryKey:["mailbox-accounts",e],queryFn:()=>Ae.getMailboxAccounts(e)}),y=(b==null?void 0:b.data)||[];j.useEffect(()=>{y.length>0&&!t&&n(y[0].id)},[y,t]);const v=y.find(de=>de.id===t),{data:N,isLoading:E,refetch:A}=fe({queryKey:["emails","customer",e,t,r],queryFn:()=>Ae.getForCustomer(e,{accountId:t||void 0,folder:r}),enabled:!!t&&r!=="TRASH"}),I=(N==null?void 0:N.data)||[],{data:w,isLoading:S}=fe({queryKey:["emails","trash",e],queryFn:()=>Ae.getTrash(e),enabled:r==="TRASH"&&p}),P=(w==null?void 0:w.data)||[],{data:O}=fe({queryKey:["folder-counts",t],queryFn:()=>xs.getFolderCounts(t),enabled:!!t}),R=(O==null?void 0:O.data)||{inbox:0,inboxUnread:0,sent:0,sentUnread:0,trash:0,trashUnread:0},{data:q}=fe({queryKey:["email",i==null?void 0:i.id],queryFn:()=>Ae.getById(i.id),enabled:!!(i!=null&&i.id)}),D=(q==null?void 0:q.data)||i,z=G({mutationFn:de=>xs.syncEmails(de),onSuccess:()=>{m.invalidateQueries({queryKey:["emails"]}),m.invalidateQueries({queryKey:["folder-counts",t]}),m.invalidateQueries({queryKey:["mailbox-accounts",e]})}}),k=()=>{t&&z.mutate(t)},K=de=>{l(de)},B=()=>{x(D||null),c(!0)},_=()=>{x(null),c(!0)},Q=()=>{u(!0)};if(!g&&y.length===0)return s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(nn,{className:"w-16 h-16 mb-4 opacity-30"}),s.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Keine E-Mail-Konten vorhanden"}),s.jsx("p",{className:"text-sm text-center max-w-md",children:"Erstellen Sie eine Stressfrei-Wechseln E-Mail-Adresse mit aktivierter Mailbox, um E-Mails hier empfangen und versenden zu können."})]});const le=de=>{a(de),l(null)};return s.jsxs("div",{className:"flex flex-col h-full",style:{minHeight:"600px"},children:[s.jsxs("div",{className:"flex items-center justify-between gap-4 p-4 border-b border-gray-200 bg-gray-50",children:[y.length>1?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ur,{className:"w-5 h-5 text-gray-500"}),s.jsx("select",{value:t||"",onChange:de=>{n(Number(de.target.value)),l(null)},className:"px-3 py-2 border border-gray-300 rounded-lg bg-white focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm",children:y.map(de=>s.jsx("option",{value:de.id,children:de.email},de.id))})]}):s.jsxs("div",{className:"flex items-center gap-3 text-sm text-gray-600",children:[s.jsx(Ur,{className:"w-5 h-5 text-gray-500"}),s.jsx("span",{children:v==null?void 0:v.email})]}),s.jsxs("div",{className:"flex items-center gap-1 bg-gray-200 rounded-lg p-1",children:[s.jsxs("button",{onClick:()=>le("INBOX"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors ${r==="INBOX"?"bg-white text-blue-600 shadow-sm font-medium":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Ur,{className:"w-4 h-4"}),"Posteingang",R.inbox>0&&s.jsx("span",{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full cursor-help ${R.inboxUnread>0?"bg-blue-100 text-blue-600 font-medium":"bg-gray-100 text-gray-500"}`,title:`${R.inboxUnread} ungelesen / ${R.inbox} gesamt`,children:R.inboxUnread>0?`${R.inboxUnread}/${R.inbox}`:R.inbox})]}),s.jsxs("button",{onClick:()=>le("SENT"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors ${r==="SENT"?"bg-white text-blue-600 shadow-sm font-medium":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Tl,{className:"w-4 h-4"}),"Gesendet",R.sent>0&&s.jsx("span",{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full cursor-help ${R.sentUnread>0?"bg-blue-100 text-blue-600 font-medium":"bg-gray-100 text-gray-500"}`,title:`${R.sentUnread} ungelesen / ${R.sent} gesamt`,children:R.sentUnread>0?`${R.sentUnread}/${R.sent}`:R.sent})]}),p&&s.jsxs("button",{onClick:()=>le("TRASH"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors ${r==="TRASH"?"bg-white text-red-600 shadow-sm font-medium":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Ne,{className:"w-4 h-4"}),"Papierkorb",R.trash>0&&s.jsx("span",{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full cursor-help ${R.trashUnread>0?"bg-red-100 text-red-600 font-medium":"bg-gray-100 text-gray-500"}`,title:`${R.trashUnread} ungelesen / ${R.trash} gesamt`,children:R.trashUnread>0?`${R.trashUnread}/${R.trash}`:R.trash})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[r!=="TRASH"&&s.jsxs(T,{variant:"secondary",size:"sm",onClick:k,disabled:z.isPending||!t,children:[s.jsx(Sr,{className:`w-4 h-4 mr-1 ${z.isPending?"animate-spin":""}`}),z.isPending?"Sync...":"Synchronisieren"]}),s.jsxs(T,{size:"sm",onClick:_,disabled:!v,children:[s.jsx(Ue,{className:"w-4 h-4 mr-1"}),"Neue E-Mail"]})]})]}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsx("div",{className:"w-1/3 border-r border-gray-200 overflow-auto",children:r==="TRASH"?s.jsx(Lv,{emails:P,selectedEmailId:i==null?void 0:i.id,onSelectEmail:K,onEmailRestored:de=>{(i==null?void 0:i.id)===de&&l(null),m.invalidateQueries({queryKey:["emails"]}),m.invalidateQueries({queryKey:["folder-counts",t]})},onEmailDeleted:de=>{(i==null?void 0:i.id)===de&&l(null),m.invalidateQueries({queryKey:["emails","trash"]}),m.invalidateQueries({queryKey:["folder-counts",t]})},isLoading:S}):s.jsx(sk,{emails:I,selectedEmailId:i==null?void 0:i.id,onSelectEmail:K,onEmailDeleted:de=>{(i==null?void 0:i.id)===de&&l(null),m.invalidateQueries({queryKey:["folder-counts",t]})},isLoading:E,folder:r,accountId:t})}),s.jsx("div",{className:"flex-1 overflow-auto",children:D?s.jsx(Iv,{email:D,onReply:B,onAssignContract:Q,onDeleted:()=>{l(null),m.invalidateQueries({queryKey:["emails"]}),m.invalidateQueries({queryKey:["folder-counts",t]})},isSentFolder:r==="SENT",isTrashView:r==="TRASH",onRestored:()=>{l(null),m.invalidateQueries({queryKey:["emails"]}),m.invalidateQueries({queryKey:["folder-counts",t]})},accountId:t||void 0}):s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-500",children:[s.jsx(nn,{className:"w-12 h-12 mb-2 opacity-30"}),s.jsx("p",{children:"Wählen Sie eine E-Mail aus"})]})})]}),v&&s.jsx(Rv,{isOpen:o,onClose:()=>{c(!1),x(null)},account:v,replyTo:h||void 0,onSuccess:()=>{m.invalidateQueries({queryKey:["emails","customer",e,t,"SENT"]}),m.invalidateQueries({queryKey:["folder-counts",t]}),r==="SENT"&&A()}}),D&&s.jsx(ak,{isOpen:d,onClose:()=>u(!1),email:D,customerId:e,onSuccess:()=>{A()}})]})}function lk({contractId:e,customerId:t}){const[n,r]=j.useState(null),[a,i]=j.useState("INBOX"),[l,o]=j.useState(null),[c,d]=j.useState(!1),[u,h]=j.useState(null),[x,m]=j.useState(null),f=ge(),{hasPermission:p}=He(),b=p("emails:delete"),{data:g,isLoading:y}=fe({queryKey:["mailbox-accounts",t],queryFn:()=>Ae.getMailboxAccounts(t)}),v=(g==null?void 0:g.data)||[];j.useEffect(()=>{v.length>0&&!n&&r(v[0].id)},[v,n]);const N=v.find(J=>J.id===n),{data:E,isLoading:A,refetch:I}=fe({queryKey:["emails","contract",e,a],queryFn:()=>Ae.getForContract(e,{folder:a}),enabled:a!=="TRASH"}),w=(E==null?void 0:E.data)||[],{data:S,isLoading:P}=fe({queryKey:["emails","trash",t],queryFn:()=>Ae.getTrash(t),enabled:a==="TRASH"&&b}),O=(S==null?void 0:S.data)||[],{data:R}=fe({queryKey:["contract-folder-counts",e],queryFn:()=>Ae.getContractFolderCounts(e)}),q=(R==null?void 0:R.data)||{inbox:0,inboxUnread:0,sent:0,sentUnread:0},{data:D}=fe({queryKey:["folder-counts",n],queryFn:()=>xs.getFolderCounts(n),enabled:!!n&&b}),z=(D==null?void 0:D.data)||{trash:0,trashUnread:0},{data:k}=fe({queryKey:["email",l==null?void 0:l.id],queryFn:()=>Ae.getById(l.id),enabled:!!(l!=null&&l.id)}),K=(k==null?void 0:k.data)||l,B=G({mutationFn:J=>xs.syncEmails(J),onSuccess:()=>{f.invalidateQueries({queryKey:["emails"]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),n&&f.invalidateQueries({queryKey:["folder-counts",n]}),Re.success("Synchronisation abgeschlossen")},onError:J=>{Re.error(J.message||"Synchronisation fehlgeschlagen")}}),_=G({mutationFn:J=>Ae.toggleStar(J),onSuccess:(J,ue)=>{f.invalidateQueries({queryKey:["emails","contract",e]}),f.invalidateQueries({queryKey:["email",ue]})}}),Q=G({mutationFn:({emailId:J,isRead:ue})=>Ae.markAsRead(J,ue),onSuccess:(J,ue)=>{f.invalidateQueries({queryKey:["emails","contract",e]}),f.invalidateQueries({queryKey:["email",ue.emailId]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),n&&f.invalidateQueries({queryKey:["folder-counts",n]})}}),le=G({mutationFn:J=>Ae.unassignFromContract(J),onSuccess:()=>{f.invalidateQueries({queryKey:["emails","contract",e]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),o(null),Re.success("Zuordnung aufgehoben")},onError:J=>{Re.error(J.message||"Fehler beim Aufheben der Zuordnung")}}),de=G({mutationFn:J=>Ae.delete(J),onSuccess:(J,ue)=>{f.invalidateQueries({queryKey:["emails"]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),n&&f.invalidateQueries({queryKey:["folder-counts",n]}),Re.success("E-Mail in Papierkorb verschoben"),m(null),(l==null?void 0:l.id)===ue&&o(null)},onError:J=>{Re.error(J.message||"Fehler beim Löschen der E-Mail"),m(null)}}),_e=()=>{n&&B.mutate(n)},qe=J=>{const ue=new Date(J),ts=new Date;return ue.toDateString()===ts.toDateString()?ue.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"}):ue.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit"})},st=(J,ue)=>{J.stopPropagation(),_.mutate(ue)},C=(J,ue)=>{J.stopPropagation(),Q.mutate({emailId:ue.id,isRead:!ue.isRead})},nt=J=>{J.isRead||Q.mutate({emailId:J.id,isRead:!0}),o(J)},es=()=>{h(K||null),d(!0)},Vt=()=>{h(null),d(!0)},ae=(J,ue)=>{J.stopPropagation(),(l==null?void 0:l.id)===ue&&o(null),le.mutate(ue)},We=(J,ue)=>{J.stopPropagation(),m(ue)},xt=J=>{J.stopPropagation(),x&&de.mutate(x)},Z=J=>{J.stopPropagation(),m(null)},Fe=J=>{i(J),o(null)},Xe=J=>{if(a==="SENT")try{const ue=JSON.parse(J.toAddresses);if(ue.length>0)return`An: ${ue[0]}${ue.length>1?` (+${ue.length-1})`:""}`}catch{return"An: (Unbekannt)"}return J.fromName||J.fromAddress};return!y&&v.length===0?s.jsx(X,{title:"E-Mails",children:s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-gray-500",children:[s.jsx(nn,{className:"w-10 h-10 mb-2 opacity-30"}),s.jsx("p",{className:"text-sm",children:"Keine E-Mail-Konten vorhanden"}),s.jsx("p",{className:"text-xs mt-1",children:"Erstellen Sie eine E-Mail-Adresse beim Kunden mit aktivierter Mailbox"})]})}):s.jsxs(X,{title:s.jsx("div",{className:"flex items-center gap-4",children:s.jsx("span",{children:"E-Mails"})}),actions:s.jsxs("div",{className:"flex items-center gap-2",children:[a!=="TRASH"&&s.jsxs(T,{variant:"secondary",size:"sm",onClick:_e,disabled:B.isPending||!n,children:[s.jsx(Sr,{className:`w-4 h-4 mr-1 ${B.isPending?"animate-spin":""}`}),B.isPending?"Sync...":"Sync"]}),N&&s.jsxs(T,{size:"sm",onClick:Vt,children:[s.jsx(Ue,{className:"w-4 h-4 mr-1"}),"Neue E-Mail"]})]}),children:[s.jsxs("div",{className:"flex items-center justify-between gap-4 pb-4 border-b border-gray-200 -mt-2",children:[v.length>1?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ur,{className:"w-4 h-4 text-gray-500"}),s.jsx("select",{value:n||"",onChange:J=>{r(Number(J.target.value)),o(null)},className:"px-2 py-1.5 border border-gray-300 rounded-lg bg-white focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm",children:v.map(J=>s.jsx("option",{value:J.id,children:J.email},J.id))})]}):s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[s.jsx(Ur,{className:"w-4 h-4 text-gray-500"}),s.jsx("span",{children:N==null?void 0:N.email})]}),s.jsxs("div",{className:"flex items-center gap-1 bg-gray-200 rounded-lg p-1",children:[s.jsxs("button",{onClick:()=>Fe("INBOX"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors ${a==="INBOX"?"bg-white text-blue-600 shadow-sm font-medium":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Ur,{className:"w-4 h-4"}),"Posteingang",q.inbox>0&&s.jsx("span",{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full cursor-help ${q.inboxUnread>0?"bg-blue-100 text-blue-600 font-medium":"bg-gray-100 text-gray-500"}`,title:`${q.inboxUnread} ungelesen / ${q.inbox} gesamt`,children:q.inboxUnread>0?`${q.inboxUnread}/${q.inbox}`:q.inbox})]}),s.jsxs("button",{onClick:()=>Fe("SENT"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors ${a==="SENT"?"bg-white text-blue-600 shadow-sm font-medium":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Tl,{className:"w-4 h-4"}),"Gesendet",q.sent>0&&s.jsx("span",{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full cursor-help ${q.sentUnread>0?"bg-blue-100 text-blue-600 font-medium":"bg-gray-100 text-gray-500"}`,title:`${q.sentUnread} ungelesen / ${q.sent} gesamt`,children:q.sentUnread>0?`${q.sentUnread}/${q.sent}`:q.sent})]}),b&&s.jsxs("button",{onClick:()=>Fe("TRASH"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors ${a==="TRASH"?"bg-white text-red-600 shadow-sm font-medium":"text-gray-600 hover:text-gray-900"}`,children:[s.jsx(Ne,{className:"w-4 h-4"}),"Papierkorb",z.trash>0&&s.jsx("span",{className:`ml-1 px-1.5 py-0.5 text-xs rounded-full cursor-help ${z.trashUnread>0?"bg-red-100 text-red-600 font-medium":"bg-gray-100 text-gray-500"}`,title:`${z.trashUnread} ungelesen / ${z.trash} gesamt`,children:z.trashUnread>0?`${z.trashUnread}/${z.trash}`:z.trash})]})]})]}),(a==="TRASH"?P:A)?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"})}):(a==="TRASH"?O.length===0:w.length===0)?s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-gray-500",children:[s.jsx(nn,{className:"w-10 h-10 mb-2 opacity-30"}),s.jsx("p",{className:"text-sm",children:a==="INBOX"?"Keine E-Mails zugeordnet":a==="SENT"?"Keine E-Mails über diesen Vertrag gesendet":"Papierkorb ist leer"}),a==="INBOX"&&s.jsx("p",{className:"text-xs mt-1",children:"E-Mails können im E-Mail-Tab des Kunden zugeordnet werden"})]}):s.jsxs("div",{className:"flex -mx-6 -mb-6",style:{minHeight:"400px"},children:[s.jsx("div",{className:"w-1/3 border-r border-gray-200 overflow-auto",children:a==="TRASH"?s.jsx(Lv,{emails:O,selectedEmailId:l==null?void 0:l.id,onSelectEmail:nt,onEmailRestored:J=>{(l==null?void 0:l.id)===J&&o(null),f.invalidateQueries({queryKey:["emails"]}),f.invalidateQueries({queryKey:["folder-counts",n]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]})},onEmailDeleted:J=>{(l==null?void 0:l.id)===J&&o(null),f.invalidateQueries({queryKey:["emails","trash"]}),f.invalidateQueries({queryKey:["folder-counts",n]})},isLoading:P}):s.jsx("div",{className:"divide-y divide-gray-200",children:w.map(J=>s.jsxs("div",{onClick:()=>nt(J),className:["flex items-start gap-2 p-3 cursor-pointer transition-colors",(l==null?void 0:l.id)===J.id?"bg-blue-100":["hover:bg-gray-100",J.isRead?"bg-gray-50/50":"bg-white"].join(" ")].join(" "),style:{borderLeft:(l==null?void 0:l.id)===J.id?"4px solid #2563eb":"4px solid transparent"},children:[s.jsx("button",{onClick:ue=>C(ue,J),className:` - flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-gray-200 - ${J.isRead?"text-gray-400":"text-blue-600"} - `,title:J.isRead?"Als ungelesen markieren":"Als gelesen markieren",children:J.isRead?s.jsx(Pv,{className:"w-4 h-4"}):s.jsx(nn,{className:"w-4 h-4"})}),s.jsx("button",{onClick:ue=>st(ue,J.id),className:` - flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-gray-200 - ${J.isStarred?"text-yellow-500":"text-gray-400"} - `,title:J.isStarred?"Stern entfernen":"Als wichtig markieren",children:s.jsx(fh,{className:`w-4 h-4 ${J.isStarred?"fill-current":""}`})}),p("emails:delete")&&s.jsx("button",{onClick:ue=>We(ue,J.id),className:"flex-shrink-0 mt-1 p-1 -ml-1 rounded hover:bg-red-100 text-gray-400 hover:text-red-600",title:"E-Mail löschen",children:s.jsx(Ne,{className:"w-4 h-4"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[s.jsx("span",{className:`text-sm truncate ${J.isRead?"text-gray-700":"font-semibold text-gray-900"}`,children:Xe(J)}),s.jsx("span",{className:"text-xs text-gray-500 flex-shrink-0",children:qe(J.receivedAt)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`text-sm truncate ${J.isRead?"text-gray-600":"font-medium text-gray-900"}`,children:J.subject||"(Kein Betreff)"}),J.hasAttachments&&s.jsx(Fc,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})]}),J.contract&&s.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[s.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800",children:J.contract.contractNumber}),(a==="INBOX"||a==="SENT"&&!J.isAutoAssigned)&&s.jsx("button",{onClick:ue=>ae(ue,J.id),className:"p-0.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded",title:"Zuordnung aufheben",disabled:le.isPending,children:s.jsx(qt,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(Ft,{className:"w-4 h-4 text-gray-400 flex-shrink-0 mt-2"})]},J.id))})}),s.jsx("div",{className:"flex-1 overflow-auto",children:K&&l?s.jsx(Iv,{email:K,onReply:es,onAssignContract:()=>{},onDeleted:()=>{o(null),f.invalidateQueries({queryKey:["emails"]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),n&&f.invalidateQueries({queryKey:["folder-counts",n]})},isSentFolder:a==="SENT",isContractView:a!=="TRASH",isTrashView:a==="TRASH",onRestored:()=>{o(null),f.invalidateQueries({queryKey:["emails"]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),n&&f.invalidateQueries({queryKey:["folder-counts",n]})},accountId:K==null?void 0:K.stressfreiEmailId}):s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-500",children:[s.jsx(nn,{className:"w-12 h-12 mb-2 opacity-30"}),s.jsx("p",{children:"Wählen Sie eine E-Mail aus"})]})})]}),x&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"E-Mail löschen?"}),s.jsx("p",{className:"text-gray-600 mb-4",children:"Die E-Mail wird in den Papierkorb verschoben."}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:Z,disabled:de.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:xt,disabled:de.isPending,children:de.isPending?"Löschen...":"Löschen"})]})]})}),N&&s.jsx(Rv,{isOpen:c,onClose:()=>{d(!1),h(null)},account:N,replyTo:u||void 0,contractId:e,onSuccess:()=>{f.invalidateQueries({queryKey:["emails","contract",e,"SENT"]}),f.invalidateQueries({queryKey:["contract-folder-counts",e]}),a==="SENT"&&I()}})]})}function ok({tabs:e,defaultTab:t}){var a,i;const[n,r]=j.useState(t||((a=e[0])==null?void 0:a.id));return s.jsxs("div",{children:[s.jsx("div",{className:"border-b border-gray-200",children:s.jsx("nav",{className:"flex -mb-px space-x-8",children:e.map(l=>s.jsx("button",{onClick:()=>r(l.id),className:`py-4 px-1 border-b-2 font-medium text-sm whitespace-nowrap ${n===l.id?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:l.label},l.id))})}),s.jsx("div",{className:"mt-4",children:(i=e.find(l=>l.id===n))==null?void 0:i.content})]})}function Dt({onUpload:e,existingFile:t,accept:n=".pdf,.jpg,.jpeg,.png",label:r="Dokument hochladen",disabled:a=!1}){const i=j.useRef(null),[l,o]=j.useState(!1),[c,d]=j.useState(!1),u=async p=>{if(p){o(!0);try{await e(p)}catch(b){console.error("Upload failed:",b),alert("Upload fehlgeschlagen")}finally{o(!1)}}},h=p=>{var g;const b=(g=p.target.files)==null?void 0:g[0];b&&u(b)},x=p=>{var g;p.preventDefault(),d(!1);const b=(g=p.dataTransfer.files)==null?void 0:g[0];b&&u(b)},m=p=>{p.preventDefault(),d(!0)},f=()=>{d(!1)};return s.jsxs("div",{className:"space-y-2",children:[t?!a&&s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>{var p;return(p=i.current)==null?void 0:p.click()},disabled:l,children:l?"Wird hochgeladen...":"Ersetzen"}):s.jsx("div",{className:`border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors ${c?"border-blue-500 bg-blue-50":"border-gray-300 hover:border-gray-400"} ${a?"opacity-50 cursor-not-allowed":""}`,onClick:()=>{var p;return!a&&((p=i.current)==null?void 0:p.click())},onDrop:a?void 0:x,onDragOver:a?void 0:m,onDragLeave:a?void 0:f,children:l?s.jsxs("div",{className:"text-gray-500",children:[s.jsx("div",{className:"animate-spin w-6 h-6 border-2 border-blue-500 border-t-transparent rounded-full mx-auto mb-2"}),"Wird hochgeladen..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Vu,{className:"w-6 h-6 text-gray-400 mx-auto mb-2"}),s.jsx("p",{className:"text-sm text-gray-600",children:r}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"PDF, JPG oder PNG (max. 10MB)"})]})}),s.jsx("input",{ref:i,type:"file",accept:n,onChange:h,className:"hidden",disabled:a||l})]})}function oe({value:e,className:t="",size:n="sm",title:r="In Zwischenablage kopieren"}){const[a,i]=j.useState(!1),l=async c=>{c.preventDefault(),c.stopPropagation();try{await navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),1500)}catch(d){console.error("Failed to copy:",d)}},o=n==="sm"?"w-3.5 h-3.5":"w-4 h-4";return s.jsx("button",{type:"button",onClick:l,className:`inline-flex items-center justify-center p-1 rounded transition-colors ${a?"text-green-600 bg-green-50":"text-gray-400 hover:text-blue-600 hover:bg-blue-50"} ${t}`,title:a?"Kopiert!":r,children:a?s.jsx(xr,{className:o}):s.jsx(lh,{className:o})})}function Qu({values:e,separator:t=` -`,children:n,className:r=""}){const a=e.filter(i=>i!=null&&i!=="").map(String).join(t);return a?s.jsxs("div",{className:`relative group ${r}`,children:[n,s.jsx(oe,{value:a,className:"absolute top-0 right-0 opacity-60 group-hover:opacity-100",title:"Alles kopieren"})]}):s.jsx(s.Fragment,{children:n})}function ck(){var B,_;const{id:e}=bc(),t=Yt(),n=ge(),{hasPermission:r}=He(),[a]=wc(),i=parseInt(e),l=a.get("tab")||"addresses",[o,c]=j.useState(!1),[d,u]=j.useState(!1),[h,x]=j.useState(!1),[m,f]=j.useState(!1),[p,b]=j.useState(!1),[g,y]=j.useState(!1),[v,N]=j.useState(null),[E,A]=j.useState(null),[I,w]=j.useState(null),[S,P]=j.useState(null),[O,R]=j.useState(null),{data:q,isLoading:D}=fe({queryKey:["customer",e],queryFn:()=>Pt.getById(i)}),z=G({mutationFn:()=>Pt.delete(i),onSuccess:()=>{t("/customers")}});if(D)return s.jsx("div",{className:"text-center py-8",children:"Laden..."});if(!(q!=null&&q.data))return s.jsx("div",{className:"text-center py-8 text-red-600",children:"Kunde nicht gefunden"});const k=q.data,K=[{id:"addresses",label:"Adressen",content:s.jsx(mk,{customerId:i,addresses:k.addresses||[],canEdit:r("customers:update"),onAdd:()=>c(!0),onEdit:Q=>w(Q)})},{id:"bankcards",label:"Bankkarten",content:s.jsx(hk,{customerId:i,bankCards:k.bankCards||[],canEdit:r("customers:update"),showInactive:g,onToggleInactive:()=>y(!g),onAdd:()=>u(!0),onEdit:Q=>N(Q)})},{id:"documents",label:"Ausweise",content:s.jsx(fk,{customerId:i,documents:k.identityDocuments||[],canEdit:r("customers:update"),showInactive:g,onToggleInactive:()=>y(!g),onAdd:()=>x(!0),onEdit:Q=>A(Q)})},{id:"meters",label:"Zähler",content:s.jsx(pk,{customerId:i,meters:k.meters||[],canEdit:r("customers:update"),showInactive:g,onToggleInactive:()=>y(!g),onAdd:()=>f(!0),onEdit:Q=>P(Q)})},{id:"stressfrei",label:"Stressfrei-Wechseln",content:s.jsx(vk,{customerId:i,emails:k.stressfreiEmails||[],canEdit:r("customers:update"),showInactive:g,onToggleInactive:()=>y(!g),onAdd:()=>b(!0),onEdit:Q=>R(Q)})},{id:"emails",label:"E-Mail-Postfach",content:s.jsx(ik,{customerId:i})},{id:"contracts",label:"Verträge",content:s.jsx(xk,{customerId:i})},...r("customers:update")?[{id:"portal",label:"Portal",content:s.jsx(yk,{customerId:i,canEdit:r("customers:update")})}]:[]];return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold",children:k.type==="BUSINESS"&&k.companyName?k.companyName:`${k.firstName} ${k.lastName}`}),s.jsxs("p",{className:"text-gray-500 font-mono flex items-center gap-1",children:[k.customerNumber,s.jsx(oe,{value:k.customerNumber})]})]}),s.jsxs("div",{className:"flex gap-2",children:[r("customers:update")&&s.jsx(ke,{to:`/customers/${e}/edit`,children:s.jsxs(T,{variant:"secondary",children:[s.jsx(Je,{className:"w-4 h-4 mr-2"}),"Bearbeiten"]})}),r("customers:delete")&&s.jsxs(T,{variant:"danger",onClick:()=>{confirm("Kunde wirklich löschen?")&&z.mutate()},children:[s.jsx(Ne,{className:"w-4 h-4 mr-2"}),"Löschen"]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6",children:[s.jsx(X,{title:"Stammdaten",className:"lg:col-span-2",children:s.jsxs("dl",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Typ"}),s.jsx("dd",{children:s.jsx(ve,{variant:k.type==="BUSINESS"?"info":"default",children:k.type==="BUSINESS"?"Geschäftskunde":"Privatkunde"})})]}),k.salutation&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Anrede"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[k.salutation,s.jsx(oe,{value:k.salutation})]})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vorname"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[k.firstName,s.jsx(oe,{value:k.firstName})]})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Nachname"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[k.lastName,s.jsx(oe,{value:k.lastName})]})]}),k.companyName&&s.jsxs("div",{className:"col-span-2",children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Firma"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[k.companyName,s.jsx(oe,{value:k.companyName})]})]}),k.foundingDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Gründungsdatum"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[new Date(k.foundingDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),s.jsx(oe,{value:new Date(k.foundingDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]})]}),k.birthDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Geburtsdatum"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[new Date(k.birthDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),s.jsx(oe,{value:new Date(k.birthDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]})]}),k.birthPlace&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Geburtsort"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[k.birthPlace,s.jsx(oe,{value:k.birthPlace})]})]})]})}),s.jsx(X,{title:"Kontakt",children:s.jsxs("dl",{className:"space-y-3",children:[k.email&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"E-Mail"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[s.jsx("a",{href:`mailto:${k.email}`,className:"text-blue-600 hover:underline",children:k.email}),s.jsx(oe,{value:k.email})]})]}),k.phone&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Telefon"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[s.jsx("a",{href:`tel:${k.phone}`,className:"text-blue-600 hover:underline",children:k.phone}),s.jsx(oe,{value:k.phone})]})]}),k.mobile&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Mobil"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[s.jsx("a",{href:`tel:${k.mobile}`,className:"text-blue-600 hover:underline",children:k.mobile}),s.jsx(oe,{value:k.mobile})]})]})]})})]}),k.type==="BUSINESS"&&s.jsx(dk,{customer:k,canEdit:r("customers:update"),onUpdate:()=>n.invalidateQueries({queryKey:["customer",e]})}),s.jsx(uk,{customer:k,canEdit:r("customers:update"),onUpdate:()=>n.invalidateQueries({queryKey:["customer",e]})}),k.notes&&s.jsx(X,{title:"Notizen",className:"mb-6",children:s.jsx("p",{className:"whitespace-pre-wrap",children:k.notes})}),s.jsx(X,{children:s.jsx(ok,{tabs:K,defaultTab:l})}),s.jsx(xx,{isOpen:o,onClose:()=>c(!1),customerId:i}),s.jsx(xx,{isOpen:!!I,onClose:()=>w(null),customerId:i,address:I}),s.jsx(gx,{isOpen:d,onClose:()=>u(!1),customerId:i}),s.jsx(gx,{isOpen:!!v,onClose:()=>N(null),customerId:i,bankCard:v}),s.jsx(yx,{isOpen:h,onClose:()=>x(!1),customerId:i}),s.jsx(yx,{isOpen:!!E,onClose:()=>A(null),customerId:i,document:E}),s.jsx(vx,{isOpen:m,onClose:()=>f(!1),customerId:i}),s.jsx(vx,{isOpen:!!S,onClose:()=>P(null),customerId:i,meter:S}),s.jsx(bx,{isOpen:p,onClose:()=>b(!1),customerId:i,customerEmail:(B=q==null?void 0:q.data)==null?void 0:B.email}),s.jsx(bx,{isOpen:!!O,onClose:()=>R(null),customerId:i,email:O,customerEmail:(_=q==null?void 0:q.data)==null?void 0:_.email})]})}function dk({customer:e,canEdit:t,onUpdate:n}){const r=async c=>{try{await ut.uploadBusinessRegistration(e.id,c),n()}catch(d){console.error("Upload fehlgeschlagen:",d),alert("Upload fehlgeschlagen")}},a=async()=>{if(confirm("Gewerbeanmeldung wirklich löschen?"))try{await ut.deleteBusinessRegistration(e.id),n()}catch(c){console.error("Löschen fehlgeschlagen:",c),alert("Löschen fehlgeschlagen")}},i=async c=>{try{await ut.uploadCommercialRegister(e.id,c),n()}catch(d){console.error("Upload fehlgeschlagen:",d),alert("Upload fehlgeschlagen")}},l=async()=>{if(confirm("Handelsregisterauszug wirklich löschen?"))try{await ut.deleteCommercialRegister(e.id),n()}catch(c){console.error("Löschen fehlgeschlagen:",c),alert("Löschen fehlgeschlagen")}};return!(e.taxNumber||e.commercialRegisterNumber||e.businessRegistrationPath||e.commercialRegisterPath)&&!t?null:s.jsxs(X,{title:"Geschäftsdaten",className:"mb-6",children:[s.jsxs("dl",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.taxNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Steuernummer"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[e.taxNumber,s.jsx(oe,{value:e.taxNumber})]})]}),e.commercialRegisterNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Handelsregisternummer"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[e.commercialRegisterNumber,s.jsx(oe,{value:e.commercialRegisterNumber})]})]})]}),s.jsxs("div",{className:"mt-4 pt-4 border-t grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Gewerbeanmeldung"}),e.businessRegistrationPath?s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("a",{href:`/api${e.businessRegistrationPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Pe,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${e.businessRegistrationPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(As,{className:"w-4 h-4"}),"Download"]}),t&&s.jsxs(s.Fragment,{children:[s.jsx(Dt,{onUpload:r,existingFile:e.businessRegistrationPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:a,className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]})]}):t?s.jsx(Dt,{onUpload:r,accept:".pdf",label:"PDF hochladen"}):s.jsx("p",{className:"text-sm text-gray-400",children:"Nicht vorhanden"})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Handelsregisterauszug"}),e.commercialRegisterPath?s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("a",{href:`/api${e.commercialRegisterPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Pe,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${e.commercialRegisterPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(As,{className:"w-4 h-4"}),"Download"]}),t&&s.jsxs(s.Fragment,{children:[s.jsx(Dt,{onUpload:i,existingFile:e.commercialRegisterPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:l,className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]})]}):t?s.jsx(Dt,{onUpload:i,accept:".pdf",label:"PDF hochladen"}):s.jsx("p",{className:"text-sm text-gray-400",children:"Nicht vorhanden"})]})]})]})}function uk({customer:e,canEdit:t,onUpdate:n}){const r=async i=>{try{await ut.uploadPrivacyPolicy(e.id,i),n()}catch(l){console.error("Upload fehlgeschlagen:",l),alert("Upload fehlgeschlagen")}},a=async()=>{if(confirm("Datenschutzerklärung wirklich löschen?"))try{await ut.deletePrivacyPolicy(e.id),n()}catch(i){console.error("Löschen fehlgeschlagen:",i),alert("Löschen fehlgeschlagen")}};return!e.privacyPolicyPath&&!t?null:s.jsx(X,{title:"Dokumente",className:"mb-6",children:s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Datenschutzerklärung"}),e.privacyPolicyPath?s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("a",{href:`/api${e.privacyPolicyPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Pe,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${e.privacyPolicyPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(As,{className:"w-4 h-4"}),"Download"]}),t&&s.jsxs(s.Fragment,{children:[s.jsx(Dt,{onUpload:r,existingFile:e.privacyPolicyPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:a,className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]})]}):t?s.jsx(Dt,{onUpload:r,accept:".pdf",label:"PDF hochladen"}):s.jsx("p",{className:"text-sm text-gray-400",children:"Nicht vorhanden"})]})})}function mk({customerId:e,addresses:t,canEdit:n,onAdd:r,onEdit:a}){const i=ge(),l=G({mutationFn:qu.delete,onSuccess:()=>i.invalidateQueries({queryKey:["customer",e.toString()]})});return s.jsxs("div",{children:[n&&s.jsx("div",{className:"mb-4",children:s.jsxs(T,{size:"sm",onClick:r,children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Adresse hinzufügen"]})}),t.length>0?s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:t.map(o=>s.jsxs("div",{className:"border rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(z2,{className:"w-4 h-4 text-gray-400"}),s.jsx(ve,{variant:o.type==="BILLING"?"info":"default",children:o.type==="BILLING"?"Rechnung":"Liefer-/Meldeadresse"}),o.isDefault&&s.jsx(ve,{variant:"success",children:"Standard"})]}),n&&s.jsxs("div",{className:"flex gap-1",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>a(o),title:"Bearbeiten",children:s.jsx(Je,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Adresse wirklich löschen?")&&l.mutate(o.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]}),s.jsxs(Qu,{values:[`${o.street} ${o.houseNumber}`,`${o.postalCode} ${o.city}`,o.country],children:[s.jsxs("p",{children:[o.street," ",o.houseNumber]}),s.jsxs("p",{children:[o.postalCode," ",o.city]}),s.jsx("p",{className:"text-gray-500",children:o.country})]})]},o.id))}):s.jsx("p",{className:"text-gray-500",children:"Keine Adressen vorhanden."})]})}function hk({customerId:e,bankCards:t,canEdit:n,showInactive:r,onToggleInactive:a,onAdd:i,onEdit:l}){const o=ge(),c=G({mutationFn:({id:m,data:f})=>Yo.update(m,f),onSuccess:()=>o.invalidateQueries({queryKey:["customer",e.toString()]})}),d=G({mutationFn:Yo.delete,onSuccess:()=>o.invalidateQueries({queryKey:["customer",e.toString()]})}),u=async(m,f)=>{try{await ut.uploadBankCardDocument(m,f),o.invalidateQueries({queryKey:["customer",e.toString()]})}catch(p){console.error("Upload fehlgeschlagen:",p),alert("Upload fehlgeschlagen")}},h=async m=>{if(confirm("Dokument wirklich löschen?"))try{await ut.deleteBankCardDocument(m),o.invalidateQueries({queryKey:["customer",e.toString()]})}catch(f){console.error("Löschen fehlgeschlagen:",f),alert("Löschen fehlgeschlagen")}},x=r?t:t.filter(m=>m.isActive);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[n&&s.jsxs(T,{size:"sm",onClick:i,children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Bankkarte hinzufügen"]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:a,className:"rounded"}),"Inaktive anzeigen"]})]}),x.length>0?s.jsx("div",{className:"space-y-4",children:x.map(m=>s.jsxs("div",{className:`border rounded-lg p-4 ${m.isActive?"":"opacity-50 bg-gray-50"}`,children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(oh,{className:"w-4 h-4 text-gray-400"}),!m.isActive&&s.jsx(ve,{variant:"danger",children:"Inaktiv"}),m.expiryDate&&new Date(m.expiryDate)l(m),title:"Bearbeiten",children:s.jsx(Je,{className:"w-4 h-4"})}),m.isActive?s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Bankkarte deaktivieren?")&&c.mutate({id:m.id,data:{isActive:!1}})},title:"Deaktivieren",children:s.jsx(It,{className:"w-4 h-4"})}):s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Bankkarte wieder aktivieren?")&&c.mutate({id:m.id,data:{isActive:!0}})},title:"Aktivieren",children:s.jsx(Pe,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Bankkarte wirklich löschen?")&&d.mutate(m.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]}),s.jsxs("p",{className:"font-medium flex items-center gap-1",children:[m.accountHolder,s.jsx(oe,{value:m.accountHolder})]}),s.jsxs("p",{className:"font-mono flex items-center gap-1",children:[m.iban,s.jsx(oe,{value:m.iban})]}),m.bic&&s.jsxs("p",{className:"text-sm text-gray-500 flex items-center gap-1",children:["BIC: ",m.bic,s.jsx(oe,{value:m.bic})]}),m.bankName&&s.jsxs("p",{className:"text-sm text-gray-500 flex items-center gap-1",children:[m.bankName,s.jsx(oe,{value:m.bankName})]}),m.expiryDate&&s.jsxs("p",{className:"text-sm text-gray-500",children:["Gültig bis: ",new Date(m.expiryDate).toLocaleDateString("de-DE")]}),s.jsx("div",{className:"mt-3 pt-3 border-t",children:m.documentPath?s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("a",{href:`/api${m.documentPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Pe,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${m.documentPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(As,{className:"w-4 h-4"}),"Download"]}),n&&s.jsxs(s.Fragment,{children:[s.jsx(Dt,{onUpload:f=>u(m.id,f),existingFile:m.documentPath,accept:".pdf",label:"Ersetzen",disabled:!m.isActive}),s.jsxs("button",{onClick:()=>h(m.id),className:"text-red-600 hover:underline text-sm flex items-center gap-1",title:"Dokument löschen",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]})]}):n&&m.isActive&&s.jsx(Dt,{onUpload:f=>u(m.id,f),accept:".pdf",label:"PDF hochladen"})})]},m.id))}):s.jsx("p",{className:"text-gray-500",children:"Keine Bankkarten vorhanden."})]})}function fk({customerId:e,documents:t,canEdit:n,showInactive:r,onToggleInactive:a,onAdd:i,onEdit:l}){const o=ge(),c=G({mutationFn:({id:f,data:p})=>ec.update(f,p),onSuccess:()=>o.invalidateQueries({queryKey:["customer",e.toString()]})}),d=G({mutationFn:ec.delete,onSuccess:()=>o.invalidateQueries({queryKey:["customer",e.toString()]})}),u=async(f,p)=>{try{await ut.uploadIdentityDocument(f,p),o.invalidateQueries({queryKey:["customer",e.toString()]})}catch(b){console.error("Upload fehlgeschlagen:",b),alert("Upload fehlgeschlagen")}},h=async f=>{if(confirm("Dokument wirklich löschen?"))try{await ut.deleteIdentityDocument(f),o.invalidateQueries({queryKey:["customer",e.toString()]})}catch(p){console.error("Löschen fehlgeschlagen:",p),alert("Löschen fehlgeschlagen")}},x=r?t:t.filter(f=>f.isActive),m={ID_CARD:"Personalausweis",PASSPORT:"Reisepass",DRIVERS_LICENSE:"Führerschein",OTHER:"Sonstiges"};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[n&&s.jsxs(T,{size:"sm",onClick:i,children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Ausweis hinzufügen"]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:a,className:"rounded"}),"Inaktive anzeigen"]})]}),x.length>0?s.jsx("div",{className:"space-y-4",children:x.map(f=>s.jsxs("div",{className:`border rounded-lg p-4 ${f.isActive?"":"opacity-50 bg-gray-50"}`,children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(Ke,{className:"w-4 h-4 text-gray-400"}),s.jsx(ve,{children:m[f.type]}),!f.isActive&&s.jsx(ve,{variant:"danger",children:"Inaktiv"}),f.expiryDate&&new Date(f.expiryDate)l(f),title:"Bearbeiten",children:s.jsx(Je,{className:"w-4 h-4"})}),f.isActive?s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Ausweis deaktivieren?")&&c.mutate({id:f.id,data:{isActive:!1}})},title:"Deaktivieren",children:s.jsx(It,{className:"w-4 h-4"})}):s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Ausweis wieder aktivieren?")&&c.mutate({id:f.id,data:{isActive:!0}})},title:"Aktivieren",children:s.jsx(Pe,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Ausweis wirklich löschen?")&&d.mutate(f.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]}),s.jsxs("p",{className:"font-mono flex items-center gap-1",children:[f.documentNumber,s.jsx(oe,{value:f.documentNumber})]}),f.issuingAuthority&&s.jsxs("p",{className:"text-sm text-gray-500 flex items-center gap-1",children:["Ausgestellt von: ",f.issuingAuthority,s.jsx(oe,{value:f.issuingAuthority})]}),f.expiryDate&&s.jsxs("p",{className:"text-sm text-gray-500",children:["Gültig bis: ",new Date(f.expiryDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})]}),f.type==="DRIVERS_LICENSE"&&f.licenseClasses&&s.jsxs("p",{className:"text-sm text-gray-500 flex items-center gap-1",children:["Klassen: ",f.licenseClasses,s.jsx(oe,{value:f.licenseClasses})]}),f.type==="DRIVERS_LICENSE"&&f.licenseIssueDate&&s.jsxs("p",{className:"text-sm text-gray-500",children:["Klasse B seit: ",new Date(f.licenseIssueDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})]}),s.jsx("div",{className:"mt-3 pt-3 border-t",children:f.documentPath?s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("a",{href:`/api${f.documentPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Pe,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${f.documentPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(As,{className:"w-4 h-4"}),"Download"]}),n&&s.jsxs(s.Fragment,{children:[s.jsx(Dt,{onUpload:p=>u(f.id,p),existingFile:f.documentPath,accept:".pdf",label:"Ersetzen",disabled:!f.isActive}),s.jsxs("button",{onClick:()=>h(f.id),className:"text-red-600 hover:underline text-sm flex items-center gap-1",title:"Dokument löschen",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]})]}):n&&f.isActive&&s.jsx(Dt,{onUpload:p=>u(f.id,p),accept:".pdf",label:"PDF hochladen"})})]},f.id))}):s.jsx("p",{className:"text-gray-500",children:"Keine Ausweise vorhanden."})]})}function pk({customerId:e,meters:t,canEdit:n,showInactive:r,onToggleInactive:a,onAdd:i,onEdit:l}){const[o,c]=j.useState(null),[d,u]=j.useState(null),[h,x]=j.useState(null),m=ge(),f=G({mutationFn:({id:v,data:N})=>ln.update(v,N),onSuccess:()=>m.invalidateQueries({queryKey:["customer",e.toString()]})}),p=G({mutationFn:ln.delete,onSuccess:()=>m.invalidateQueries({queryKey:["customer",e.toString()]})}),b=G({mutationFn:({meterId:v,readingId:N})=>ln.deleteReading(v,N),onSuccess:()=>m.invalidateQueries({queryKey:["customer",e.toString()]})}),g=r?t:t.filter(v=>v.isActive),y=v=>v?[...v].sort((N,E)=>new Date(E.readingDate).getTime()-new Date(N.readingDate).getTime()):[];return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[n&&s.jsxs(T,{size:"sm",onClick:i,children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Zähler hinzufügen"]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:a,className:"rounded"}),"Inaktive anzeigen"]})]}),g.length>0?s.jsx("div",{className:"space-y-4",children:g.map(v=>{const N=y(v.readings),E=d===v.id;return s.jsxs("div",{className:`border rounded-lg p-4 ${v.isActive?"":"opacity-50 bg-gray-50"}`,children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(Ev,{className:"w-4 h-4 text-gray-400"}),s.jsx(ve,{variant:v.type==="ELECTRICITY"?"warning":"info",children:v.type==="ELECTRICITY"?"Strom":"Gas"}),!v.isActive&&s.jsx(ve,{variant:"danger",children:"Inaktiv"})]}),n&&s.jsxs("div",{className:"flex gap-1",children:[v.isActive&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>c({meterId:v.id,meterType:v.type}),title:"Zählerstand hinzufügen",children:s.jsx(Ue,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>l(v),title:"Bearbeiten",children:s.jsx(Je,{className:"w-4 h-4"})}),v.isActive?s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Zähler deaktivieren?")&&f.mutate({id:v.id,data:{isActive:!1}})},title:"Deaktivieren",children:s.jsx(It,{className:"w-4 h-4"})}):s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Zähler wieder aktivieren?")&&f.mutate({id:v.id,data:{isActive:!0}})},title:"Aktivieren",children:s.jsx(Pe,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Zähler wirklich löschen? Alle Zählerstände werden ebenfalls gelöscht.")&&p.mutate(v.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]}),s.jsxs("p",{className:"font-mono text-lg flex items-center gap-1",children:[v.meterNumber,s.jsx(oe,{value:v.meterNumber})]}),v.location&&s.jsxs("p",{className:"text-sm text-gray-500 flex items-center gap-1",children:["Standort: ",v.location,s.jsx(oe,{value:v.location})]}),N.length>0&&s.jsxs("div",{className:"mt-3 pt-3 border-t",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:"text-sm font-medium",children:"Zählerstände:"}),N.length>3&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>u(E?null:v.id),children:E?"Weniger anzeigen":`Alle ${N.length} anzeigen`})]}),s.jsx("div",{className:"space-y-1",children:(E?N:N.slice(0,3)).map(A=>s.jsxs("div",{className:"flex justify-between items-center text-sm group",children:[s.jsxs("span",{className:"text-gray-500 flex items-center gap-1",children:[new Date(A.readingDate).toLocaleDateString("de-DE"),s.jsx(oe,{value:new Date(A.readingDate).toLocaleDateString("de-DE")})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"font-mono flex items-center gap-1",children:[A.value.toLocaleString("de-DE")," ",A.unit,s.jsx(oe,{value:A.value.toString(),title:"Nur Wert kopieren"}),s.jsx(oe,{value:`${A.value.toLocaleString("de-DE")} ${A.unit}`,title:"Mit Einheit kopieren"})]}),n&&s.jsxs("div",{className:"opacity-0 group-hover:opacity-100 flex gap-1",children:[s.jsx("button",{onClick:()=>x({meterId:v.id,meterType:v.type,reading:A}),className:"text-gray-400 hover:text-blue-600",title:"Bearbeiten",children:s.jsx(Je,{className:"w-3 h-3"})}),s.jsx("button",{onClick:()=>{confirm("Zählerstand wirklich löschen?")&&b.mutate({meterId:v.id,readingId:A.id})},className:"text-gray-400 hover:text-red-600",title:"Löschen",children:s.jsx(Ne,{className:"w-3 h-3"})})]})]})]},A.id))})]})]},v.id)})}):s.jsx("p",{className:"text-gray-500",children:"Keine Zähler vorhanden."}),o&&s.jsx(jx,{isOpen:!0,onClose:()=>c(null),meterId:o.meterId,meterType:o.meterType,customerId:e}),h&&s.jsx(jx,{isOpen:!0,onClose:()=>x(null),meterId:h.meterId,meterType:h.meterType,customerId:e,reading:h.reading})]})}function xk({customerId:e}){const{hasPermission:t}=He(),n=Yt(),r=ge(),[a,i]=j.useState(new Set),[l,o]=j.useState(!1),{data:c,isLoading:d}=fe({queryKey:["contract-tree",e],queryFn:()=>Oe.getTreeForCustomer(e)}),u=(c==null?void 0:c.data)||[],h=G({mutationFn:Oe.delete,onSuccess:()=>{r.invalidateQueries({queryKey:["customer",e.toString()]}),r.invalidateQueries({queryKey:["customers"]}),r.invalidateQueries({queryKey:["contracts"]}),r.invalidateQueries({queryKey:["contract-tree",e]})},onError:y=>{alert((y==null?void 0:y.message)||"Fehler beim Löschen des Vertrags")}}),x={ELECTRICITY:"Strom",GAS:"Gas",DSL:"DSL",FIBER:"Glasfaser",MOBILE:"Mobilfunk",TV:"TV",CAR_INSURANCE:"KFZ-Versicherung"},m={ACTIVE:"success",PENDING:"warning",CANCELLED:"danger",EXPIRED:"danger",DRAFT:"default",DEACTIVATED:"default"},f=[{status:"DRAFT",label:"Entwurf",description:"Vertrag wird noch vorbereitet",color:"text-gray-600"},{status:"PENDING",label:"Ausstehend",description:"Wartet auf Aktivierung",color:"text-yellow-600"},{status:"ACTIVE",label:"Aktiv",description:"Vertrag läuft normal",color:"text-green-600"},{status:"EXPIRED",label:"Abgelaufen",description:"Laufzeit vorbei, läuft aber ohne Kündigung weiter",color:"text-orange-600"},{status:"CANCELLED",label:"Gekündigt",description:"Aktive Kündigung eingereicht, Vertrag endet",color:"text-red-600"},{status:"DEACTIVATED",label:"Deaktiviert",description:"Manuell beendet/archiviert",color:"text-gray-500"}],p=y=>{i(v=>{const N=new Set(v);return N.has(y)?N.delete(y):N.add(y),N})},b=(y,v)=>y.map(N=>s.jsx("div",{children:g(N,v)},N.contract.id)),g=(y,v=0)=>{var S,P,O,R,q,D,z;const{contract:N,predecessors:E,hasHistory:A}=y,I=a.has(N.id),w=v>0;return s.jsxs("div",{children:[s.jsxs("div",{className:` - border rounded-lg p-4 transition-colors - ${w?"ml-6 border-l-4 border-l-gray-300 bg-gray-50":"hover:bg-gray-50"} - `,children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[!w&&A?s.jsx("button",{onClick:()=>p(N.id),className:"p-1 hover:bg-gray-200 rounded transition-colors",title:I?"Einklappen":"Vorgänger anzeigen",children:I?s.jsx(Rn,{className:"w-4 h-4 text-gray-500"}):s.jsx(Ft,{className:"w-4 h-4 text-gray-500"})}):w?null:s.jsx("div",{className:"w-6"}),s.jsxs("span",{className:"font-mono flex items-center gap-1",children:[N.contractNumber,s.jsx(oe,{value:N.contractNumber})]}),s.jsx(ve,{children:x[N.type]||N.type}),s.jsx(ve,{variant:m[N.status]||"default",children:N.status}),v===0&&!w&&s.jsx("button",{onClick:k=>{k.stopPropagation(),o(!0)},className:"text-gray-400 hover:text-blue-600 transition-colors",title:"Status-Erklärung",children:s.jsx(Al,{className:"w-4 h-4"})}),w&&s.jsx("span",{className:"text-xs text-gray-500 ml-2",children:"(Vorgänger)"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>n(`/contracts/${N.id}`,{state:{from:"customer",customerId:e.toString()}}),title:"Ansehen",children:s.jsx(Pe,{className:"w-4 h-4"})}),t("contracts:update")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>n(`/contracts/${N.id}/edit`),title:"Bearbeiten",children:s.jsx(Je,{className:"w-4 h-4"})}),t("contracts:delete")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Vertrag wirklich löschen?")&&h.mutate(N.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]}),(N.providerName||((S=N.provider)==null?void 0:S.name))&&s.jsxs("p",{className:`flex items-center gap-1 ${w?"ml-6":""}`,children:[N.providerName||((P=N.provider)==null?void 0:P.name),(N.tariffName||((O=N.tariff)==null?void 0:O.name))&&` - ${N.tariffName||((R=N.tariff)==null?void 0:R.name)}`,s.jsx(oe,{value:(N.providerName||((q=N.provider)==null?void 0:q.name)||"")+(N.tariffName||(D=N.tariff)!=null&&D.name?` - ${N.tariffName||((z=N.tariff)==null?void 0:z.name)}`:"")})]}),N.startDate&&s.jsxs("p",{className:`text-sm text-gray-500 ${w?"ml-6":""}`,children:["Beginn: ",new Date(N.startDate).toLocaleDateString("de-DE"),N.endDate&&` | Ende: ${new Date(N.endDate).toLocaleDateString("de-DE")}`]})]}),(v===0&&I||v>0)&&E.length>0&&s.jsx("div",{className:"mt-2",children:b(E,v+1)})]},N.id)};return d?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"})}):s.jsxs("div",{children:[t("contracts:create")&&s.jsx("div",{className:"mb-4",children:s.jsx(ke,{to:`/contracts/new?customerId=${e}`,children:s.jsxs(T,{size:"sm",children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Vertrag anlegen"]})})}),u.length>0?s.jsx("div",{className:"space-y-4",children:u.map(y=>g(y,0))}):s.jsx("p",{className:"text-gray-500",children:"Keine Verträge vorhanden."}),l&&s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[s.jsx("div",{className:"fixed inset-0 bg-black/20",onClick:()=>o(!1)}),s.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl p-4 max-w-sm w-full mx-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Vertragsstatus-Übersicht"}),s.jsx("button",{onClick:()=>o(!1),className:"text-gray-400 hover:text-gray-600",children:s.jsx(qt,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"space-y-2",children:f.map(({status:y,label:v,description:N,color:E})=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:`font-medium text-sm min-w-[90px] ${E}`,children:v}),s.jsx("span",{className:"text-sm text-gray-600",children:N})]},y))})]})]})]})}function gk({customerId:e}){const[t,n]=j.useState(!1),[r,a]=j.useState(null),[i,l]=j.useState(!1),o=async()=>{var c;if(t){n(!1);return}l(!0);try{const d=await Pt.getPortalPassword(e);a(((c=d.data)==null?void 0:c.password)||null),n(!0)}catch(d){console.error("Fehler beim Laden des Passworts:",d),alert("Fehler beim Laden des Passworts")}finally{l(!1)}};return s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsx("p",{className:"text-xs text-green-600",children:"Passwort ist gesetzt"}),s.jsx("button",{type:"button",onClick:o,className:"text-xs text-blue-600 hover:underline flex items-center gap-1",disabled:i,children:i?"Laden...":t?s.jsxs(s.Fragment,{children:[s.jsx(It,{className:"w-3 h-3"}),"Verbergen"]}):s.jsxs(s.Fragment,{children:[s.jsx(Pe,{className:"w-3 h-3"}),"Anzeigen"]})}),t&&r&&s.jsxs("span",{className:"text-xs font-mono bg-gray-100 px-2 py-1 rounded flex items-center gap-1",children:[r,s.jsx(oe,{value:r})]}),t&&!r&&s.jsx("span",{className:"text-xs text-gray-500",children:"(Passwort nicht verfügbar)"})]})}function yk({customerId:e,canEdit:t}){const n=ge(),[r,a]=j.useState(!1),[i,l]=j.useState(""),[o,c]=j.useState(""),[d,u]=j.useState([]),[h,x]=j.useState(!1),{data:m,isLoading:f}=fe({queryKey:["customer-portal",e],queryFn:()=>Pt.getPortalSettings(e)}),{data:p,isLoading:b}=fe({queryKey:["customer-representatives",e],queryFn:()=>Pt.getRepresentatives(e)}),g=G({mutationFn:w=>Pt.updatePortalSettings(e,w),onSuccess:()=>{n.invalidateQueries({queryKey:["customer-portal",e]})}}),y=G({mutationFn:w=>Pt.setPortalPassword(e,w),onSuccess:()=>{l(""),n.invalidateQueries({queryKey:["customer-portal",e]}),alert("Passwort wurde gesetzt")},onError:w=>{alert(w.message)}}),v=G({mutationFn:w=>Pt.addRepresentative(e,w),onSuccess:()=>{n.invalidateQueries({queryKey:["customer-representatives",e]}),c(""),u([])},onError:w=>{alert(w.message)}}),N=G({mutationFn:w=>Pt.removeRepresentative(e,w),onSuccess:()=>{n.invalidateQueries({queryKey:["customer-representatives",e]})}}),E=async()=>{if(!(o.length<2)){x(!0);try{const w=await Pt.searchForRepresentative(e,o);u(w.data||[])}catch(w){console.error("Suche fehlgeschlagen:",w)}finally{x(!1)}}};if(f||b)return s.jsx("div",{className:"text-center py-4 text-gray-500",children:"Laden..."});const A=m==null?void 0:m.data,I=(p==null?void 0:p.data)||[];return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"border rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsx(dh,{className:"w-5 h-5 text-gray-400"}),s.jsx("h3",{className:"font-medium",children:"Portal-Zugang"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("label",{className:"flex items-center gap-3",children:[s.jsx("input",{type:"checkbox",checked:(A==null?void 0:A.portalEnabled)||!1,onChange:w=>g.mutate({portalEnabled:w.target.checked}),className:"rounded w-5 h-5",disabled:!t}),s.jsx("span",{children:"Portal aktiviert"}),(A==null?void 0:A.portalEnabled)&&s.jsx(ve,{variant:"success",children:"Aktiv"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Portal E-Mail"}),s.jsx("div",{className:"flex gap-2",children:s.jsx(H,{value:(A==null?void 0:A.portalEmail)||"",onChange:w=>g.mutate({portalEmail:w.target.value||null}),placeholder:"portal@example.com",disabled:!t||!(A!=null&&A.portalEnabled),className:"flex-1"})}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Diese E-Mail wird für den Login ins Kundenportal verwendet."})]}),(A==null?void 0:A.portalEnabled)&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:A!=null&&A.hasPassword?"Neues Passwort setzen":"Passwort setzen"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(H,{type:r?"text":"password",value:i,onChange:w=>l(w.target.value),placeholder:"Mindestens 6 Zeichen",disabled:!t}),s.jsx("button",{type:"button",onClick:()=>a(!r),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400",children:r?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Pe,{className:"w-4 h-4"})})]}),s.jsx(T,{onClick:()=>y.mutate(i),disabled:!t||i.length<6||y.isPending,children:y.isPending?"Speichern...":"Setzen"})]}),(A==null?void 0:A.hasPassword)&&s.jsx(gk,{customerId:e})]}),(A==null?void 0:A.portalLastLogin)&&s.jsxs("p",{className:"text-sm text-gray-500",children:["Letzte Anmeldung: ",new Date(A.portalLastLogin).toLocaleString("de-DE")]})]})]}),s.jsxs("div",{className:"border rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsx(Q2,{className:"w-5 h-5 text-gray-400"}),s.jsx("h3",{className:"font-medium",children:"Vertreter (können Verträge einsehen)"})]}),s.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Hier können Sie anderen Kunden erlauben, die Verträge dieses Kunden einzusehen. Beispiel: Der Sohn kann die Verträge seiner Mutter einsehen."}),t&&s.jsxs("div",{className:"mb-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(H,{value:o,onChange:w=>c(w.target.value),placeholder:"Kunden suchen (Name, Kundennummer)...",onKeyDown:w=>w.key==="Enter"&&E(),className:"flex-1"}),s.jsx(T,{variant:"secondary",onClick:E,disabled:o.length<2||h,children:s.jsx(Ml,{className:"w-4 h-4"})})]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Nur Kunden mit aktiviertem Portal können als Vertreter hinzugefügt werden."}),d.length>0&&s.jsx("div",{className:"mt-2 border rounded-lg divide-y",children:d.map(w=>s.jsxs("div",{className:"flex items-center justify-between p-3 hover:bg-gray-50",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:w.companyName||`${w.firstName} ${w.lastName}`}),s.jsx("p",{className:"text-sm text-gray-500",children:w.customerNumber})]}),s.jsxs(T,{size:"sm",onClick:()=>v.mutate(w.id),disabled:v.isPending,children:[s.jsx(Ue,{className:"w-4 h-4 mr-1"}),"Hinzufügen"]})]},w.id))})]}),I.length>0?s.jsx("div",{className:"space-y-2",children:I.map(w=>{var S,P,O,R;return s.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:((S=w.representative)==null?void 0:S.companyName)||`${(P=w.representative)==null?void 0:P.firstName} ${(O=w.representative)==null?void 0:O.lastName}`}),s.jsx("p",{className:"text-sm text-gray-500",children:(R=w.representative)==null?void 0:R.customerNumber})]}),t&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Vertreter wirklich entfernen?")&&N.mutate(w.representativeId)},children:s.jsx(qt,{className:"w-4 h-4 text-red-500"})})]},w.id)})}):s.jsx("p",{className:"text-gray-500 text-sm",children:"Keine Vertreter konfiguriert."})]})]})}function xx({isOpen:e,onClose:t,customerId:n,address:r}){const a=ge(),i=!!r,l=()=>({type:(r==null?void 0:r.type)||"DELIVERY_RESIDENCE",street:(r==null?void 0:r.street)||"",houseNumber:(r==null?void 0:r.houseNumber)||"",postalCode:(r==null?void 0:r.postalCode)||"",city:(r==null?void 0:r.city)||"",country:(r==null?void 0:r.country)||"Deutschland",isDefault:(r==null?void 0:r.isDefault)||!1}),[o,c]=j.useState(l),d=G({mutationFn:m=>qu.create(n,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t(),c({type:"DELIVERY_RESIDENCE",street:"",houseNumber:"",postalCode:"",city:"",country:"Deutschland",isDefault:!1})}}),u=G({mutationFn:m=>qu.update(r.id,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t()}}),h=m=>{m.preventDefault(),i?u.mutate(o):d.mutate(o)},x=d.isPending||u.isPending;return i&&o.street!==r.street&&c(l()),s.jsx(Ve,{isOpen:e,onClose:t,title:i?"Adresse bearbeiten":"Adresse hinzufügen",children:s.jsxs("form",{onSubmit:h,className:"space-y-4",children:[s.jsx(Ie,{label:"Adresstyp",value:o.type,onChange:m=>c({...o,type:m.target.value}),options:[{value:"DELIVERY_RESIDENCE",label:"Liefer-/Meldeadresse"},{value:"BILLING",label:"Rechnungsadresse"}]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx("div",{className:"col-span-2",children:s.jsx(H,{label:"Straße",value:o.street,onChange:m=>c({...o,street:m.target.value}),required:!0})}),s.jsx(H,{label:"Hausnr.",value:o.houseNumber,onChange:m=>c({...o,houseNumber:m.target.value}),required:!0})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx(H,{label:"PLZ",value:o.postalCode,onChange:m=>c({...o,postalCode:m.target.value}),required:!0}),s.jsx("div",{className:"col-span-2",children:s.jsx(H,{label:"Ort",value:o.city,onChange:m=>c({...o,city:m.target.value}),required:!0})})]}),s.jsx(H,{label:"Land",value:o.country,onChange:m=>c({...o,country:m.target.value})}),s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:o.isDefault,onChange:m=>c({...o,isDefault:m.target.checked}),className:"rounded"}),"Als Standard setzen"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:x,children:x?"Speichern...":"Speichern"})]})]})})}function gx({isOpen:e,onClose:t,customerId:n,bankCard:r}){const a=ge(),i=!!r,l=()=>({accountHolder:(r==null?void 0:r.accountHolder)||"",iban:(r==null?void 0:r.iban)||"",bic:(r==null?void 0:r.bic)||"",bankName:(r==null?void 0:r.bankName)||"",expiryDate:r!=null&&r.expiryDate?new Date(r.expiryDate).toISOString().split("T")[0]:"",isActive:(r==null?void 0:r.isActive)??!0}),[o,c]=j.useState(l);j.useState(()=>{c(l())});const d=G({mutationFn:m=>Yo.create(n,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t(),c({accountHolder:"",iban:"",bic:"",bankName:"",expiryDate:"",isActive:!0})}}),u=G({mutationFn:m=>Yo.update(r.id,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t()}}),h=m=>{m.preventDefault();const f={...o,expiryDate:o.expiryDate?new Date(o.expiryDate):void 0};i?u.mutate(f):d.mutate(f)},x=d.isPending||u.isPending;return i&&o.iban!==r.iban&&c(l()),s.jsx(Ve,{isOpen:e,onClose:t,title:i?"Bankkarte bearbeiten":"Bankkarte hinzufügen",children:s.jsxs("form",{onSubmit:h,className:"space-y-4",children:[s.jsx(H,{label:"Kontoinhaber",value:o.accountHolder,onChange:m=>c({...o,accountHolder:m.target.value}),required:!0}),s.jsx(H,{label:"IBAN",value:o.iban,onChange:m=>c({...o,iban:m.target.value}),required:!0}),s.jsx(H,{label:"BIC",value:o.bic,onChange:m=>c({...o,bic:m.target.value})}),s.jsx(H,{label:"Bank",value:o.bankName,onChange:m=>c({...o,bankName:m.target.value})}),s.jsx(H,{label:"Ablaufdatum",type:"date",value:o.expiryDate,onChange:m=>c({...o,expiryDate:m.target.value}),onClear:()=>c({...o,expiryDate:""})}),i&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:o.isActive,onChange:m=>c({...o,isActive:m.target.checked}),className:"rounded"}),"Aktiv"]}),!i&&s.jsx("p",{className:"text-sm text-gray-500 bg-gray-50 p-3 rounded",children:"Dokument-Upload ist nach dem Speichern in der Übersicht möglich."}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:x,children:x?"Speichern...":"Speichern"})]})]})})}function yx({isOpen:e,onClose:t,customerId:n,document:r}){const a=ge(),i=!!r,l=()=>({type:(r==null?void 0:r.type)||"ID_CARD",documentNumber:(r==null?void 0:r.documentNumber)||"",issuingAuthority:(r==null?void 0:r.issuingAuthority)||"",issueDate:r!=null&&r.issueDate?new Date(r.issueDate).toISOString().split("T")[0]:"",expiryDate:r!=null&&r.expiryDate?new Date(r.expiryDate).toISOString().split("T")[0]:"",isActive:(r==null?void 0:r.isActive)??!0,licenseClasses:(r==null?void 0:r.licenseClasses)||"",licenseIssueDate:r!=null&&r.licenseIssueDate?new Date(r.licenseIssueDate).toISOString().split("T")[0]:""}),[o,c]=j.useState(l),d=G({mutationFn:m=>ec.create(n,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t(),c({type:"ID_CARD",documentNumber:"",issuingAuthority:"",issueDate:"",expiryDate:"",isActive:!0,licenseClasses:"",licenseIssueDate:""})}}),u=G({mutationFn:m=>ec.update(r.id,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t()}}),h=m=>{m.preventDefault();const f={...o,issueDate:o.issueDate?new Date(o.issueDate):void 0,expiryDate:o.expiryDate?new Date(o.expiryDate):void 0};o.type==="DRIVERS_LICENSE"?(f.licenseClasses=o.licenseClasses||void 0,f.licenseIssueDate=o.licenseIssueDate?new Date(o.licenseIssueDate):void 0):(delete f.licenseClasses,delete f.licenseIssueDate),i?u.mutate(f):d.mutate(f)},x=d.isPending||u.isPending;return i&&o.documentNumber!==r.documentNumber&&c(l()),s.jsx(Ve,{isOpen:e,onClose:t,title:i?"Ausweis bearbeiten":"Ausweis hinzufügen",children:s.jsxs("form",{onSubmit:h,className:"space-y-4",children:[s.jsx(Ie,{label:"Ausweistyp",value:o.type,onChange:m=>c({...o,type:m.target.value}),options:[{value:"ID_CARD",label:"Personalausweis"},{value:"PASSPORT",label:"Reisepass"},{value:"DRIVERS_LICENSE",label:"Führerschein"},{value:"OTHER",label:"Sonstiges"}]}),s.jsx(H,{label:"Ausweisnummer",value:o.documentNumber,onChange:m=>c({...o,documentNumber:m.target.value}),required:!0}),s.jsx(H,{label:"Ausstellende Behörde",value:o.issuingAuthority,onChange:m=>c({...o,issuingAuthority:m.target.value})}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(H,{label:"Ausstellungsdatum",type:"date",value:o.issueDate,onChange:m=>c({...o,issueDate:m.target.value}),onClear:()=>c({...o,issueDate:""})}),s.jsx(H,{label:"Ablaufdatum",type:"date",value:o.expiryDate,onChange:m=>c({...o,expiryDate:m.target.value}),onClear:()=>c({...o,expiryDate:""})})]}),o.type==="DRIVERS_LICENSE"&&s.jsxs(s.Fragment,{children:[s.jsx(H,{label:"Führerscheinklassen",value:o.licenseClasses,onChange:m=>c({...o,licenseClasses:m.target.value}),placeholder:"z.B. B, BE, AM, L"}),s.jsx(H,{label:"Erwerb Klasse B (Pkw)",type:"date",value:o.licenseIssueDate,onChange:m=>c({...o,licenseIssueDate:m.target.value}),onClear:()=>c({...o,licenseIssueDate:""})})]}),i&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:o.isActive,onChange:m=>c({...o,isActive:m.target.checked}),className:"rounded"}),"Aktiv"]}),!i&&s.jsx("p",{className:"text-sm text-gray-500 bg-gray-50 p-3 rounded",children:"Dokument-Upload ist nach dem Speichern in der Übersicht möglich."}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:x,children:x?"Speichern...":"Speichern"})]})]})})}function vx({isOpen:e,onClose:t,customerId:n,meter:r}){const a=ge(),i=!!r,l=()=>({meterNumber:(r==null?void 0:r.meterNumber)||"",type:(r==null?void 0:r.type)||"ELECTRICITY",location:(r==null?void 0:r.location)||"",isActive:(r==null?void 0:r.isActive)??!0}),[o,c]=j.useState(l),d=G({mutationFn:m=>ln.create(n,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t(),c({meterNumber:"",type:"ELECTRICITY",location:"",isActive:!0})}}),u=G({mutationFn:m=>ln.update(r.id,m),onSuccess:()=>{a.invalidateQueries({queryKey:["customer",n.toString()]}),t()}}),h=m=>{m.preventDefault(),i?u.mutate(o):d.mutate(o)},x=d.isPending||u.isPending;return i&&o.meterNumber!==r.meterNumber&&c(l()),s.jsx(Ve,{isOpen:e,onClose:t,title:i?"Zähler bearbeiten":"Zähler hinzufügen",children:s.jsxs("form",{onSubmit:h,className:"space-y-4",children:[s.jsx(H,{label:"Zählernummer",value:o.meterNumber,onChange:m=>c({...o,meterNumber:m.target.value}),required:!0}),s.jsx(Ie,{label:"Zählertyp",value:o.type,onChange:m=>c({...o,type:m.target.value}),options:[{value:"ELECTRICITY",label:"Strom"},{value:"GAS",label:"Gas"}]}),s.jsx(H,{label:"Standort",value:o.location,onChange:m=>c({...o,location:m.target.value}),placeholder:"z.B. Keller, Wohnung"}),i&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:o.isActive,onChange:m=>c({...o,isActive:m.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:x,children:x?"Speichern...":"Speichern"})]})]})})}function jx({isOpen:e,onClose:t,meterId:n,meterType:r,customerId:a,reading:i}){const l=ge(),o=!!i,c=r==="ELECTRICITY"?"kWh":"m³",d=()=>{var b;return{readingDate:i!=null&&i.readingDate?new Date(i.readingDate).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],value:((b=i==null?void 0:i.value)==null?void 0:b.toString())||"",notes:(i==null?void 0:i.notes)||""}},[u,h]=j.useState(d),x=G({mutationFn:b=>ln.addReading(n,b),onSuccess:()=>{l.invalidateQueries({queryKey:["customer",a.toString()]}),t()}}),m=G({mutationFn:b=>ln.updateReading(n,i.id,b),onSuccess:()=>{l.invalidateQueries({queryKey:["customer",a.toString()]}),t()}}),f=b=>{b.preventDefault();const g={readingDate:new Date(u.readingDate),value:parseFloat(u.value),unit:c,notes:u.notes||void 0};o?m.mutate(g):x.mutate(g)},p=x.isPending||m.isPending;return o&&u.value!==i.value.toString()&&h(d()),s.jsx(Ve,{isOpen:e,onClose:t,title:o?"Zählerstand bearbeiten":"Zählerstand erfassen",children:s.jsxs("form",{onSubmit:f,className:"space-y-4",children:[s.jsx(H,{label:"Ablesedatum",type:"date",value:u.readingDate,onChange:b=>h({...u,readingDate:b.target.value}),required:!0}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx("div",{className:"col-span-2",children:s.jsx(H,{label:"Zählerstand",type:"number",step:"0.01",value:u.value,onChange:b=>h({...u,value:b.target.value}),required:!0})}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Einheit"}),s.jsx("div",{className:"h-10 flex items-center px-3 bg-gray-100 border border-gray-300 rounded-md text-gray-700",children:c})]})]}),s.jsx(H,{label:"Notizen",value:u.notes,onChange:b=>h({...u,notes:b.target.value}),placeholder:"Optionale Notizen..."}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:p,children:p?"Speichern...":"Speichern"})]})]})})}const pd="@stressfrei-wechseln.de";function vk({customerId:e,emails:t,canEdit:n,showInactive:r,onToggleInactive:a,onAdd:i,onEdit:l}){const o=ge(),c=G({mutationFn:({id:h,data:x})=>xs.update(h,x),onSuccess:()=>o.invalidateQueries({queryKey:["customer",e.toString()]})}),d=G({mutationFn:xs.delete,onSuccess:()=>o.invalidateQueries({queryKey:["customer",e.toString()]})}),u=r?t:t.filter(h=>h.isActive);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[n&&s.jsxs(T,{size:"sm",onClick:i,children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Adresse hinzufügen"]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:a,className:"rounded"}),"Inaktive anzeigen"]})]}),s.jsxs("p",{className:"text-sm text-gray-500 mb-4 bg-blue-50 border border-blue-200 rounded-lg p-3",children:[s.jsx("strong",{children:"Hinweis:"})," Hier werden E-Mail-Weiterleitungsadressen verwaltet, die für die Registrierung bei Anbietern verwendet werden. E-Mails an diese Adressen werden sowohl an den Kunden als auch an Sie weitergeleitet."]}),u.length>0?s.jsx("div",{className:"space-y-3",children:u.map(h=>s.jsx("div",{className:`border rounded-lg p-4 ${h.isActive?"":"opacity-50 bg-gray-50"}`,children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(nn,{className:"w-4 h-4 text-gray-400"}),s.jsx("span",{className:"font-mono text-sm",children:h.email}),s.jsx(oe,{value:h.email}),!h.isActive&&s.jsx(ve,{variant:"danger",children:"Inaktiv"})]}),h.notes&&s.jsxs("div",{className:"flex items-center gap-2 mt-1 text-sm text-gray-500",children:[s.jsx(Ke,{className:"w-4 h-4 flex-shrink-0"}),s.jsx("span",{children:h.notes})]})]}),n&&s.jsxs("div",{className:"flex gap-1",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>l(h),title:"Bearbeiten",children:s.jsx(Je,{className:"w-4 h-4"})}),h.isActive?s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Adresse deaktivieren?")&&c.mutate({id:h.id,data:{isActive:!1}})},title:"Deaktivieren",children:s.jsx(It,{className:"w-4 h-4"})}):s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Adresse wieder aktivieren?")&&c.mutate({id:h.id,data:{isActive:!0}})},title:"Aktivieren",children:s.jsx(Pe,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Adresse wirklich löschen?")&&d.mutate(h.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]})},h.id))}):s.jsx("p",{className:"text-gray-500",children:"Keine Stressfrei-Wechseln Adressen vorhanden."})]})}function jk({credentials:e,onHide:t,onResetPassword:n,isResettingPassword:r}){const[a,i]=j.useState(null),l=async(u,h)=>{try{await navigator.clipboard.writeText(u),i(h),setTimeout(()=>i(null),2e3)}catch{const x=document.createElement("textarea");x.value=u,document.body.appendChild(x),x.select(),document.execCommand("copy"),document.body.removeChild(x),i(h),setTimeout(()=>i(null),2e3)}},o=({text:u,fieldName:h})=>s.jsx("button",{type:"button",onClick:()=>l(u,h),className:"p-1.5 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors",title:"In Zwischenablage kopieren",children:a===h?s.jsx(xr,{className:"w-4 h-4 text-green-600"}):s.jsx(lh,{className:"w-4 h-4"})}),c=e.imap?`${e.imap.server}:${e.imap.port}`:"",d=e.smtp?`${e.smtp.server}:${e.smtp.port}`:"";return s.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4 space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Zugangsdaten"}),s.jsx("button",{type:"button",onClick:t,className:"text-gray-400 hover:text-gray-600 p-1 hover:bg-gray-200 rounded",title:"Zugangsdaten ausblenden",children:s.jsx(It,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"bg-white rounded-lg p-3 border border-gray-100",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Benutzername"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"text-sm text-gray-900 font-mono flex-1 break-all",children:e.email}),s.jsx(o,{text:e.email,fieldName:"email"})]})]}),s.jsxs("div",{className:"bg-white rounded-lg p-3 border border-gray-100",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Passwort"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"text-sm text-gray-900 font-mono flex-1 break-all",children:e.password}),s.jsx(o,{text:e.password,fieldName:"password"})]}),s.jsx("button",{type:"button",onClick:n,disabled:r,className:"mt-2 text-xs text-blue-600 hover:text-blue-800 disabled:opacity-50",children:r?"Generiere...":"Neu generieren"})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.imap&&s.jsxs("div",{className:"bg-white rounded-lg p-3 border border-gray-100",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"IMAP (Empfang)"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"text-sm text-gray-900 font-mono flex-1",children:c}),s.jsx(o,{text:c,fieldName:"imap"})]}),s.jsx("span",{className:"text-xs text-gray-400 mt-1 block",children:e.imap.encryption})]}),e.smtp&&s.jsxs("div",{className:"bg-white rounded-lg p-3 border border-gray-100",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"SMTP (Versand)"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"text-sm text-gray-900 font-mono flex-1",children:d}),s.jsx(o,{text:d,fieldName:"smtp"})]}),s.jsx("span",{className:"text-xs text-gray-400 mt-1 block",children:e.smtp.encryption})]})]})]})}function bx({isOpen:e,onClose:t,customerId:n,email:r,customerEmail:a}){const[i,l]=j.useState(""),[o,c]=j.useState(""),[d,u]=j.useState(!1),[h,x]=j.useState(!1),[m,f]=j.useState(null),[p,b]=j.useState("idle"),[g,y]=j.useState(!1),[v,N]=j.useState(!1),[E,A]=j.useState(!1),[I,w]=j.useState(!1),[S,P]=j.useState(null),[O,R]=j.useState(!1),[q,D]=j.useState(!1),z=ge(),k=!!r,{data:K}=fe({queryKey:["email-provider-configs"],queryFn:()=>xn.getConfigs(),enabled:e}),B=((K==null?void 0:K.data)||[]).some(ae=>ae.isActive&&ae.isDefault),_=ae=>{if(!ae)return"";const We=ae.indexOf("@");return We>0?ae.substring(0,We):ae},Q=async ae=>{var We;if(!(!B||!ae)){b("checking");try{const xt=await xn.checkEmailExists(ae);b((We=xt.data)!=null&&We.exists?"exists":"not_exists")}catch{b("error")}}},le=async()=>{var ae,We;if(!(!a||!i)){y(!0),f(null);try{const xt=await xn.provisionEmail(i,a);(ae=xt.data)!=null&&ae.success?b("exists"):f(((We=xt.data)==null?void 0:We.error)||"Provisionierung fehlgeschlagen")}catch(xt){f(xt instanceof Error?xt.message:"Fehler bei der Provisionierung")}finally{y(!1)}}},de=async()=>{if(r){N(!0),f(null);try{const ae=await xs.enableMailbox(r.id);ae.success?(A(!0),z.invalidateQueries({queryKey:["customer",n.toString()]}),z.invalidateQueries({queryKey:["mailbox-accounts",n]})):f(ae.error||"Mailbox-Aktivierung fehlgeschlagen")}catch(ae){f(ae instanceof Error?ae.message:"Fehler bei der Mailbox-Aktivierung")}finally{N(!1)}}},_e=async()=>{if(r)try{const ae=await xs.syncMailboxStatus(r.id);ae.success&&ae.data&&(A(ae.data.hasMailbox),ae.data.wasUpdated&&z.invalidateQueries({queryKey:["customer",n.toString()]}))}catch(ae){console.error("Fehler beim Synchronisieren des Mailbox-Status:",ae)}},qe=async()=>{if(r){R(!0);try{const ae=await xs.getMailboxCredentials(r.id);ae.success&&ae.data&&(P(ae.data),w(!0))}catch(ae){console.error("Fehler beim Laden der Zugangsdaten:",ae)}finally{R(!1)}}},st=async()=>{if(r&&confirm("Neues Passwort generieren? Das alte Passwort wird ungültig.")){D(!0);try{const ae=await xs.resetPassword(r.id);ae.success&&ae.data?(S&&P({...S,password:ae.data.password}),alert("Passwort wurde erfolgreich zurückgesetzt.")):alert(ae.error||"Fehler beim Zurücksetzen des Passworts")}catch(ae){console.error("Fehler beim Zurücksetzen des Passworts:",ae),alert(ae instanceof Error?ae.message:"Fehler beim Zurücksetzen des Passworts")}finally{D(!1)}}};j.useEffect(()=>{if(e){if(r){const ae=_(r.email);l(ae),c(r.notes||""),b("idle"),A(r.hasMailbox||!1),B&&(Q(ae),_e())}else l(""),c(""),u(!1),x(!1),b("idle"),A(!1);f(null),w(!1),P(null)}},[e,r,B]);const C=G({mutationFn:async ae=>xs.create(n,{email:ae.email,notes:ae.notes,provisionAtProvider:ae.provision,createMailbox:ae.createMailbox}),onSuccess:()=>{z.invalidateQueries({queryKey:["customer",n.toString()]}),z.invalidateQueries({queryKey:["mailbox-accounts",n]}),l(""),c(""),u(!1),x(!1),t()},onError:ae=>{f(ae instanceof Error?ae.message:"Fehler bei der Provisionierung")}}),nt=G({mutationFn:ae=>xs.update(r.id,ae),onSuccess:()=>{z.invalidateQueries({queryKey:["customer",n.toString()]}),t()}}),es=ae=>{ae.preventDefault(),f(null);const We=i+pd;k?nt.mutate({email:We,notes:o||void 0}):C.mutate({email:We,notes:o||void 0,provision:d,createMailbox:d&&h})},Vt=C.isPending||nt.isPending;return s.jsx(Ve,{isOpen:e,onClose:t,title:k?"Adresse bearbeiten":"Adresse hinzufügen",children:s.jsxs("form",{onSubmit:es,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"E-Mail-Adresse"}),s.jsxs("div",{className:"flex",children:[s.jsx("input",{type:"text",value:i,onChange:ae=>l(ae.target.value.toLowerCase().replace(/[^a-z0-9._-]/g,"")),placeholder:"kunde-freenet",required:!0,className:"block w-full px-3 py-2 border border-gray-300 rounded-l-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("span",{className:"inline-flex items-center px-3 py-2 border border-l-0 border-gray-300 bg-gray-100 text-gray-600 rounded-r-lg text-sm",children:pd})]}),s.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Vollständige Adresse: ",s.jsxs("span",{className:"font-mono",children:[i||"...",pd]})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Notizen (optional)"}),s.jsx("textarea",{value:o,onChange:ae=>c(ae.target.value),rows:3,className:"block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"z.B. für Freenet-Konten, für Klarmobil..."})]}),B&&a&&s.jsx("div",{className:"bg-blue-50 p-3 rounded-lg",children:k?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-medium text-gray-700",children:"E-Mail-Provider Status"}),p==="checking"&&s.jsx("span",{className:"text-xs text-gray-500",children:"Prüfe..."}),p==="exists"&&s.jsxs("span",{className:"text-xs text-green-600 flex items-center gap-1",children:[s.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),"Beim Provider vorhanden"]}),p==="not_exists"&&s.jsx("span",{className:"text-xs text-orange-600",children:"Nicht beim Provider angelegt"}),p==="error"&&s.jsx("span",{className:"text-xs text-red-600",children:"Status konnte nicht geprüft werden"})]}),p==="not_exists"&&s.jsxs("div",{className:"pt-2 border-t border-blue-100",children:[s.jsxs("p",{className:"text-xs text-gray-500 mb-2",children:["Die E-Mail-Weiterleitung ist noch nicht auf dem Server eingerichtet. Weiterleitungsziel: ",a]}),s.jsx(T,{type:"button",size:"sm",onClick:le,disabled:g,children:g?"Wird angelegt...":"Jetzt beim Provider anlegen"})]}),p==="error"&&s.jsx(T,{type:"button",size:"sm",variant:"secondary",onClick:()=>Q(i),children:"Erneut prüfen"}),p==="exists"&&s.jsxs("div",{className:"pt-3 mt-3 border-t border-blue-100",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Mailbox (IMAP/SMTP)"}),E?s.jsxs("span",{className:"text-xs text-green-600 flex items-center gap-1",children:[s.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),"Mailbox aktiv"]}):s.jsx("span",{className:"text-xs text-orange-600",children:"Keine Mailbox"})]}),!E&&s.jsxs("div",{className:"mt-2",children:[s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"Aktiviere eine echte Mailbox um E-Mails direkt im CRM zu empfangen und zu versenden."}),s.jsx(T,{type:"button",size:"sm",onClick:de,disabled:v,children:v?"Wird aktiviert...":"Mailbox aktivieren"})]}),E&&s.jsx("div",{className:"mt-3",children:I?S&&s.jsx(jk,{credentials:S,onHide:()=>w(!1),onResetPassword:st,isResettingPassword:q}):s.jsx(T,{type:"button",size:"sm",variant:"secondary",onClick:qe,disabled:O,children:O?"Laden...":s.jsxs(s.Fragment,{children:[s.jsx(Pe,{className:"w-4 h-4 mr-1"}),"Zugangsdaten anzeigen"]})})})]})]}):s.jsxs("div",{className:"space-y-3",children:[s.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:d,onChange:ae=>{u(ae.target.checked),ae.target.checked||x(!1)},className:"mt-1 rounded border-gray-300"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Beim E-Mail-Provider anlegen"}),s.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Die E-Mail-Weiterleitung wird automatisch auf dem konfigurierten Server erstellt. Weiterleitungsziel: ",a]})]})]}),d&&s.jsxs("label",{className:"flex items-start gap-2 cursor-pointer ml-6",children:[s.jsx("input",{type:"checkbox",checked:h,onChange:ae=>x(ae.target.checked),className:"mt-1 rounded border-gray-300"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Echte Mailbox erstellen (IMAP/SMTP-Zugang)"}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Ermöglicht E-Mails direkt im CRM zu empfangen und zu versenden."})]})]})]})}),m&&s.jsx("div",{className:"bg-red-50 p-3 rounded-lg text-red-700 text-sm",children:m}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:Vt||!i,children:Vt?"Speichern...":"Speichern"})]})]})})}var Il=e=>e.type==="checkbox",Ar=e=>e instanceof Date,as=e=>e==null;const Ov=e=>typeof e=="object";var jt=e=>!as(e)&&!Array.isArray(e)&&Ov(e)&&!Ar(e),bk=e=>jt(e)&&e.target?Il(e.target)?e.target.checked:e.target.value:e,Nk=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,wk=(e,t)=>e.has(Nk(t)),Sk=e=>{const t=e.constructor&&e.constructor.prototype;return jt(t)&&t.hasOwnProperty("isPrototypeOf")},xh=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function bt(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(xh&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(jt(e)&&Sk(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=bt(e[a]));return r}var Ic=e=>/^\w*$/.test(e),rt=e=>e===void 0,gh=e=>Array.isArray(e)?e.filter(Boolean):[],yh=e=>gh(e.replace(/["|']|\]/g,"").split(/\.|\[/)),xe=(e,t,n)=>{if(!t||!jt(e))return n;const r=(Ic(t)?[t]:yh(t)).reduce((a,i)=>as(a)?a:a[i],e);return rt(r)||r===e?rt(e[t])?n:e[t]:r},Js=e=>typeof e=="boolean",_s=e=>typeof e=="function",Ye=(e,t,n)=>{let r=-1;const a=Ic(t)?[t]:yh(t),i=a.length,l=i-1;for(;++r{const a={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(a,i,{get:()=>{const l=i;return t._proxyFormState[l]!==Ks.all&&(t._proxyFormState[l]=!r||Ks.all),e[l]}});return a};const Ek=typeof window<"u"?Tt.useLayoutEffect:Tt.useEffect;var gs=e=>typeof e=="string",Dk=(e,t,n,r,a)=>gs(e)?(r&&t.watch.add(e),xe(n,e,a)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),xe(n,i))):(r&&(t.watchAll=!0),n),Hu=e=>as(e)||!Ov(e);function qn(e,t,n=new WeakSet){if(Hu(e)||Hu(t))return Object.is(e,t);if(Ar(e)&&Ar(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const i of r){const l=e[i];if(!a.includes(i))return!1;if(i!=="ref"){const o=t[i];if(Ar(l)&&Ar(o)||jt(l)&&jt(o)||Array.isArray(l)&&Array.isArray(o)?!qn(l,o,n):!Object.is(l,o))return!1}}return!0}const Pk=Tt.createContext(null);Pk.displayName="HookFormContext";var Ak=(e,t,n,r,a)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:a||!0}}:{},Li=e=>Array.isArray(e)?e:[e],wx=()=>{let e=[];return{get observers(){return e},next:a=>{for(const i of e)i.next&&i.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(i=>i!==a)}}),unsubscribe:()=>{e=[]}}};function zv(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const a=e[r],i=t[r];if(a&&jt(a)&&i){const l=zv(a,i);jt(l)&&(n[r]=l)}else e[r]&&(n[r]=i)}return n}var Wt=e=>jt(e)&&!Object.keys(e).length,vh=e=>e.type==="file",tc=e=>{if(!xh)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},$v=e=>e.type==="select-multiple",jh=e=>e.type==="radio",Mk=e=>jh(e)||Il(e),xd=e=>tc(e)&&e.isConnected;function Tk(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{for(const t in e)if(_s(e[t]))return!0;return!1};function _v(e){return Array.isArray(e)||jt(e)&&!Ik(e)}function Wu(e,t={}){for(const n in e){const r=e[n];_v(r)?(t[n]=Array.isArray(r)?[]:{},Wu(r,t[n])):rt(r)||(t[n]=!0)}return t}function ia(e,t,n){n||(n=Wu(t));for(const r in e){const a=e[r];if(_v(a))rt(t)||Hu(n[r])?n[r]=Wu(a,Array.isArray(a)?[]:{}):ia(a,as(t)?{}:t[r],n[r]);else{const i=t[r];n[r]=!qn(a,i)}}return n}const Sx={value:!1,isValid:!1},kx={value:!0,isValid:!0};var Kv=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!rt(e[0].attributes.value)?rt(e[0].value)||e[0].value===""?kx:{value:e[0].value,isValid:!0}:kx:Sx}return Sx},Bv=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>rt(e)?e:t?e===""?NaN:e&&+e:n&&gs(e)?new Date(e):r?r(e):e;const Cx={isValid:!1,value:null};var Uv=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Cx):Cx;function Ex(e){const t=e.ref;return vh(t)?t.files:jh(t)?Uv(e.refs).value:$v(t)?[...t.selectedOptions].map(({value:n})=>n):Il(t)?Kv(e.refs).value:Bv(rt(t.value)?e.ref.value:t.value,e)}var Rk=(e,t,n,r)=>{const a={};for(const i of e){const l=xe(t,i);l&&Ye(a,i,l._f)}return{criteriaMode:n,names:[...e],fields:a,shouldUseNativeValidation:r}},sc=e=>e instanceof RegExp,vi=e=>rt(e)?e:sc(e)?e.source:jt(e)?sc(e.value)?e.value.source:e.value:e,Dx=e=>({isOnSubmit:!e||e===Ks.onSubmit,isOnBlur:e===Ks.onBlur,isOnChange:e===Ks.onChange,isOnAll:e===Ks.all,isOnTouch:e===Ks.onTouched});const Px="AsyncFunction";var Lk=e=>!!e&&!!e.validate&&!!(_s(e.validate)&&e.validate.constructor.name===Px||jt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Px)),Ok=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ax=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Oi=(e,t,n,r)=>{for(const a of n||Object.keys(e)){const i=xe(e,a);if(i){const{_f:l,...o}=i;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],a)&&!r)return!0;if(l.ref&&t(l.ref,l.name)&&!r)return!0;if(Oi(o,t))break}else if(jt(o)&&Oi(o,t))break}}};function Mx(e,t,n){const r=xe(e,n);if(r||Ic(n))return{error:r,name:n};const a=n.split(".");for(;a.length;){const i=a.join("."),l=xe(t,i),o=xe(e,i);if(l&&!Array.isArray(l)&&n!==i)return{name:n};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};a.pop()}return{name:n}}var zk=(e,t,n,r)=>{n(e);const{name:a,...i}=e;return Wt(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(l=>t[l]===(!r||Ks.all))},$k=(e,t,n)=>!e||!t||e===t||Li(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),_k=(e,t,n,r,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(t||e):(n?r.isOnBlur:a.isOnBlur)?!e:(n?r.isOnChange:a.isOnChange)?e:!0,Kk=(e,t)=>!gh(xe(e,t)).length&&yt(e,t),Bk=(e,t,n)=>{const r=Li(xe(e,n));return Ye(r,"root",t[n]),Ye(e,n,r),e};function Tx(e,t,n="validate"){if(gs(e)||Array.isArray(e)&&e.every(gs)||Js(e)&&!e)return{type:n,message:gs(e)?e:"",ref:t}}var ra=e=>jt(e)&&!sc(e)?e:{value:e,message:""},Fx=async(e,t,n,r,a,i)=>{const{ref:l,refs:o,required:c,maxLength:d,minLength:u,min:h,max:x,pattern:m,validate:f,name:p,valueAsNumber:b,mount:g}=e._f,y=xe(n,p);if(!g||t.has(p))return{};const v=o?o[0]:l,N=R=>{a&&v.reportValidity&&(v.setCustomValidity(Js(R)?"":R||""),v.reportValidity())},E={},A=jh(l),I=Il(l),w=A||I,S=(b||vh(l))&&rt(l.value)&&rt(y)||tc(l)&&l.value===""||y===""||Array.isArray(y)&&!y.length,P=Ak.bind(null,p,r,E),O=(R,q,D,z=mn.maxLength,k=mn.minLength)=>{const K=R?q:D;E[p]={type:R?z:k,message:K,ref:l,...P(R?z:k,K)}};if(i?!Array.isArray(y)||!y.length:c&&(!w&&(S||as(y))||Js(y)&&!y||I&&!Kv(o).isValid||A&&!Uv(o).isValid)){const{value:R,message:q}=gs(c)?{value:!!c,message:c}:ra(c);if(R&&(E[p]={type:mn.required,message:q,ref:v,...P(mn.required,q)},!r))return N(q),E}if(!S&&(!as(h)||!as(x))){let R,q;const D=ra(x),z=ra(h);if(!as(y)&&!isNaN(y)){const k=l.valueAsNumber||y&&+y;as(D.value)||(R=k>D.value),as(z.value)||(q=knew Date(new Date().toDateString()+" "+Q),B=l.type=="time",_=l.type=="week";gs(D.value)&&y&&(R=B?K(y)>K(D.value):_?y>D.value:k>new Date(D.value)),gs(z.value)&&y&&(q=B?K(y)+R.value,z=!as(q.value)&&y.length<+q.value;if((D||z)&&(O(D,R.message,q.message),!r))return N(E[p].message),E}if(m&&!S&&gs(y)){const{value:R,message:q}=ra(m);if(sc(R)&&!y.match(R)&&(E[p]={type:mn.pattern,message:q,ref:l,...P(mn.pattern,q)},!r))return N(q),E}if(f){if(_s(f)){const R=await f(y,n),q=Tx(R,v);if(q&&(E[p]={...q,...P(mn.validate,q.message)},!r))return N(q.message),E}else if(jt(f)){let R={};for(const q in f){if(!Wt(R)&&!r)break;const D=Tx(await f[q](y,n),v,q);D&&(R={...D,...P(q,D.message)},N(D.message),r&&(E[p]=R))}if(!Wt(R)&&(E[p]={ref:v,...R},!r))return E}}return N(!0),E};const Uk={mode:Ks.onSubmit,reValidateMode:Ks.onChange,shouldFocusError:!0};function qk(e={}){let t={...Uk,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:_s(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},a=jt(t.defaultValues)||jt(t.values)?bt(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:bt(a),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={...u};let x={...h};const m={array:wx(),state:wx()},f=t.criteriaMode===Ks.all,p=L=>U=>{clearTimeout(d),d=setTimeout(L,U)},b=async L=>{if(!l.keepIsValid&&!t.disabled&&(h.isValid||x.isValid||L)){let U;t.resolver?(U=Wt((await w()).errors),g()):U=await P(r,!0),U!==n.isValid&&m.state.next({isValid:U})}},g=(L,U)=>{!t.disabled&&(h.isValidating||h.validatingFields||x.isValidating||x.validatingFields)&&((L||Array.from(o.mount)).forEach(W=>{W&&(U?Ye(n.validatingFields,W,U):yt(n.validatingFields,W))}),m.state.next({validatingFields:n.validatingFields,isValidating:!Wt(n.validatingFields)}))},y=(L,U=[],W,ce,se=!0,ee=!0)=>{if(ce&&W&&!t.disabled){if(l.action=!0,ee&&Array.isArray(xe(r,L))){const ye=W(xe(r,L),ce.argA,ce.argB);se&&Ye(r,L,ye)}if(ee&&Array.isArray(xe(n.errors,L))){const ye=W(xe(n.errors,L),ce.argA,ce.argB);se&&Ye(n.errors,L,ye),Kk(n.errors,L)}if((h.touchedFields||x.touchedFields)&&ee&&Array.isArray(xe(n.touchedFields,L))){const ye=W(xe(n.touchedFields,L),ce.argA,ce.argB);se&&Ye(n.touchedFields,L,ye)}(h.dirtyFields||x.dirtyFields)&&(n.dirtyFields=ia(a,i)),m.state.next({name:L,isDirty:R(L,U),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Ye(i,L,U)},v=(L,U)=>{Ye(n.errors,L,U),m.state.next({errors:n.errors})},N=L=>{n.errors=L,m.state.next({errors:n.errors,isValid:!1})},E=(L,U,W,ce)=>{const se=xe(r,L);if(se){const ee=xe(i,L,rt(W)?xe(a,L):W);rt(ee)||ce&&ce.defaultChecked||U?Ye(i,L,U?ee:Ex(se._f)):z(L,ee),l.mount&&!l.action&&b()}},A=(L,U,W,ce,se)=>{let ee=!1,ye=!1;const Le={name:L};if(!t.disabled){if(!W||ce){(h.isDirty||x.isDirty)&&(ye=n.isDirty,n.isDirty=Le.isDirty=R(),ee=ye!==Le.isDirty);const Me=qn(xe(a,L),U);ye=!!xe(n.dirtyFields,L),Me?yt(n.dirtyFields,L):Ye(n.dirtyFields,L,!0),Le.dirtyFields=n.dirtyFields,ee=ee||(h.dirtyFields||x.dirtyFields)&&ye!==!Me}if(W){const Me=xe(n.touchedFields,L);Me||(Ye(n.touchedFields,L,W),Le.touchedFields=n.touchedFields,ee=ee||(h.touchedFields||x.touchedFields)&&Me!==W)}ee&&se&&m.state.next(Le)}return ee?Le:{}},I=(L,U,W,ce)=>{const se=xe(n.errors,L),ee=(h.isValid||x.isValid)&&Js(U)&&n.isValid!==U;if(t.delayError&&W?(c=p(()=>v(L,W)),c(t.delayError)):(clearTimeout(d),c=null,W?Ye(n.errors,L,W):yt(n.errors,L)),(W?!qn(se,W):se)||!Wt(ce)||ee){const ye={...ce,...ee&&Js(U)?{isValid:U}:{},errors:n.errors,name:L};n={...n,...ye},m.state.next(ye)}},w=async L=>(g(L,!0),await t.resolver(i,t.context,Rk(L||o.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),S=async L=>{const{errors:U}=await w(L);if(g(L),L)for(const W of L){const ce=xe(U,W);ce?Ye(n.errors,W,ce):yt(n.errors,W)}else n.errors=U;return U},P=async(L,U,W={valid:!0})=>{for(const ce in L){const se=L[ce];if(se){const{_f:ee,...ye}=se;if(ee){const Le=o.array.has(ee.name),Me=se._f&&Lk(se._f);Me&&h.validatingFields&&g([ee.name],!0);const kt=await Fx(se,o.disabled,i,f,t.shouldUseNativeValidation&&!U,Le);if(Me&&h.validatingFields&&g([ee.name]),kt[ee.name]&&(W.valid=!1,U||e.shouldUseNativeValidation))break;!U&&(xe(kt,ee.name)?Le?Bk(n.errors,kt,ee.name):Ye(n.errors,ee.name,kt[ee.name]):yt(n.errors,ee.name))}!Wt(ye)&&await P(ye,U,W)}}return W.valid},O=()=>{for(const L of o.unMount){const U=xe(r,L);U&&(U._f.refs?U._f.refs.every(W=>!xd(W)):!xd(U._f.ref))&&es(L)}o.unMount=new Set},R=(L,U)=>!t.disabled&&(L&&U&&Ye(i,L,U),!qn(le(),a)),q=(L,U,W)=>Dk(L,o,{...l.mount?i:rt(U)?a:gs(L)?{[L]:U}:U},W,U),D=L=>gh(xe(l.mount?i:a,L,t.shouldUnregister?xe(a,L,[]):[])),z=(L,U,W={})=>{const ce=xe(r,L);let se=U;if(ce){const ee=ce._f;ee&&(!ee.disabled&&Ye(i,L,Bv(U,ee)),se=tc(ee.ref)&&as(U)?"":U,$v(ee.ref)?[...ee.ref.options].forEach(ye=>ye.selected=se.includes(ye.value)):ee.refs?Il(ee.ref)?ee.refs.forEach(ye=>{(!ye.defaultChecked||!ye.disabled)&&(Array.isArray(se)?ye.checked=!!se.find(Le=>Le===ye.value):ye.checked=se===ye.value||!!se)}):ee.refs.forEach(ye=>ye.checked=ye.value===se):vh(ee.ref)?ee.ref.value="":(ee.ref.value=se,ee.ref.type||m.state.next({name:L,values:bt(i)})))}(W.shouldDirty||W.shouldTouch)&&A(L,se,W.shouldTouch,W.shouldDirty,!0),W.shouldValidate&&Q(L)},k=(L,U,W)=>{for(const ce in U){if(!U.hasOwnProperty(ce))return;const se=U[ce],ee=L+"."+ce,ye=xe(r,ee);(o.array.has(L)||jt(se)||ye&&!ye._f)&&!Ar(se)?k(ee,se,W):z(ee,se,W)}},K=(L,U,W={})=>{const ce=xe(r,L),se=o.array.has(L),ee=bt(U);Ye(i,L,ee),se?(m.array.next({name:L,values:bt(i)}),(h.isDirty||h.dirtyFields||x.isDirty||x.dirtyFields)&&W.shouldDirty&&m.state.next({name:L,dirtyFields:ia(a,i),isDirty:R(L,ee)})):ce&&!ce._f&&!as(ee)?k(L,ee,W):z(L,ee,W),Ax(L,o)?m.state.next({...n,name:L,values:bt(i)}):m.state.next({name:l.mount?L:void 0,values:bt(i)})},B=async L=>{l.mount=!0;const U=L.target;let W=U.name,ce=!0;const se=xe(r,W),ee=Me=>{ce=Number.isNaN(Me)||Ar(Me)&&isNaN(Me.getTime())||qn(Me,xe(i,W,Me))},ye=Dx(t.mode),Le=Dx(t.reValidateMode);if(se){let Me,kt;const dn=U.type?Ex(se._f):bk(L),Hs=L.type===Nx.BLUR||L.type===Nx.FOCUS_OUT,Ln=!Ok(se._f)&&!t.resolver&&!xe(n.errors,W)&&!se._f.deps||_k(Hs,xe(n.touchedFields,W),n.isSubmitted,Le,ye),ii=Ax(W,o,Hs);Ye(i,W,dn),Hs?(!U||!U.readOnly)&&(se._f.onBlur&&se._f.onBlur(L),c&&c(0)):se._f.onChange&&se._f.onChange(L);const sa=A(W,dn,Hs),Rc=!Wt(sa)||ii;if(!Hs&&m.state.next({name:W,type:L.type,values:bt(i)}),Ln)return(h.isValid||x.isValid)&&(t.mode==="onBlur"?Hs&&b():Hs||b()),Rc&&m.state.next({name:W,...ii?{}:sa});if(!Hs&&ii&&m.state.next({...n}),t.resolver){const{errors:li}=await w([W]);if(g([W]),ee(dn),ce){const Rl=Mx(n.errors,r,W),oi=Mx(li,r,Rl.name||W);Me=oi.error,W=oi.name,kt=Wt(li)}}else g([W],!0),Me=(await Fx(se,o.disabled,i,f,t.shouldUseNativeValidation))[W],g([W]),ee(dn),ce&&(Me?kt=!1:(h.isValid||x.isValid)&&(kt=await P(r,!0)));ce&&(se._f.deps&&(!Array.isArray(se._f.deps)||se._f.deps.length>0)&&Q(se._f.deps),I(W,kt,Me,sa))}},_=(L,U)=>{if(xe(n.errors,U)&&L.focus)return L.focus(),1},Q=async(L,U={})=>{let W,ce;const se=Li(L);if(t.resolver){const ee=await S(rt(L)?L:se);W=Wt(ee),ce=L?!se.some(ye=>xe(ee,ye)):W}else L?(ce=(await Promise.all(se.map(async ee=>{const ye=xe(r,ee);return await P(ye&&ye._f?{[ee]:ye}:ye)}))).every(Boolean),!(!ce&&!n.isValid)&&b()):ce=W=await P(r);return m.state.next({...!gs(L)||(h.isValid||x.isValid)&&W!==n.isValid?{}:{name:L},...t.resolver||!L?{isValid:W}:{},errors:n.errors}),U.shouldFocus&&!ce&&Oi(r,_,L?se:o.mount),ce},le=(L,U)=>{let W={...l.mount?i:a};return U&&(W=zv(U.dirtyFields?n.dirtyFields:n.touchedFields,W)),rt(L)?W:gs(L)?xe(W,L):L.map(ce=>xe(W,ce))},de=(L,U)=>({invalid:!!xe((U||n).errors,L),isDirty:!!xe((U||n).dirtyFields,L),error:xe((U||n).errors,L),isValidating:!!xe(n.validatingFields,L),isTouched:!!xe((U||n).touchedFields,L)}),_e=L=>{L&&Li(L).forEach(U=>yt(n.errors,U)),m.state.next({errors:L?n.errors:{}})},qe=(L,U,W)=>{const ce=(xe(r,L,{_f:{}})._f||{}).ref,se=xe(n.errors,L)||{},{ref:ee,message:ye,type:Le,...Me}=se;Ye(n.errors,L,{...Me,...U,ref:ce}),m.state.next({name:L,errors:n.errors,isValid:!1}),W&&W.shouldFocus&&ce&&ce.focus&&ce.focus()},st=(L,U)=>_s(L)?m.state.subscribe({next:W=>"values"in W&&L(q(void 0,U),W)}):q(L,U,!0),C=L=>m.state.subscribe({next:U=>{$k(L.name,U.name,L.exact)&&zk(U,L.formState||h,ts,L.reRenderRoot)&&L.callback({values:{...i},...n,...U,defaultValues:a})}}).unsubscribe,nt=L=>(l.mount=!0,x={...x,...L.formState},C({...L,formState:{...u,...L.formState}})),es=(L,U={})=>{for(const W of L?Li(L):o.mount)o.mount.delete(W),o.array.delete(W),U.keepValue||(yt(r,W),yt(i,W)),!U.keepError&&yt(n.errors,W),!U.keepDirty&&yt(n.dirtyFields,W),!U.keepTouched&&yt(n.touchedFields,W),!U.keepIsValidating&&yt(n.validatingFields,W),!t.shouldUnregister&&!U.keepDefaultValue&&yt(a,W);m.state.next({values:bt(i)}),m.state.next({...n,...U.keepDirty?{isDirty:R()}:{}}),!U.keepIsValid&&b()},Vt=({disabled:L,name:U})=>{if(Js(L)&&l.mount||L||o.disabled.has(U)){const se=o.disabled.has(U)!==!!L;L?o.disabled.add(U):o.disabled.delete(U),se&&l.mount&&!l.action&&b()}},ae=(L,U={})=>{let W=xe(r,L);const ce=Js(U.disabled)||Js(t.disabled);return Ye(r,L,{...W||{},_f:{...W&&W._f?W._f:{ref:{name:L}},name:L,mount:!0,...U}}),o.mount.add(L),W?Vt({disabled:Js(U.disabled)?U.disabled:t.disabled,name:L}):E(L,!0,U.value),{...ce?{disabled:U.disabled||t.disabled}:{},...t.progressive?{required:!!U.required,min:vi(U.min),max:vi(U.max),minLength:vi(U.minLength),maxLength:vi(U.maxLength),pattern:vi(U.pattern)}:{},name:L,onChange:B,onBlur:B,ref:se=>{if(se){ae(L,U),W=xe(r,L);const ee=rt(se.value)&&se.querySelectorAll&&se.querySelectorAll("input,select,textarea")[0]||se,ye=Mk(ee),Le=W._f.refs||[];if(ye?Le.find(Me=>Me===ee):ee===W._f.ref)return;Ye(r,L,{_f:{...W._f,...ye?{refs:[...Le.filter(xd),ee,...Array.isArray(xe(a,L))?[{}]:[]],ref:{type:ee.type,name:L}}:{ref:ee}}}),E(L,!1,void 0,ee)}else W=xe(r,L,{}),W._f&&(W._f.mount=!1),(t.shouldUnregister||U.shouldUnregister)&&!(wk(o.array,L)&&l.action)&&o.unMount.add(L)}}},We=()=>t.shouldFocusError&&Oi(r,_,o.mount),xt=L=>{Js(L)&&(m.state.next({disabled:L}),Oi(r,(U,W)=>{const ce=xe(r,W);ce&&(U.disabled=ce._f.disabled||L,Array.isArray(ce._f.refs)&&ce._f.refs.forEach(se=>{se.disabled=ce._f.disabled||L}))},0,!1))},Z=(L,U)=>async W=>{let ce;W&&(W.preventDefault&&W.preventDefault(),W.persist&&W.persist());let se=bt(i);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:ee,values:ye}=await w();g(),n.errors=ee,se=bt(ye)}else await P(r);if(o.disabled.size)for(const ee of o.disabled)yt(se,ee);if(yt(n.errors,"root"),Wt(n.errors)){m.state.next({errors:{}});try{await L(se,W)}catch(ee){ce=ee}}else U&&await U({...n.errors},W),We(),setTimeout(We);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Wt(n.errors)&&!ce,submitCount:n.submitCount+1,errors:n.errors}),ce)throw ce},Fe=(L,U={})=>{xe(r,L)&&(rt(U.defaultValue)?K(L,bt(xe(a,L))):(K(L,U.defaultValue),Ye(a,L,bt(U.defaultValue))),U.keepTouched||yt(n.touchedFields,L),U.keepDirty||(yt(n.dirtyFields,L),n.isDirty=U.defaultValue?R(L,bt(xe(a,L))):R()),U.keepError||(yt(n.errors,L),h.isValid&&b()),m.state.next({...n}))},Xe=(L,U={})=>{const W=L?bt(L):a,ce=bt(W),se=Wt(L),ee=se?a:ce;if(U.keepDefaultValues||(a=W),!U.keepValues){if(U.keepDirtyValues){const ye=new Set([...o.mount,...Object.keys(ia(a,i))]);for(const Le of Array.from(ye)){const Me=xe(n.dirtyFields,Le),kt=xe(i,Le),dn=xe(ee,Le);Me&&!rt(kt)?Ye(ee,Le,kt):!Me&&!rt(dn)&&K(Le,dn)}}else{if(xh&&rt(L))for(const ye of o.mount){const Le=xe(r,ye);if(Le&&Le._f){const Me=Array.isArray(Le._f.refs)?Le._f.refs[0]:Le._f.ref;if(tc(Me)){const kt=Me.closest("form");if(kt){kt.reset();break}}}}if(U.keepFieldsRef)for(const ye of o.mount)K(ye,xe(ee,ye));else r={}}i=t.shouldUnregister?U.keepDefaultValues?bt(a):{}:bt(ee),m.array.next({values:{...ee}}),m.state.next({values:{...ee}})}o={mount:U.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!h.isValid||!!U.keepIsValid||!!U.keepDirtyValues||!t.shouldUnregister&&!Wt(ee),l.watch=!!t.shouldUnregister,l.keepIsValid=!!U.keepIsValid,l.action=!1,U.keepErrors||(n.errors={}),m.state.next({submitCount:U.keepSubmitCount?n.submitCount:0,isDirty:se?!1:U.keepDirty?n.isDirty:!!(U.keepDefaultValues&&!qn(L,a)),isSubmitted:U.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:se?{}:U.keepDirtyValues?U.keepDefaultValues&&i?ia(a,i):n.dirtyFields:U.keepDefaultValues&&L?ia(a,L):U.keepDirty?n.dirtyFields:{},touchedFields:U.keepTouched?n.touchedFields:{},errors:U.keepErrors?n.errors:{},isSubmitSuccessful:U.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},J=(L,U)=>Xe(_s(L)?L(i):L,{...t.resetOptions,...U}),ue=(L,U={})=>{const W=xe(r,L),ce=W&&W._f;if(ce){const se=ce.refs?ce.refs[0]:ce.ref;se.focus&&setTimeout(()=>{se.focus(),U.shouldSelect&&_s(se.select)&&se.select()})}},ts=L=>{n={...n,...L}},gt={control:{register:ae,unregister:es,getFieldState:de,handleSubmit:Z,setError:qe,_subscribe:C,_runSchema:w,_updateIsValidating:g,_focusError:We,_getWatch:q,_getDirty:R,_setValid:b,_setFieldArray:y,_setDisabledField:Vt,_setErrors:N,_getFieldArray:D,_reset:Xe,_resetDefaultValues:()=>_s(t.defaultValues)&&t.defaultValues().then(L=>{J(L,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:O,_disableForm:xt,_subjects:m,_proxyFormState:h,get _fields(){return r},get _formValues(){return i},get _state(){return l},set _state(L){l=L},get _defaultValues(){return a},get _names(){return o},set _names(L){o=L},get _formState(){return n},get _options(){return t},set _options(L){t={...t,...L}}},subscribe:nt,trigger:Q,register:ae,handleSubmit:Z,watch:st,setValue:K,getValues:le,reset:J,resetField:Fe,clearErrors:_e,unregister:es,setError:qe,setFocus:ue,getFieldState:de};return{...gt,formControl:gt}}function qv(e={}){const t=Tt.useRef(void 0),n=Tt.useRef(void 0),[r,a]=Tt.useState({isDirty:!1,isValidating:!1,isLoading:_s(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:_s(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!_s(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...o}=qk(e);t.current={...o,formState:r}}const i=t.current.control;return i._options=e,Ek(()=>{const l=i._subscribe({formState:i._proxyFormState,callback:()=>a({...i._formState}),reRenderRoot:!0});return a(o=>({...o,isReady:!0})),i._formState.isReady=!0,l},[i]),Tt.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),Tt.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),Tt.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),Tt.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),Tt.useEffect(()=>{if(i._proxyFormState.isDirty){const l=i._getDirty();l!==r.isDirty&&i._subjects.state.next({isDirty:l})}},[i,r.isDirty]),Tt.useEffect(()=>{var l;e.values&&!qn(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((l=i._options.resetOptions)===null||l===void 0)&&l.keepIsValid||i._setValid(),n.current=e.values,a(o=>({...o}))):i._resetDefaultValues()},[i,e.values]),Tt.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=Tt.useMemo(()=>Ck(r,i),[i,r]),t.current}function Ix(){var g,y;const{id:e}=bc(),t=Yt(),n=ge(),r=!!e,{register:a,handleSubmit:i,reset:l,watch:o,setValue:c,formState:{errors:d}}=qv(),u=o("type"),{data:h}=fe({queryKey:["customer",e],queryFn:()=>Pt.getById(parseInt(e)),enabled:r});j.useEffect(()=>{if(h!=null&&h.data){const v={...h.data};v.birthDate&&(v.birthDate=v.birthDate.split("T")[0]),v.foundingDate&&(v.foundingDate=v.foundingDate.split("T")[0]),l(v)}},[h,l]);const x=G({mutationFn:Pt.create,onSuccess:()=>{n.invalidateQueries({queryKey:["customers"]}),t("/customers")}}),m=G({mutationFn:v=>Pt.update(parseInt(e),v),onSuccess:()=>{n.invalidateQueries({queryKey:["customers"]}),n.invalidateQueries({queryKey:["customer",e]}),t(`/customers/${e}`)}}),f=v=>{const N={type:v.type,salutation:v.salutation||void 0,firstName:v.firstName,lastName:v.lastName,companyName:v.companyName||void 0,email:v.email||void 0,phone:v.phone||void 0,mobile:v.mobile||void 0,taxNumber:v.taxNumber||void 0,commercialRegisterNumber:v.commercialRegisterNumber||void 0,notes:v.notes||void 0,birthPlace:v.birthPlace||void 0};v.birthDate&&typeof v.birthDate=="string"&&v.birthDate.trim()!==""?N.birthDate=new Date(v.birthDate).toISOString():N.birthDate=null,v.foundingDate&&typeof v.foundingDate=="string"&&v.foundingDate.trim()!==""?N.foundingDate=new Date(v.foundingDate).toISOString():N.foundingDate=null,r?m.mutate(N):x.mutate(N)},p=x.isPending||m.isPending,b=x.error||m.error;return s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold mb-6",children:r?"Kunde bearbeiten":"Neuer Kunde"}),b&&s.jsx("div",{className:"mb-4 p-4 bg-red-50 border border-red-200 text-red-700 rounded-lg",children:b instanceof Error?b.message:"Ein Fehler ist aufgetreten"}),s.jsxs("form",{onSubmit:i(f),children:[s.jsx(X,{className:"mb-6",title:"Stammdaten",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(Ie,{label:"Kundentyp",...a("type"),options:[{value:"PRIVATE",label:"Privatkunde"},{value:"BUSINESS",label:"Geschäftskunde"}]}),s.jsx(Ie,{label:"Anrede",...a("salutation"),options:[{value:"Herr",label:"Herr"},{value:"Frau",label:"Frau"},{value:"Divers",label:"Divers"}]}),s.jsx(H,{label:"Vorname",...a("firstName",{required:"Vorname erforderlich"}),error:(g=d.firstName)==null?void 0:g.message}),s.jsx(H,{label:"Nachname",...a("lastName",{required:"Nachname erforderlich"}),error:(y=d.lastName)==null?void 0:y.message}),u==="BUSINESS"&&s.jsxs(s.Fragment,{children:[s.jsx(H,{label:"Firmenname",...a("companyName"),className:"md:col-span-2"}),s.jsx(H,{label:"Gründungsdatum",type:"date",...a("foundingDate"),value:o("foundingDate")||"",onClear:()=>c("foundingDate","")})]}),u!=="BUSINESS"&&s.jsxs(s.Fragment,{children:[s.jsx(H,{label:"Geburtsdatum",type:"date",...a("birthDate"),value:o("birthDate")||"",onClear:()=>c("birthDate","")}),s.jsx(H,{label:"Geburtsort",...a("birthPlace")})]})]})}),s.jsx(X,{className:"mb-6",title:"Kontaktdaten",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"E-Mail",type:"email",...a("email")}),s.jsx(H,{label:"Telefon",...a("phone")}),s.jsx(H,{label:"Mobil",...a("mobile")})]})}),u==="BUSINESS"&&s.jsxs(X,{className:"mb-6",title:"Geschäftsdaten",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"Steuernummer",...a("taxNumber")}),s.jsx(H,{label:"Handelsregisternummer",...a("commercialRegisterNumber"),placeholder:"z.B. HRB 12345"})]}),r&&s.jsx("p",{className:"mt-4 text-sm text-gray-500",children:"Dokumente (Gewerbeanmeldung, Handelsregisterauszug) können nach dem Speichern in der Kundendetailansicht hochgeladen werden."})]}),s.jsx(X,{className:"mb-6",title:"Notizen",children:s.jsx("textarea",{...a("notes"),rows:4,className:"block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Interne Notizen..."})}),s.jsxs("div",{className:"flex justify-end gap-4",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:()=>t(-1),children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:p,children:p?"Speichern...":"Speichern"})]})]})]})}const gd={ELECTRICITY:"Strom",GAS:"Gas",DSL:"DSL",CABLE:"Kabelinternet",FIBER:"Glasfaser",MOBILE:"Mobilfunk",TV:"TV",CAR_INSURANCE:"KFZ-Versicherung"},yd={DRAFT:"Entwurf",PENDING:"Ausstehend",ACTIVE:"Aktiv",CANCELLED:"Gekündigt",EXPIRED:"Abgelaufen",DEACTIVATED:"Deaktiviert"},Rx={ACTIVE:"success",PENDING:"warning",CANCELLED:"danger",EXPIRED:"danger",DRAFT:"default",DEACTIVATED:"default"},Vk=[{status:"DRAFT",label:"Entwurf",description:"Vertrag wird noch vorbereitet",color:"text-gray-600"},{status:"PENDING",label:"Ausstehend",description:"Wartet auf Aktivierung",color:"text-yellow-600"},{status:"ACTIVE",label:"Aktiv",description:"Vertrag läuft normal",color:"text-green-600"},{status:"EXPIRED",label:"Abgelaufen",description:"Laufzeit vorbei, läuft aber ohne Kündigung weiter",color:"text-orange-600"},{status:"CANCELLED",label:"Gekündigt",description:"Aktive Kündigung eingereicht, Vertrag endet",color:"text-red-600"},{status:"DEACTIVATED",label:"Deaktiviert",description:"Manuell beendet/archiviert",color:"text-gray-500"}];function Qk({isOpen:e,onClose:t}){return e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[s.jsx("div",{className:"fixed inset-0 bg-black/20",onClick:t}),s.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl p-4 max-w-sm w-full mx-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Vertragsstatus-Übersicht"}),s.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600",children:s.jsx(qt,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"space-y-2",children:Vk.map(({status:n,label:r,description:a,color:i})=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:`font-medium text-sm min-w-[90px] ${i}`,children:r}),s.jsx("span",{className:"text-sm text-gray-600",children:a})]},n))})]})]}):null}function Hk(){const[e,t]=wc(),n=Yt(),[r,a]=j.useState(e.get("search")||""),[i,l]=j.useState(e.get("type")||""),[o,c]=j.useState(e.get("status")||""),[d,u]=j.useState(parseInt(e.get("page")||"1",10)),[h,x]=j.useState(new Set),[m,f]=j.useState(!1),{hasPermission:p,isCustomer:b,isCustomerPortal:g,user:y}=He(),v=ge();j.useEffect(()=>{const D=new URLSearchParams;r&&D.set("search",r),i&&D.set("type",i),o&&D.set("status",o),d>1&&D.set("page",d.toString()),t(D,{replace:!0})},[r,i,o,d,t]);const N=G({mutationFn:Oe.delete,onSuccess:()=>{v.invalidateQueries({queryKey:["contracts"]})}}),{data:E,isLoading:A}=fe({queryKey:["contracts",r,i,o,d,b?y==null?void 0:y.customerId:null],queryFn:()=>Oe.getAll({search:r||void 0,type:i||void 0,status:o||void 0,page:d,limit:20,customerId:b?y==null?void 0:y.customerId:void 0})}),I=j.useMemo(()=>{if(!g||!(E!=null&&E.data))return[];const D=new Set;return y!=null&&y.customerId&&D.add(y.customerId),E.data.forEach(z=>D.add(z.customerId)),[...D]},[E==null?void 0:E.data,g,y==null?void 0:y.customerId]),w=t1({queries:I.map(D=>({queryKey:["contract-tree",D],queryFn:()=>Oe.getTreeForCustomer(D),enabled:g}))}),S=j.useMemo(()=>{const D=new Map;return I.forEach((z,k)=>{var B;const K=w[k];(B=K==null?void 0:K.data)!=null&&B.data&&D.set(z,K.data.data)}),D},[I,w]),P=j.useMemo(()=>{if(!g||!(E!=null&&E.data))return null;const D={};for(const z of E.data){const k=z.customerId;if(!D[k]){const K=z.customer?z.customer.companyName||`${z.customer.firstName} ${z.customer.lastName}`:`Kunde ${k}`;D[k]={customerId:k,customerName:K,isOwn:k===(y==null?void 0:y.customerId),contracts:[],tree:S.get(k)||[]}}D[k].contracts.push(z)}return Object.values(D).sort((z,k)=>z.isOwn&&!k.isOwn?-1:!z.isOwn&&k.isOwn?1:z.customerName.localeCompare(k.customerName))},[E==null?void 0:E.data,g,y==null?void 0:y.customerId,S]),O=D=>{x(z=>{const k=new Set(z);return k.has(D)?k.delete(D):k.add(D),k})},R=(D,z)=>D.map(k=>s.jsx("div",{children:q(k,z)},k.contract.id)),q=(D,z=0)=>{var le,de,_e,qe,st,C,nt;const{contract:k,predecessors:K,hasHistory:B}=D,_=h.has(k.id),Q=z>0;return s.jsxs("div",{children:[s.jsxs("div",{className:` - border rounded-lg p-4 transition-colors - ${Q?"ml-6 border-l-4 border-l-gray-300 bg-gray-50":"hover:bg-gray-50"} - `,children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[!Q&&B?s.jsx("button",{onClick:()=>O(k.id),className:"p-1 hover:bg-gray-200 rounded transition-colors",title:_?"Einklappen":"Vorgänger anzeigen",children:_?s.jsx(Rn,{className:"w-4 h-4 text-gray-500"}):s.jsx(Ft,{className:"w-4 h-4 text-gray-500"})}):Q?null:s.jsx("div",{className:"w-6"}),s.jsxs("span",{className:"font-mono flex items-center gap-1",children:[k.contractNumber,s.jsx(oe,{value:k.contractNumber})]}),s.jsx(ve,{children:gd[k.type]||k.type}),s.jsx(ve,{variant:Rx[k.status]||"default",children:yd[k.status]||k.status}),Q&&s.jsx("span",{className:"text-xs text-gray-500 ml-2",children:"(Vorgänger)"})]}),s.jsx("div",{className:"flex gap-2",children:s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>n(`/contracts/${k.id}`,{state:{from:"contracts"}}),title:"Ansehen",children:s.jsx(Pe,{className:"w-4 h-4"})})})]}),(k.providerName||((le=k.provider)==null?void 0:le.name))&&s.jsxs("p",{className:`flex items-center gap-1 ${Q?"ml-6":""}`,children:[k.providerName||((de=k.provider)==null?void 0:de.name),(k.tariffName||((_e=k.tariff)==null?void 0:_e.name))&&` - ${k.tariffName||((qe=k.tariff)==null?void 0:qe.name)}`,s.jsx(oe,{value:(k.providerName||((st=k.provider)==null?void 0:st.name)||"")+(k.tariffName||(C=k.tariff)!=null&&C.name?` - ${k.tariffName||((nt=k.tariff)==null?void 0:nt.name)}`:"")})]}),k.startDate&&s.jsxs("p",{className:`text-sm text-gray-500 ${Q?"ml-6":""}`,children:["Beginn: ",new Date(k.startDate).toLocaleDateString("de-DE"),k.endDate&&` | Ende: ${new Date(k.endDate).toLocaleDateString("de-DE")}`]})]}),(z===0&&_||z>0)&&K.length>0&&s.jsx("div",{className:"mt-2",children:R(K,z+1)})]},k.id)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Verträge"}),p("contracts:create")&&!b&&s.jsx(ke,{to:"/contracts/new",children:s.jsxs(T,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Neuer Vertrag"]})})]}),s.jsx(X,{className:"mb-6",children:s.jsxs("div",{className:"flex gap-4 flex-wrap",children:[s.jsx("div",{className:"flex-1 min-w-[200px]",children:s.jsx(H,{placeholder:"Suchen...",value:r,onChange:D=>a(D.target.value)})}),s.jsx(Ie,{value:i,onChange:D=>l(D.target.value),options:Object.entries(gd).map(([D,z])=>({value:D,label:z})),className:"w-48"}),s.jsx(Ie,{value:o,onChange:D=>c(D.target.value),options:Object.entries(yd).map(([D,z])=>({value:D,label:z})),className:"w-48"}),s.jsx(T,{variant:"secondary",children:s.jsx(Ml,{className:"w-4 h-4"})})]})}),A?s.jsx(X,{children:s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."})}):E!=null&&E.data&&E.data.length>0?s.jsx(s.Fragment,{children:g&&P?s.jsx("div",{className:"space-y-6",children:P.map(D=>s.jsxs(X,{children:[s.jsx("div",{className:"flex items-center gap-3 mb-4 pb-3 border-b",children:D.isOwn?s.jsxs(s.Fragment,{children:[s.jsx(Fl,{className:"w-5 h-5 text-blue-600"}),s.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Meine Verträge"}),s.jsx(ve,{variant:"default",children:D.contracts.length})]}):s.jsxs(s.Fragment,{children:[s.jsx(Ca,{className:"w-5 h-5 text-purple-600"}),s.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:["Verträge von ",D.customerName]}),s.jsx(ve,{variant:"default",children:D.contracts.length})]})}),D.tree.length>0?s.jsx("div",{className:"space-y-4",children:D.tree.map(z=>q(z,0))}):s.jsx("p",{className:"text-gray-500",children:"Keine Verträge vorhanden."})]},D.isOwn?"own":D.customerName))}):s.jsxs(X,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Vertragsnr."}),!b&&s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Kunde"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Typ"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Anbieter / Tarif"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:s.jsxs("span",{className:"flex items-center gap-1",children:["Status",s.jsx("button",{onClick:()=>f(!0),className:"text-gray-400 hover:text-blue-600 transition-colors",title:"Status-Erklärung",children:s.jsx(Al,{className:"w-4 h-4"})})]})}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Beginn"}),s.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsx("tbody",{children:E.data.map(D=>s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[s.jsx("td",{className:"py-3 px-4 font-mono text-sm",children:D.contractNumber}),!b&&s.jsx("td",{className:"py-3 px-4",children:D.customer&&s.jsx(ke,{to:`/customers/${D.customer.id}`,className:"text-blue-600 hover:underline",children:D.customer.companyName||`${D.customer.firstName} ${D.customer.lastName}`})}),s.jsx("td",{className:"py-3 px-4",children:s.jsx(ve,{children:gd[D.type]})}),s.jsxs("td",{className:"py-3 px-4",children:[D.providerName||"-",D.tariffName&&s.jsxs("span",{className:"text-gray-500",children:[" / ",D.tariffName]})]}),s.jsx("td",{className:"py-3 px-4",children:s.jsx(ve,{variant:Rx[D.status],children:yd[D.status]})}),s.jsx("td",{className:"py-3 px-4",children:D.startDate?new Date(D.startDate).toLocaleDateString("de-DE"):"-"}),s.jsx("td",{className:"py-3 px-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>n(`/contracts/${D.id}`,{state:{from:"contracts"}}),children:s.jsx(Pe,{className:"w-4 h-4"})}),p("contracts:update")&&!b&&s.jsx(ke,{to:`/contracts/${D.id}/edit`,children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Je,{className:"w-4 h-4"})})}),p("contracts:delete")&&!b&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Vertrag wirklich löschen?")&&N.mutate(D.id)},children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})})]},D.id))})]})}),E.pagination&&E.pagination.totalPages>1&&s.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["Seite ",E.pagination.page," von ",E.pagination.totalPages," (",E.pagination.total," Einträge)"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>u(D=>Math.max(1,D-1)),disabled:d===1,children:"Zurück"}),s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>u(D=>D+1),disabled:d>=E.pagination.totalPages,children:"Weiter"})]})]})]})}):s.jsx(X,{children:s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Verträge gefunden."})}),s.jsx(Qk,{isOpen:m,onClose:()=>f(!1)})]})}const Wk={ELECTRICITY:"Strom",GAS:"Gas",DSL:"DSL",CABLE:"Kabelinternet",FIBER:"Glasfaser",MOBILE:"Mobilfunk",TV:"TV",CAR_INSURANCE:"KFZ-Versicherung"},Gk={DRAFT:"Entwurf",PENDING:"Ausstehend",ACTIVE:"Aktiv",CANCELLED:"Gekündigt",EXPIRED:"Abgelaufen",DEACTIVATED:"Deaktiviert"},Zk={ACTIVE:"success",PENDING:"warning",CANCELLED:"danger",EXPIRED:"danger",DRAFT:"default",DEACTIVATED:"default"};function Jk({contractId:e,isOpen:t,onClose:n}){var o,c,d,u,h,x,m,f,p,b,g;const{data:r,isLoading:a,error:i}=fe({queryKey:["contract",e],queryFn:()=>Oe.getById(e),enabled:t}),l=r==null?void 0:r.data;return s.jsxs(Ve,{isOpen:t,onClose:n,title:"Vertragsdetails",size:"xl",children:[a&&s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}),i&&s.jsx("div",{className:"text-center py-8 text-red-600",children:"Fehler beim Laden des Vertrags"}),l&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3 pb-4 border-b",children:[s.jsxs("span",{className:"text-xl font-bold font-mono flex items-center gap-2",children:[l.contractNumber,s.jsx(oe,{value:l.contractNumber})]}),s.jsx(ve,{children:Wk[l.type]||l.type}),s.jsx(ve,{variant:Zk[l.status]||"default",children:Gk[l.status]||l.status})]}),(l.providerName||((o=l.provider)==null?void 0:o.name)||l.tariffName||((c=l.tariff)==null?void 0:c.name))&&s.jsx(X,{title:"Anbieter & Tarif",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[(l.providerName||((d=l.provider)==null?void 0:d.name))&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Anbieter"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[l.providerName||((u=l.provider)==null?void 0:u.name),s.jsx(oe,{value:l.providerName||((h=l.provider)==null?void 0:h.name)||""})]})]}),(l.tariffName||((x=l.tariff)==null?void 0:x.name))&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Tarif"}),s.jsxs("dd",{className:"flex items-center gap-1",children:[l.tariffName||((m=l.tariff)==null?void 0:m.name),s.jsx(oe,{value:l.tariffName||((f=l.tariff)==null?void 0:f.name)||""})]})]}),l.customerNumberAtProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kundennummer beim Anbieter"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[l.customerNumberAtProvider,s.jsx(oe,{value:l.customerNumberAtProvider})]})]}),l.contractNumberAtProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsnummer beim Anbieter"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[l.contractNumberAtProvider,s.jsx(oe,{value:l.contractNumberAtProvider})]})]})]})}),(l.type==="ELECTRICITY"||l.type==="GAS")&&((p=l.energyDetails)==null?void 0:p.meter)&&s.jsx(X,{title:"Zähler",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Zählernummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[l.energyDetails.meter.meterNumber,s.jsx(oe,{value:l.energyDetails.meter.meterNumber})]})]}),l.energyDetails.maloId&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"MaLo-ID"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[l.energyDetails.maloId,s.jsx(oe,{value:l.energyDetails.maloId})]})]})]})}),s.jsx(X,{title:"Laufzeit",children:s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[l.startDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsbeginn"}),s.jsx("dd",{children:new Date(l.startDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),l.endDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsende"}),s.jsx("dd",{children:new Date(l.endDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),l.contractDuration&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Laufzeit"}),s.jsx("dd",{children:l.contractDuration.description})]}),l.cancellationPeriod&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kündigungsfrist"}),s.jsx("dd",{children:l.cancellationPeriod.description})]})]})}),(l.portalUsername||((b=l.provider)==null?void 0:b.portalUrl))&&s.jsx(X,{title:"Portal-Zugangsdaten",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[((g=l.provider)==null?void 0:g.portalUrl)&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Portal-URL"}),s.jsx("dd",{children:s.jsx("a",{href:l.provider.portalUrl,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:l.provider.portalUrl})})]}),l.portalUsername&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Benutzername"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[l.portalUsername,s.jsx(oe,{value:l.portalUsername})]})]})]})}),l.address&&s.jsxs(X,{title:"Lieferadresse",children:[s.jsxs("p",{children:[l.address.street," ",l.address.houseNumber]}),s.jsxs("p",{children:[l.address.postalCode," ",l.address.city]})]}),l.notes&&s.jsx(X,{title:"Notizen",children:s.jsx("p",{className:"whitespace-pre-wrap text-gray-700",children:l.notes})})]})]})}const Lx={INTERIM:"Zwischenrechnung",FINAL:"Schlussrechnung",NOT_AVAILABLE:"Nicht verfügbar"};function Xk({ecdId:e,invoices:t,contractId:n,canEdit:r}){const[a,i]=j.useState(!1),[l,o]=j.useState(!1),[c,d]=j.useState(null),u=ge(),h=G({mutationFn:p=>aa.deleteInvoice(e,p),onSuccess:()=>{u.invalidateQueries({queryKey:["contract",n.toString()]})}}),x=[...t].sort((p,b)=>new Date(b.invoiceDate).getTime()-new Date(p.invoiceDate).getTime()),m=t.some(p=>p.invoiceType==="FINAL"),f=t.some(p=>p.invoiceType==="NOT_AVAILABLE");return s.jsxs("div",{className:"mt-4 pt-4 border-t",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ke,{className:"w-4 h-4 text-gray-500"}),s.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Rechnungen"}),s.jsx(ve,{variant:"default",children:t.length}),m?s.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 text-xs rounded-full bg-green-100 text-green-800",children:[s.jsx(xr,{className:"w-3 h-3"}),"Schlussrechnung"]}):f?s.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 text-xs rounded-full bg-yellow-100 text-yellow-800",children:[s.jsx(hs,{className:"w-3 h-3"}),"Nicht verfügbar"]}):t.length>0?s.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 text-xs rounded-full bg-orange-100 text-orange-800",children:[s.jsx(hs,{className:"w-3 h-3"}),"Schlussrechnung fehlt"]}):null]}),s.jsxs("div",{className:"flex items-center gap-2",children:[r&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>o(!0),children:s.jsx(Ue,{className:"w-4 h-4"})}),t.length>0&&s.jsx("button",{onClick:()=>i(!a),className:"text-gray-500 hover:text-gray-700",children:a?s.jsx(ih,{className:"w-4 h-4"}):s.jsx(Rn,{className:"w-4 h-4"})})]})]}),!a&&x.length>0&&s.jsxs("div",{className:"text-sm text-gray-600",children:["Letzte: ",new Date(x[0].invoiceDate).toLocaleDateString("de-DE")," - ",Lx[x[0].invoiceType]]}),a&&x.length>0&&s.jsx("div",{className:"space-y-2",children:x.map(p=>s.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg group",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium",children:new Date(p.invoiceDate).toLocaleDateString("de-DE")}),s.jsx("div",{className:"text-xs text-gray-500",children:Lx[p.invoiceType]})]}),p.documentPath&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("a",{href:`/api${p.documentPath}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-blue-600 hover:text-blue-800 text-sm",title:"Anzeigen",children:s.jsx(Pe,{className:"w-4 h-4"})}),s.jsx("a",{href:`/api${p.documentPath}`,download:!0,className:"flex items-center gap-1 text-blue-600 hover:text-blue-800 text-sm",title:"Download",children:s.jsx(As,{className:"w-4 h-4"})})]}),p.notes&&s.jsx("span",{className:"text-xs text-gray-400 italic",children:p.notes})]}),r&&s.jsxs("div",{className:"flex items-center gap-2 opacity-0 group-hover:opacity-100",children:[s.jsx("button",{onClick:()=>d(p),className:"text-gray-500 hover:text-blue-600",title:"Bearbeiten",children:s.jsx(Je,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{confirm("Rechnung wirklich löschen?")&&h.mutate(p.id)},className:"text-gray-500 hover:text-red-600",title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4"})})]})]},p.id))}),a&&x.length===0&&s.jsx("p",{className:"text-sm text-gray-500 italic",children:"Keine Rechnungen vorhanden."}),(l||c)&&s.jsx(Yk,{isOpen:!0,onClose:()=>{o(!1),d(null)},ecdId:e,contractId:n,invoice:c})]})}function Yk({isOpen:e,onClose:t,ecdId:n,contractId:r,invoice:a}){const i=ge(),l=!!a,o=j.useRef(null),[c,d]=j.useState({invoiceDate:a!=null&&a.invoiceDate?new Date(a.invoiceDate).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],invoiceType:(a==null?void 0:a.invoiceType)||"INTERIM",notes:(a==null?void 0:a.notes)||""}),[u,h]=j.useState(null),[x,m]=j.useState(null),f=G({mutationFn:async N=>{var A;const E=await aa.addInvoice(n,{invoiceDate:c.invoiceDate,invoiceType:c.invoiceType,notes:c.notes||void 0});return(A=E.data)!=null&&A.id&&await aa.uploadDocument(E.data.id,N),E},onSuccess:()=>{i.invalidateQueries({queryKey:["contract",r.toString()]}),t()},onError:N=>{m(N.message)}}),p=G({mutationFn:async()=>await aa.addInvoice(n,{invoiceDate:c.invoiceDate,invoiceType:c.invoiceType,notes:c.notes||void 0}),onSuccess:()=>{i.invalidateQueries({queryKey:["contract",r.toString()]}),t()},onError:N=>{m(N.message)}}),b=G({mutationFn:async N=>{const E=await aa.updateInvoice(n,a.id,{invoiceDate:c.invoiceDate,invoiceType:c.invoiceType,notes:c.notes||void 0});return N&&await aa.uploadDocument(a.id,N),E},onSuccess:()=>{i.invalidateQueries({queryKey:["contract",r.toString()]}),t()},onError:N=>{m(N.message)}}),g=N=>{if(N.preventDefault(),m(null),l){if(c.invoiceType!=="NOT_AVAILABLE"&&!(a!=null&&a.documentPath)&&!u){m("Bitte laden Sie ein Dokument hoch");return}b.mutate(u)}else if(c.invoiceType==="NOT_AVAILABLE")p.mutate();else if(u)f.mutate(u);else{m("Bitte laden Sie ein Dokument hoch");return}},y=N=>{var A;const E=(A=N.target.files)==null?void 0:A[0];if(E){if(E.type!=="application/pdf"){m("Nur PDF-Dateien sind erlaubt");return}if(E.size>10*1024*1024){m("Datei ist zu groß (max. 10 MB)");return}h(E),m(null)}},v=f.isPending||p.isPending||b.isPending;return s.jsx(Ve,{isOpen:e,onClose:t,title:l?"Rechnung bearbeiten":"Rechnung hinzufügen",children:s.jsxs("form",{onSubmit:g,className:"space-y-4",children:[x&&s.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm",children:x}),s.jsx(H,{label:"Rechnungsdatum",type:"date",value:c.invoiceDate,onChange:N=>d({...c,invoiceDate:N.target.value}),required:!0}),s.jsx(Ie,{label:"Rechnungstyp",value:c.invoiceType,onChange:N=>d({...c,invoiceType:N.target.value}),options:[{value:"INTERIM",label:"Zwischenrechnung"},{value:"FINAL",label:"Schlussrechnung"},{value:"NOT_AVAILABLE",label:"Nicht verfügbar"}]}),c.invoiceType!=="NOT_AVAILABLE"&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Dokument (PDF) *"}),(a==null?void 0:a.documentPath)&&!u&&s.jsxs("div",{className:"mb-2 text-sm text-green-600 flex items-center gap-1",children:[s.jsx(xr,{className:"w-4 h-4"}),"Dokument vorhanden"]}),u&&s.jsxs("div",{className:"mb-2 text-sm text-blue-600 flex items-center gap-1",children:[s.jsx(Ke,{className:"w-4 h-4"}),u.name]}),s.jsx("input",{type:"file",ref:o,accept:".pdf",onChange:y,className:"hidden"}),s.jsx(T,{type:"button",variant:"secondary",onClick:()=>{var N;return(N=o.current)==null?void 0:N.click()},children:a!=null&&a.documentPath||u?"Ersetzen":"PDF hochladen"})]}),c.invoiceType==="NOT_AVAILABLE"&&s.jsx("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg text-yellow-800 text-sm",children:'Bei diesem Typ wird kein Dokument benötigt. Die Rechnung wird als "nicht mehr zu bekommen" markiert.'}),s.jsx(H,{label:"Notizen (optional)",value:c.notes,onChange:N=>d({...c,notes:N.target.value}),placeholder:"Optionale Anmerkungen..."}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:v,children:v?"Wird gespeichert...":l?"Speichern":"Hinzufügen"})]})]})})}const eC=10.5;function Ox(e,t){const n=new Date(e),r=new Date(t);n.setHours(0,0,0,0),r.setHours(0,0,0,0);const a=r.getTime()-n.getTime();return Math.ceil(a/(1e3*60*60*24))}function tC(e,t,n){const r=new Date(t),a=new Date(n);return r.setHours(0,0,0,0),a.setHours(0,0,0,0),e.filter(i=>{const l=new Date(i.readingDate);return l.setHours(0,0,0,0),l>=r&&l<=a})}function sC(e,t,n,r){const a=tC(e,t,n);if(a.length===0)return{type:"none",consumptionKwh:0};if(a.length===1)return{type:"insufficient",consumptionKwh:0,message:"Berechnung auf Grund fehlender Stände nicht möglich"};const i=[...a].sort((f,p)=>new Date(f.readingDate).getTime()-new Date(p.readingDate).getTime()),l=i[0],o=i[i.length-1],c=new Date(o.readingDate),d=new Date(n);if(c.setHours(0,0,0,0),d.setHours(0,0,0,0),c>=d){const f=o.value-l.value;return zx("exact",f,r,l,o)}const u=Ox(l.readingDate,o.readingDate);if(u<1)return{type:"insufficient",consumptionKwh:0,message:"Zeitraum zwischen Zählerständen zu kurz für Berechnung"};const h=Ox(t,n),m=(o.value-l.value)/u*h;return zx("projected",m,r,l,o,n)}function zx(e,t,n,r,a,i){return n==="GAS"?{type:e,consumptionM3:t,consumptionKwh:t*eC,startReading:r,endReading:a,projectedEndDate:i}:{type:e,consumptionKwh:t,startReading:r,endReading:a,projectedEndDate:i}}function nC(e,t,n,r){if(t==null&&n==null)return null;const a=(t??0)*12,i=e*(n??0),l=a+i,o=l-(r??0),c=o/12;return{annualBaseCost:a,annualConsumptionCost:i,annualTotalCost:l,monthlyPayment:c,bonus:r??void 0,effectiveAnnualCost:o}}const rC={ELECTRICITY:"Strom",GAS:"Gas",DSL:"DSL",CABLE:"Kabelinternet",FIBER:"Glasfaser",MOBILE:"Mobilfunk",TV:"TV",CAR_INSURANCE:"KFZ-Versicherung"},aC={DRAFT:"Entwurf",PENDING:"Ausstehend",ACTIVE:"Aktiv",CANCELLED:"Gekündigt",EXPIRED:"Abgelaufen",DEACTIVATED:"Deaktiviert"},iC={ACTIVE:"success",PENDING:"warning",CANCELLED:"danger",EXPIRED:"danger",DRAFT:"default",DEACTIVATED:"default"},lC=[{status:"DRAFT",label:"Entwurf",description:"Vertrag wird noch vorbereitet",color:"text-gray-600"},{status:"PENDING",label:"Ausstehend",description:"Wartet auf Aktivierung",color:"text-yellow-600"},{status:"ACTIVE",label:"Aktiv",description:"Vertrag läuft normal",color:"text-green-600"},{status:"EXPIRED",label:"Abgelaufen",description:"Laufzeit vorbei, läuft aber ohne Kündigung weiter",color:"text-orange-600"},{status:"CANCELLED",label:"Gekündigt",description:"Aktive Kündigung eingereicht, Vertrag endet",color:"text-red-600"},{status:"DEACTIVATED",label:"Deaktiviert",description:"Manuell beendet/archiviert",color:"text-gray-500"}];function oC({isOpen:e,onClose:t}){return e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[s.jsx("div",{className:"fixed inset-0 bg-black/20",onClick:t}),s.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl p-4 max-w-sm w-full mx-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Vertragsstatus-Übersicht"}),s.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600",children:s.jsx(qt,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"space-y-2",children:lC.map(({status:n,label:r,description:a,color:i})=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:`font-medium text-sm min-w-[90px] ${i}`,children:r}),s.jsx("span",{className:"text-sm text-gray-600",children:a})]},n))})]})]}):null}function cC(e){const t=e.match(/^(\d+)([TMWJ])$/);if(!t)return!1;const n=parseInt(t[1]),r=t[2];let a=0;return r==="T"?a=n:r==="W"?a=n*7:r==="M"?a=n*30:r==="J"&&(a=n*365),a<=30}function dC({simCard:e}){const[t,n]=j.useState(!1),[r,a]=j.useState(null),[i,l]=j.useState(!1),o=async()=>{if(t)n(!1),a(null);else{l(!0);try{const c=await Oe.getSimCardCredentials(e.id);c.data&&(a(c.data),n(!0))}catch{alert("PIN/PUK konnte nicht geladen werden")}finally{l(!1)}}};return s.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg border",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.isMain&&s.jsx(ve,{variant:"success",children:"Hauptkarte"}),e.isMultisim&&s.jsx(ve,{variant:"warning",children:"Multisim"})]}),s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 text-sm",children:[e.phoneNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"Rufnummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[e.phoneNumber,s.jsx(oe,{value:e.phoneNumber})]})]}),e.simCardNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"SIM-Nr."}),s.jsxs("dd",{className:"font-mono text-xs flex items-center gap-1",children:[e.simCardNumber,s.jsx(oe,{value:e.simCardNumber})]})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"PIN"}),s.jsx("dd",{className:"font-mono flex items-center gap-1",children:t&&(r!=null&&r.pin)?s.jsxs(s.Fragment,{children:[r.pin,s.jsx(oe,{value:r.pin})]}):"••••"})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"PUK"}),s.jsx("dd",{className:"font-mono flex items-center gap-1",children:t&&(r!=null&&r.puk)?s.jsxs(s.Fragment,{children:[r.puk,s.jsx(oe,{value:r.puk})]}):"••••••••"})]})]}),s.jsx("div",{className:"mt-2",children:s.jsx(T,{variant:"ghost",size:"sm",onClick:o,disabled:i,children:i?"Laden...":t?s.jsxs(s.Fragment,{children:[s.jsx(It,{className:"w-4 h-4 mr-1"})," PIN/PUK verbergen"]}):s.jsxs(s.Fragment,{children:[s.jsx(Pe,{className:"w-4 h-4 mr-1"})," PIN/PUK anzeigen"]})})})]})}function uC({meterId:e,meterType:t,readings:n,contractId:r,canEdit:a}){const[i,l]=j.useState(!1),[o,c]=j.useState(!1),[d,u]=j.useState(null),h=ge(),x=G({mutationFn:p=>ln.deleteReading(e,p),onSuccess:()=>{h.invalidateQueries({queryKey:["contract",r.toString()]})}}),m=[...n].sort((p,b)=>new Date(b.readingDate).getTime()-new Date(p.readingDate).getTime()),f=t==="ELECTRICITY"?"kWh":"m³";return s.jsxs("div",{className:"mt-4 pt-4 border-t",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ev,{className:"w-4 h-4 text-gray-500"}),s.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Zählerstände"}),s.jsx(ve,{variant:"default",children:n.length})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[a&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>c(!0),title:"Zählerstand erfassen",children:s.jsx(Ue,{className:"w-4 h-4"})}),n.length>0&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>l(!i),children:i?s.jsx(ih,{className:"w-4 h-4"}):s.jsx(Rn,{className:"w-4 h-4"})})]})]}),i&&n.length>0&&s.jsx("div",{className:"space-y-2 bg-gray-50 rounded-lg p-3",children:m.map(p=>s.jsxs("div",{className:"flex justify-between items-center text-sm group py-1 border-b border-gray-200 last:border-0",children:[s.jsxs("span",{className:"text-gray-500 flex items-center gap-1",children:[new Date(p.readingDate).toLocaleDateString("de-DE"),s.jsx(oe,{value:new Date(p.readingDate).toLocaleDateString("de-DE")})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"font-mono flex items-center gap-1",children:[p.value.toLocaleString("de-DE")," ",p.unit,s.jsx(oe,{value:p.value.toString(),title:"Nur Wert kopieren"})]}),a&&s.jsxs("div",{className:"opacity-0 group-hover:opacity-100 flex gap-1",children:[s.jsx("button",{onClick:()=>u(p),className:"text-gray-400 hover:text-blue-600",title:"Bearbeiten",children:s.jsx(Je,{className:"w-3 h-3"})}),s.jsx("button",{onClick:()=>{confirm("Zählerstand wirklich löschen?")&&x.mutate(p.id)},className:"text-gray-400 hover:text-red-600",title:"Löschen",children:s.jsx(Ne,{className:"w-3 h-3"})})]})]})]},p.id))}),!i&&n.length>0&&s.jsxs("p",{className:"text-sm text-gray-500",children:["Letzter Stand: ",m[0].value.toLocaleString("de-DE")," ",m[0].unit," (",new Date(m[0].readingDate).toLocaleDateString("de-DE"),")"]}),n.length===0&&s.jsx("p",{className:"text-sm text-gray-500",children:"Keine Zählerstände vorhanden."}),(o||d)&&s.jsx(mC,{isOpen:!0,onClose:()=>{c(!1),u(null)},meterId:e,contractId:r,reading:d,defaultUnit:f})]})}function mC({isOpen:e,onClose:t,meterId:n,contractId:r,reading:a,defaultUnit:i}){var f;const l=ge(),o=!!a,[c,d]=j.useState({readingDate:a!=null&&a.readingDate?new Date(a.readingDate).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],value:((f=a==null?void 0:a.value)==null?void 0:f.toString())||"",notes:(a==null?void 0:a.notes)||""}),u=G({mutationFn:p=>ln.addReading(n,p),onSuccess:()=>{l.invalidateQueries({queryKey:["contract",r.toString()]}),t()}}),h=G({mutationFn:p=>ln.updateReading(n,a.id,p),onSuccess:()=>{l.invalidateQueries({queryKey:["contract",r.toString()]}),t()}}),x=p=>{p.preventDefault();const b={readingDate:new Date(c.readingDate),value:parseFloat(c.value),unit:i,notes:c.notes||void 0};o?h.mutate(b):u.mutate(b)},m=u.isPending||h.isPending;return s.jsx(Ve,{isOpen:e,onClose:t,title:o?"Zählerstand bearbeiten":"Zählerstand erfassen",children:s.jsxs("form",{onSubmit:x,className:"space-y-4",children:[s.jsx(H,{label:"Ablesedatum",type:"date",value:c.readingDate,onChange:p=>d({...c,readingDate:p.target.value}),required:!0}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsx("div",{className:"col-span-2",children:s.jsx(H,{label:"Zählerstand",type:"number",step:"0.01",value:c.value,onChange:p=>d({...c,value:p.target.value}),required:!0})}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Einheit"}),s.jsx("div",{className:"h-10 flex items-center px-3 bg-gray-100 border border-gray-300 rounded-md text-gray-700",children:i})]})]}),s.jsx(H,{label:"Notizen (optional)",value:c.notes,onChange:p=>d({...c,notes:p.target.value})}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:m||!c.value,children:m?"Speichern...":o?"Speichern":"Erfassen"})]})]})})}function hC({contractType:e,readings:t,startDate:n,endDate:r,basePrice:a,unitPrice:i,bonus:l}){const o=sC(t,n,r,e),c=o.consumptionKwh>0?nC(o.consumptionKwh,a,i,l):null;if(o.type==="none")return null;const d=(h,x=2)=>h.toLocaleString("de-DE",{minimumFractionDigits:x,maximumFractionDigits:x}),u=h=>new Date(h).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"});return s.jsxs("div",{className:"mt-4 pt-4 border-t",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(P2,{className:"w-4 h-4 text-gray-500"}),s.jsx("h4",{className:"text-sm font-medium text-gray-700",children:"Verbrauch & Kosten"}),o.type==="exact"&&s.jsx(ve,{variant:"success",children:"Exakt"}),o.type==="projected"&&s.jsx(ve,{variant:"warning",children:"Hochrechnung"})]}),o.type==="insufficient"?s.jsx("p",{className:"text-sm text-gray-500 italic",children:o.message}):s.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 space-y-4",children:[s.jsxs("div",{children:[s.jsxs("h5",{className:"text-sm font-medium text-gray-600 mb-2",children:["Berechneter Verbrauch",o.type==="projected"&&" (hochgerechnet)"]}),s.jsx("div",{className:"text-lg font-semibold text-gray-900",children:e==="GAS"?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"font-mono",children:[d(o.consumptionM3||0)," m³"]}),s.jsxs("span",{className:"text-gray-500 text-sm ml-2",children:["= ",d(o.consumptionKwh)," kWh"]})]}):s.jsxs("span",{className:"font-mono",children:[d(o.consumptionKwh)," kWh"]})}),o.startReading&&o.endReading&&s.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["Basierend auf Zählerständen vom ",u(o.startReading.readingDate)," bis ",u(o.endReading.readingDate)]})]}),c&&s.jsxs("div",{className:"border-t border-gray-200 pt-4",children:[s.jsx("h5",{className:"text-sm font-medium text-gray-600 mb-3",children:"Kostenvorschau"}),s.jsxs("div",{className:"space-y-2 text-sm",children:[a!=null&&a>0&&s.jsxs("div",{className:"flex justify-between",children:[s.jsxs("span",{className:"text-gray-600",children:["Grundpreis: ",d(a)," €/Mon × 12"]}),s.jsxs("span",{className:"font-mono",children:[d(c.annualBaseCost)," €"]})]}),i!=null&&i>0&&s.jsxs("div",{className:"flex justify-between",children:[s.jsxs("span",{className:"text-gray-600",children:["Arbeitspreis: ",d(o.consumptionKwh)," kWh × ",d(i,4)," €"]}),s.jsxs("span",{className:"font-mono",children:[d(c.annualConsumptionCost)," €"]})]}),s.jsx("div",{className:"border-t border-gray-300 pt-2",children:s.jsxs("div",{className:"flex justify-between font-medium",children:[s.jsx("span",{className:"text-gray-700",children:"Jahreskosten"}),s.jsxs("span",{className:"font-mono",children:[d(c.annualTotalCost)," €"]})]})}),c.bonus!=null&&c.bonus>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex justify-between text-green-600",children:[s.jsx("span",{children:"Bonus"}),s.jsxs("span",{className:"font-mono",children:["- ",d(c.bonus)," €"]})]}),s.jsx("div",{className:"border-t border-gray-300 pt-2",children:s.jsxs("div",{className:"flex justify-between font-semibold",children:[s.jsx("span",{className:"text-gray-800",children:"Effektive Jahreskosten"}),s.jsxs("span",{className:"font-mono",children:[d(c.effectiveAnnualCost)," €"]})]})})]}),s.jsx("div",{className:"border-t border-gray-300 pt-2 mt-2",children:s.jsxs("div",{className:"flex justify-between text-blue-700 font-semibold",children:[s.jsx("span",{children:"Monatlicher Abschlag"}),s.jsxs("span",{className:"font-mono",children:[d(c.monthlyPayment)," €"]})]})})]})]})]})]})}function $x({task:e,contractId:t,canEdit:n,isCustomerPortal:r,isCompleted:a,onEdit:i}){const[l,o]=j.useState(""),[c,d]=j.useState(!1),[u,h]=j.useState(null),[x,m]=j.useState(""),f=ge(),p=G({mutationFn:K=>et.complete(K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]})}}),b=G({mutationFn:K=>et.reopen(K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]})}}),g=G({mutationFn:K=>et.delete(K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]})}}),y=G({mutationFn:K=>et.createSubtask(e.id,K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]}),o(""),d(!1)},onError:K=>{console.error("Fehler beim Erstellen der Unteraufgabe:",K),alert("Fehler beim Erstellen der Unteraufgabe. Bitte versuchen Sie es erneut.")}}),v=G({mutationFn:K=>et.createReply(e.id,K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]}),o(""),d(!1)},onError:K=>{console.error("Fehler beim Erstellen der Antwort:",K),alert("Fehler beim Erstellen der Antwort. Bitte versuchen Sie es erneut.")}}),N=G({mutationFn:({id:K,title:B})=>et.updateSubtask(K,B),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]}),h(null),m("")}}),E=G({mutationFn:K=>et.completeSubtask(K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]})}}),A=G({mutationFn:K=>et.reopenSubtask(K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]})}}),I=G({mutationFn:K=>et.deleteSubtask(K),onSuccess:async()=>{await f.refetchQueries({queryKey:["contract-tasks",t]})}}),w=K=>{K.preventDefault(),l.trim()&&(r?v.mutate(l.trim()):y.mutate(l.trim()))},S=K=>{K.preventDefault(),x.trim()&&u&&N.mutate({id:u,title:x.trim()})},P=(K,B)=>{h(K),m(B)},O=()=>{h(null),m("")},R=e.subtasks||[],q=R.filter(K=>K.status==="OPEN"),D=R.filter(K=>K.status==="COMPLETED"),z=r?{singular:"Antwort",placeholder:"Antwort...",deleteConfirm:"Antwort löschen?"}:{singular:"Unteraufgabe",placeholder:"Unteraufgabe...",deleteConfirm:"Unteraufgabe löschen?"},k=(K,B)=>u===K.id?s.jsx("div",{className:"py-1",children:s.jsxs("form",{onSubmit:S,className:"flex items-center gap-2",children:[s.jsx(No,{className:"w-4 h-4 text-gray-300 flex-shrink-0"}),s.jsx("input",{type:"text",value:x,onChange:Q=>m(Q.target.value),className:"flex-1 text-sm px-2 py-1 border rounded focus:outline-none focus:ring-1 focus:ring-blue-500",autoFocus:!0}),s.jsx(T,{type:"submit",size:"sm",disabled:!x.trim()||N.isPending,children:"✓"}),s.jsx(T,{type:"button",variant:"ghost",size:"sm",onClick:O,children:"×"})]})},K.id):s.jsx("div",{className:`py-1 group/subtask ${B?"opacity-60":""}`,children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("button",{onClick:()=>B?A.mutate(K.id):E.mutate(K.id),disabled:E.isPending||A.isPending||r,className:`flex-shrink-0 mt-0.5 ${r?"cursor-default":B?"hover:text-yellow-600":"hover:text-green-600"}`,children:B?s.jsx(Ps,{className:"w-4 h-4 text-green-500"}):s.jsx(No,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:`text-sm ${B?"line-through text-gray-500":""}`,children:K.title}),n&&!r&&!B&&s.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 group-hover/subtask:opacity-100",children:[s.jsx("button",{onClick:()=>P(K.id,K.title),className:"text-gray-400 hover:text-blue-600 p-0.5",title:"Bearbeiten",children:s.jsx(Je,{className:"w-3 h-3"})}),s.jsx("button",{onClick:()=>{confirm(z.deleteConfirm)&&I.mutate(K.id)},className:"text-gray-400 hover:text-red-600 p-0.5",title:"Löschen",children:s.jsx(Ne,{className:"w-3 h-3"})})]}),n&&!r&&B&&s.jsx("button",{onClick:()=>{confirm(z.deleteConfirm)&&I.mutate(K.id)},className:"text-gray-400 hover:text-red-600 p-0.5 opacity-0 group-hover/subtask:opacity-100",title:"Löschen",children:s.jsx(Ne,{className:"w-3 h-3"})})]}),s.jsxs("p",{className:"text-xs text-gray-400",children:[K.createdBy&&`${K.createdBy} • `,B?`Erledigt am ${K.completedAt?new Date(K.completedAt).toLocaleDateString("de-DE"):new Date(K.updatedAt).toLocaleDateString("de-DE")}`:new Date(K.createdAt).toLocaleDateString("de-DE")]})]})]})},K.id);return s.jsx("div",{className:`p-3 bg-gray-50 rounded-lg group ${a?"bg-gray-50/50 opacity-70":""}`,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("button",{onClick:()=>a?b.mutate(e.id):p.mutate(e.id),disabled:p.isPending||b.isPending||r,className:`mt-0.5 flex-shrink-0 ${r?"cursor-default":a?"hover:text-yellow-600":"hover:text-green-600"}`,title:r?void 0:a?"Wieder öffnen":"Als erledigt markieren",children:a?s.jsx(Ps,{className:"w-5 h-5 text-green-500"}):s.jsx(No,{className:"w-5 h-5 text-gray-400"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`font-medium ${a?"line-through text-gray-500":""}`,children:e.title}),e.visibleInPortal&&s.jsx(ve,{variant:"default",className:"text-xs",children:"Portal"}),R.length>0&&s.jsxs("span",{className:"text-xs text-gray-400",children:["(",D.length,"/",R.length,")"]})]}),e.description&&s.jsx("p",{className:`text-sm mt-1 whitespace-pre-wrap ${a?"text-gray-500":"text-gray-600"}`,children:e.description}),s.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:[e.createdBy&&`${e.createdBy} • `,a?`Erledigt am ${e.completedAt?new Date(e.completedAt).toLocaleDateString("de-DE"):"-"}`:new Date(e.createdAt).toLocaleDateString("de-DE")]}),R.length>0&&s.jsxs("div",{className:"mt-3 ml-2 space-y-0 border-l-2 border-gray-200 pl-3",children:[q.map(K=>k(K,!1)),D.map(K=>k(K,!0))]}),!a&&(n&&!r||r)&&s.jsx("div",{className:"mt-2 ml-2",children:c?s.jsxs("form",{onSubmit:w,className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",value:l,onChange:K=>o(K.target.value),placeholder:z.placeholder,className:"flex-1 text-sm px-2 py-1 border rounded focus:outline-none focus:ring-1 focus:ring-blue-500",autoFocus:!0}),s.jsx(T,{type:"submit",size:"sm",disabled:!l.trim()||y.isPending||v.isPending,children:s.jsx(Ue,{className:"w-3 h-3"})}),s.jsx(T,{type:"button",variant:"ghost",size:"sm",onClick:()=>{d(!1),o("")},children:"×"})]}):s.jsxs("button",{onClick:()=>d(!0),className:"text-xs text-gray-400 hover:text-blue-600 flex items-center gap-1",children:[s.jsx(Ue,{className:"w-3 h-3"}),z.singular]})})]}),n&&!r&&s.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100",children:[!a&&s.jsx("button",{onClick:i,className:"text-gray-400 hover:text-blue-600 p-1",title:"Bearbeiten",children:s.jsx(Je,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{confirm("Aufgabe wirklich löschen?")&&g.mutate(e.id)},className:"text-gray-400 hover:text-red-600 p-1",title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4"})})]})]})})}function fC({contractId:e,canEdit:t,isCustomerPortal:n}){var v;const[r,a]=j.useState(!1),[i,l]=j.useState(null),{data:o,isLoading:c}=fe({queryKey:["contract-tasks",e],queryFn:()=>et.getByContract(e),staleTime:0,gcTime:0,refetchOnMount:"always"}),{data:d,isLoading:u}=fe({queryKey:["app-settings-public"],queryFn:()=>Xr.getPublic(),enabled:n,staleTime:0}),h=!u&&((v=d==null?void 0:d.data)==null?void 0:v.customerSupportTicketsEnabled)==="true",x=(o==null?void 0:o.data)||[],m=x.filter(N=>N.status==="OPEN"),f=x.filter(N=>N.status==="COMPLETED"),p=n?{title:"Support-Anfragen",button:"Anfrage erstellen",empty:"Keine Support-Anfragen vorhanden."}:{title:"Aufgaben",button:"Aufgabe",empty:"Keine Aufgaben vorhanden."},b=n?dl:cl;if(c||n&&u)return s.jsx(X,{className:"mb-6",title:p.title,children:s.jsx("div",{className:"text-center py-4 text-gray-500",children:"Laden..."})});const y=t&&!n||n&&h;return s.jsxs(X,{className:"mb-6",title:p.title,children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(b,{className:"w-5 h-5 text-gray-500"}),s.jsxs("span",{className:"text-sm text-gray-600",children:[m.length," offen, ",f.length," erledigt"]})]}),y&&s.jsxs(T,{size:"sm",onClick:()=>a(!0),children:[s.jsx(Ue,{className:"w-4 h-4 mr-1"}),p.button]})]}),x.length===0?s.jsx("p",{className:"text-center py-4 text-gray-500",children:p.empty}):s.jsxs("div",{className:"space-y-2",children:[m.map(N=>s.jsx($x,{task:N,contractId:e,canEdit:t,isCustomerPortal:n,isCompleted:!1,onEdit:()=>l(N)},N.id)),f.length>0&&m.length>0&&s.jsx("div",{className:"border-t my-3"}),f.map(N=>s.jsx($x,{task:N,contractId:e,canEdit:t,isCustomerPortal:n,isCompleted:!0,onEdit:()=>{}},N.id))]}),(r||i)&&s.jsx(pC,{isOpen:!0,onClose:()=>{a(!1),l(null)},contractId:e,task:i,isCustomerPortal:n})]})}function pC({isOpen:e,onClose:t,contractId:n,task:r,isCustomerPortal:a=!1}){const i=ge(),l=!!r,[o,c]=j.useState({title:(r==null?void 0:r.title)||"",description:(r==null?void 0:r.description)||"",visibleInPortal:(r==null?void 0:r.visibleInPortal)||!1});j.useEffect(()=>{e&&c({title:(r==null?void 0:r.title)||"",description:(r==null?void 0:r.description)||"",visibleInPortal:(r==null?void 0:r.visibleInPortal)||!1})},[e,r]);const d=G({mutationFn:p=>et.create(n,p),onSuccess:async()=>{await i.refetchQueries({queryKey:["contract-tasks",n]}),t()}}),u=G({mutationFn:p=>et.createSupportTicket(n,p),onSuccess:async()=>{await i.refetchQueries({queryKey:["contract-tasks",n]}),t()}}),h=G({mutationFn:p=>et.update(r.id,p),onSuccess:async()=>{await i.refetchQueries({queryKey:["contract-tasks",n]}),t()}}),x=p=>{p.preventDefault(),l?h.mutate({title:o.title,description:o.description||void 0,visibleInPortal:o.visibleInPortal}):a?u.mutate({title:o.title,description:o.description||void 0}):d.mutate({title:o.title,description:o.description||void 0,visibleInPortal:o.visibleInPortal})},m=d.isPending||u.isPending||h.isPending,f=a?{modalTitle:l?"Anfrage bearbeiten":"Neue Support-Anfrage",titleLabel:"Betreff",titlePlaceholder:"Kurze Beschreibung Ihrer Anfrage",descLabel:"Ihre Nachricht",descPlaceholder:"Beschreiben Sie Ihr Anliegen...",submitBtn:l?"Speichern":"Anfrage senden"}:{modalTitle:l?"Aufgabe bearbeiten":"Neue Aufgabe",titleLabel:"Titel",titlePlaceholder:"Kurze Beschreibung der Aufgabe",descLabel:"Beschreibung (optional)",descPlaceholder:"Details zur Aufgabe...",submitBtn:l?"Speichern":"Erstellen"};return s.jsx(Ve,{isOpen:e,onClose:t,title:f.modalTitle,children:s.jsxs("form",{onSubmit:x,className:"space-y-4",children:[s.jsx(H,{label:f.titleLabel,value:o.title,onChange:p=>c({...o,title:p.target.value}),required:!0,placeholder:f.titlePlaceholder}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:f.descLabel}),s.jsx("textarea",{value:o.description,onChange:p=>c({...o,description:p.target.value}),className:"w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",rows:a?5:3,placeholder:f.descPlaceholder})]}),!a&&s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.visibleInPortal,onChange:p=>c({...o,visibleInPortal:p.target.checked}),className:"w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),s.jsx("span",{className:"text-sm text-gray-700",children:"Im Kundenportal sichtbar"})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:m||!o.title.trim(),children:m?"Speichern...":f.submitBtn})]})]})})}function xC(){var nt,es,Vt,ae,We,xt;const{id:e}=bc(),t=Yt(),r=In().state,a=ge(),{hasPermission:i,isCustomer:l,isCustomerPortal:o}=He(),c=parseInt(e),[d,u]=j.useState(!1),[h,x]=j.useState(null),[m,f]=j.useState(!1),[p,b]=j.useState(!1),[g,y]=j.useState(null),[v,N]=j.useState({}),[E,A]=j.useState({}),[I,w]=j.useState(!1),[S,P]=j.useState(!1),[O,R]=j.useState(!1),[q,D]=j.useState(!1),{data:z,isLoading:k}=fe({queryKey:["contract",e],queryFn:()=>Oe.getById(c)}),K=G({mutationFn:()=>Oe.delete(c),onSuccess:()=>{t("/contracts")}}),B=G({mutationFn:()=>Oe.createFollowUp(c),onSuccess:Z=>{Z.data?t(`/contracts/${Z.data.id}/edit`):alert("Folgevertrag wurde erstellt, aber keine ID zurückgegeben")},onError:Z=>{console.error("Folgevertrag Fehler:",Z),alert(`Fehler beim Erstellen des Folgevertrags: ${Z instanceof Error?Z.message:"Unbekannter Fehler"}`)}}),_=G({mutationFn:()=>Oe.snooze(c,{}),onSuccess:()=>{a.invalidateQueries({queryKey:["contract",e]}),a.invalidateQueries({queryKey:["contract-cockpit"]}),D(!1)},onError:Z=>{console.error("Un-Snooze Fehler:",Z),alert(`Fehler beim Aufheben der Zurückstellung: ${Z instanceof Error?Z.message:"Unbekannter Fehler"}`)}}),Q=G({mutationFn:Z=>{const Xe={cancellationConfirmationDate:Z?new Date(Z).toISOString():null};return Oe.update(c,Xe)},onSuccess:()=>{a.invalidateQueries({queryKey:["contract",e]}),a.invalidateQueries({queryKey:["contract-cockpit"]})},onError:Z=>{console.error("Fehler beim Speichern des Datums:",Z),alert("Fehler beim Speichern des Datums")}}),le=G({mutationFn:Z=>{const Xe={cancellationConfirmationOptionsDate:Z?new Date(Z).toISOString():null};return Oe.update(c,Xe)},onSuccess:()=>{a.invalidateQueries({queryKey:["contract",e]}),a.invalidateQueries({queryKey:["contract-cockpit"]})},onError:Z=>{console.error("Fehler beim Speichern des Datums:",Z),alert("Fehler beim Speichern des Datums")}}),de=async()=>{var Z;if(d)u(!1),x(null);else try{const Fe=await Oe.getPassword(c);(Z=Fe.data)!=null&&Z.password&&(x(Fe.data.password),u(!0))}catch{alert("Passwort konnte nicht entschlüsselt werden")}},_e=async()=>{var Z;if(p)b(!1),y(null);else try{const Fe=await Oe.getInternetCredentials(c);(Z=Fe.data)!=null&&Z.password&&(y(Fe.data.password),b(!0))}catch{alert("Internet-Passwort konnte nicht entschlüsselt werden")}},qe=async Z=>{var Fe;if(v[Z])N(Xe=>({...Xe,[Z]:!1})),A(Xe=>({...Xe,[Z]:null}));else try{const J=(Fe=(await Oe.getSipCredentials(Z)).data)==null?void 0:Fe.password;J&&(A(ue=>({...ue,[Z]:J})),N(ue=>({...ue,[Z]:!0})))}catch{alert("SIP-Passwort konnte nicht entschlüsselt werden")}},st=async()=>{var Xe,J,ue;const Z=z==null?void 0:z.data,Fe=((Xe=Z==null?void 0:Z.stressfreiEmail)==null?void 0:Xe.email)||(Z==null?void 0:Z.portalUsername);if(!((J=Z==null?void 0:Z.provider)!=null&&J.portalUrl)||!Fe){alert("Portal-URL oder Benutzername fehlt");return}f(!0);try{const ts=await Oe.getPassword(c);if(!((ue=ts.data)!=null&&ue.password)){alert("Passwort konnte nicht entschlüsselt werden");return}const cn=Z.provider,gt=cn.portalUrl,L=cn.usernameFieldName||"username",U=cn.passwordFieldName||"password",W=new URL(gt);W.searchParams.set(L,Fe),W.searchParams.set(U,ts.data.password),window.open(W.toString(),"_blank")}catch{alert("Fehler beim Auto-Login")}finally{f(!1)}};if(k)return s.jsx("div",{className:"text-center py-8",children:"Laden..."});if(!(z!=null&&z.data))return s.jsx("div",{className:"text-center py-8 text-red-600",children:"Vertrag nicht gefunden"});const C=z.data;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{if((r==null?void 0:r.from)==="customer"&&(r!=null&&r.customerId))t(`/customers/${r.customerId}?tab=contracts`);else if((r==null?void 0:r.from)==="cockpit"){const Z=r.filter?`?filter=${r.filter}`:"";t(`/contracts/cockpit${Z}`)}else(r==null?void 0:r.from)==="contracts"?t("/contracts"):C.customer?t(`/customers/${C.customer.id}?tab=contracts`):t("/contracts")},children:s.jsx(Vs,{className:"w-4 h-4"})}),s.jsx("h1",{className:"text-2xl font-bold",children:C.contractNumber}),s.jsx(ve,{children:rC[C.type]}),s.jsx(ve,{variant:iC[C.status],children:aC[C.status]}),s.jsx("button",{onClick:()=>R(!0),className:"text-gray-400 hover:text-blue-600 transition-colors",title:"Status-Erklärung",children:s.jsx(Al,{className:"w-4 h-4"})}),C.nextReviewDate&&new Date(C.nextReviewDate)>new Date&&s.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 bg-amber-100 text-amber-800 rounded-full text-xs",children:[s.jsx(wv,{className:"w-3 h-3"}),s.jsxs("span",{children:["Zurückgestellt bis ",new Date(C.nextReviewDate).toLocaleDateString("de-DE")]}),i("contracts:update")&&s.jsx("button",{onClick:()=>D(!0),className:"ml-1 p-0.5 hover:bg-amber-200 rounded",title:"Zurückstellung aufheben",children:s.jsx(qt,{className:"w-3 h-3"})})]})]}),C.customer&&s.jsxs("p",{className:"text-gray-500 ml-10",children:["Kunde:"," ",s.jsx(ke,{to:`/customers/${C.customer.id}`,className:"text-blue-600 hover:underline",children:C.customer.companyName||`${C.customer.firstName} ${C.customer.lastName}`})]})]}),!l&&s.jsxs("div",{className:"flex gap-2",children:[C.previousContract&&s.jsx(ke,{to:`/contracts/${C.previousContract.id}`,children:s.jsxs(T,{variant:"secondary",children:[s.jsx(Vs,{className:"w-4 h-4 mr-2"}),"Vorgängervertrag"]})}),i("contracts:create")&&!C.followUpContract&&s.jsxs(T,{variant:"secondary",onClick:()=>P(!0),disabled:B.isPending,children:[s.jsx(lh,{className:"w-4 h-4 mr-2"}),B.isPending?"Erstelle...":"Folgevertrag anlegen"]}),C.followUpContract&&s.jsx(ke,{to:`/contracts/${C.followUpContract.id}`,children:s.jsxs(T,{variant:"secondary",children:[s.jsx(Nv,{className:"w-4 h-4 mr-2"}),"Folgevertrag anzeigen"]})}),i("contracts:update")&&s.jsx(ke,{to:`/contracts/${e}/edit`,children:s.jsxs(T,{variant:"secondary",children:[s.jsx(Je,{className:"w-4 h-4 mr-2"}),"Bearbeiten"]})}),i("contracts:delete")&&s.jsxs(T,{variant:"danger",onClick:()=>{confirm("Vertrag wirklich löschen?")&&K.mutate()},children:[s.jsx(Ne,{className:"w-4 h-4 mr-2"}),"Löschen"]})]})]}),C.previousContract&&s.jsx(X,{className:"mb-6 border-l-4 border-l-blue-500",title:"Vorgängervertrag",children:s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsnummer"}),s.jsx("dd",{children:s.jsx("button",{onClick:()=>w(!0),className:"text-blue-600 hover:underline",children:C.previousContract.contractNumber})})]}),C.previousContract.providerName&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Anbieter"}),s.jsx("dd",{children:C.previousContract.providerName})]}),C.previousContract.customerNumberAtProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kundennummer"}),s.jsx("dd",{className:"font-mono",children:C.previousContract.customerNumberAtProvider})]}),C.previousContract.contractNumberAtProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsnummer"}),s.jsx("dd",{className:"font-mono",children:C.previousContract.contractNumberAtProvider})]}),C.previousContract.portalUsername&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Zugangsdaten"}),s.jsx("dd",{children:C.previousContract.portalUsername})]})]})}),!C.previousContract&&(C.previousProvider||C.previousCustomerNumber||C.previousContractNumber)&&s.jsx(X,{className:"mb-6 border-l-4 border-l-gray-400",title:"Altanbieter",children:s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[C.previousProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Anbieter"}),s.jsx("dd",{children:C.previousProvider.name})]}),C.previousCustomerNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kundennummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.previousCustomerNumber,s.jsx(oe,{value:C.previousCustomerNumber})]})]}),C.previousContractNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsnummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.previousContractNumber,s.jsx(oe,{value:C.previousContractNumber})]})]})]})}),C.cancellationConfirmationDate&&s.jsxs("div",{className:"mb-6 p-4 bg-red-50 border-2 border-red-400 rounded-lg flex items-start gap-3",children:[s.jsx("span",{className:"text-red-600 text-xl font-bold",children:"!"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold text-red-800",children:"Kündigungsbestätigung vorhanden"}),s.jsxs("p",{className:"text-sm text-red-700 mt-1",children:["Dieser Vertrag hat eine Kündigungsbestätigung vom"," ",s.jsx("strong",{children:new Date(C.cancellationConfirmationDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})}),".",C.cancellationConfirmationOptionsDate&&s.jsxs(s.Fragment,{children:[" Optionen-Bestätigung: ",s.jsx("strong",{children:new Date(C.cancellationConfirmationOptionsDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})}),"."]})]})]})]}),C.type==="MOBILE"&&((nt=C.mobileDetails)==null?void 0:nt.requiresMultisim)&&s.jsxs("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-300 rounded-lg flex items-start gap-3",children:[s.jsx("span",{className:"text-amber-600 text-xl font-bold",children:"!"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold text-amber-800",children:"Multisim erforderlich"}),s.jsx("p",{className:"text-sm text-amber-700 mt-1",children:"Dieser Kunde benötigt eine Multisim-Karte. Multisim ist bei Klarmobil, Congstar und Otelo nicht buchbar. Bitte einen Anbieter wie Freenet oder vergleichbar wählen."})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6",children:[s.jsx(X,{title:"Anbieter & Tarif",children:s.jsxs("dl",{className:"space-y-3",children:[(C.provider||C.providerName)&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Anbieter"}),s.jsx("dd",{className:"font-medium",children:((es=C.provider)==null?void 0:es.name)||C.providerName})]}),(C.tariff||C.tariffName)&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Tarif"}),s.jsx("dd",{children:((Vt=C.tariff)==null?void 0:Vt.name)||C.tariffName})]}),C.customerNumberAtProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kundennummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.customerNumberAtProvider,s.jsx(oe,{value:C.customerNumberAtProvider})]})]}),C.contractNumberAtProvider&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsnummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.contractNumberAtProvider,s.jsx(oe,{value:C.contractNumberAtProvider})]})]}),C.salesPlatform&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertriebsplattform"}),s.jsx("dd",{children:C.salesPlatform.name})]}),C.commission!==null&&C.commission!==void 0&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Provision"}),s.jsx("dd",{children:C.commission.toLocaleString("de-DE",{style:"currency",currency:"EUR"})})]}),C.priceFirst12Months&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Preis erste 12 Monate"}),s.jsx("dd",{children:C.priceFirst12Months})]}),C.priceFrom13Months&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Preis ab 13. Monat"}),s.jsx("dd",{children:C.priceFrom13Months})]}),C.priceAfter24Months&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Preis nach 24 Monaten"}),s.jsx("dd",{children:C.priceAfter24Months})]})]})}),s.jsxs(X,{title:"Laufzeit und Kündigung",className:C.cancellationConfirmationDate?"border-2 border-red-400":"",children:[C.contractDuration&&cC(C.contractDuration.code)&&s.jsxs("p",{className:"text-sm text-gray-500 mb-4 bg-blue-50 border border-blue-200 rounded-lg p-3",children:[s.jsx("strong",{children:"Hinweis:"})," Dieser Vertrag gilt als unbefristet mit der jeweiligen Kündigungsfrist."]}),s.jsxs("dl",{className:"space-y-3",children:[C.startDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsbeginn"}),s.jsx("dd",{children:new Date(C.startDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),C.endDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragsende"}),s.jsx("dd",{children:new Date(C.endDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),C.contractDuration&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vertragslaufzeit"}),s.jsx("dd",{children:C.contractDuration.description})]}),C.cancellationPeriod&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kündigungsfrist"}),s.jsx("dd",{children:C.cancellationPeriod.description})]}),C.cancellationConfirmationDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kündigungsbestätigungsdatum"}),s.jsx("dd",{children:new Date(C.cancellationConfirmationDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),C.cancellationConfirmationOptionsDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kündigungsbestätigungsoptionendatum"}),s.jsx("dd",{children:new Date(C.cancellationConfirmationOptionsDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})]}),C.wasSpecialCancellation&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Sonderkündigung"}),s.jsx("dd",{children:s.jsx(ve,{variant:"warning",children:"Ja"})})]})]}),i("contracts:update")&&s.jsxs("div",{className:"mt-6 pt-6 border-t",children:[s.jsx("h4",{className:"font-medium mb-4",children:"Kündigungsdokumente"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500 mb-1",children:"Kündigungsschreiben"}),C.cancellationLetterPath?s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("a",{href:`/api${C.cancellationLetterPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Pe,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${C.cancellationLetterPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(As,{className:"w-4 h-4"}),"Download"]}),s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationLetter(c,Z),a.invalidateQueries({queryKey:["contract",e]})},existingFile:C.cancellationLetterPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:async()=>{confirm("Dokument wirklich löschen?")&&(await ut.deleteCancellationLetter(c),a.invalidateQueries({queryKey:["contract",e]}))},className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]}):s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationLetter(c,Z),a.invalidateQueries({queryKey:["contract",e]})},accept:".pdf",label:"PDF hochladen"})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500 mb-1",children:"Kündigungsbestätigung"}),C.cancellationConfirmationPath?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("a",{href:`/api${C.cancellationConfirmationPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Pe,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${C.cancellationConfirmationPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(As,{className:"w-4 h-4"}),"Download"]}),s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationConfirmation(c,Z),a.invalidateQueries({queryKey:["contract",e]})},existingFile:C.cancellationConfirmationPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:async()=>{confirm("Dokument wirklich löschen?")&&(await ut.deleteCancellationConfirmation(c),a.invalidateQueries({queryKey:["contract",e]}))},className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Bestätigung erhalten am"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"date",value:C.cancellationConfirmationDate?C.cancellationConfirmationDate.split("T")[0]:"",onChange:Z=>{const Fe=Z.target.value||null;Q.mutate(Fe)},className:"block w-full max-w-[180px] px-2 py-1 text-sm border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500"}),C.cancellationConfirmationDate&&s.jsx("button",{onClick:()=>Q.mutate(null),className:"p-1 text-red-500 hover:text-red-700 hover:bg-red-50 rounded",title:"Datum löschen",children:s.jsx(Ne,{className:"w-4 h-4"})})]})]})]}):s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationConfirmation(c,Z),a.invalidateQueries({queryKey:["contract",e]})},accept:".pdf",label:"PDF hochladen"})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500 mb-1",children:"Kündigungsschreiben Optionen"}),C.cancellationLetterOptionsPath?s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("a",{href:`/api${C.cancellationLetterOptionsPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Pe,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${C.cancellationLetterOptionsPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(As,{className:"w-4 h-4"}),"Download"]}),s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationLetterOptions(c,Z),a.invalidateQueries({queryKey:["contract",e]})},existingFile:C.cancellationLetterOptionsPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:async()=>{confirm("Dokument wirklich löschen?")&&(await ut.deleteCancellationLetterOptions(c),a.invalidateQueries({queryKey:["contract",e]}))},className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]}):s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationLetterOptions(c,Z),a.invalidateQueries({queryKey:["contract",e]})},accept:".pdf",label:"PDF hochladen"})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500 mb-1",children:"Kündigungsbestätigung Optionen"}),C.cancellationConfirmationOptionsPath?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("a",{href:`/api${C.cancellationConfirmationOptionsPath}`,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Pe,{className:"w-4 h-4"}),"Anzeigen"]}),s.jsxs("a",{href:`/api${C.cancellationConfirmationOptionsPath}`,download:!0,className:"text-blue-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(As,{className:"w-4 h-4"}),"Download"]}),s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationConfirmationOptions(c,Z),a.invalidateQueries({queryKey:["contract",e]})},existingFile:C.cancellationConfirmationOptionsPath,accept:".pdf",label:"Ersetzen"}),s.jsxs("button",{onClick:async()=>{confirm("Dokument wirklich löschen?")&&(await ut.deleteCancellationConfirmationOptions(c),a.invalidateQueries({queryKey:["contract",e]}))},className:"text-red-600 hover:underline text-sm flex items-center gap-1",children:[s.jsx(Ne,{className:"w-4 h-4"}),"Löschen"]})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Bestätigung erhalten am"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"date",value:C.cancellationConfirmationOptionsDate?C.cancellationConfirmationOptionsDate.split("T")[0]:"",onChange:Z=>{const Fe=Z.target.value||null;le.mutate(Fe)},className:"block w-full max-w-[180px] px-2 py-1 text-sm border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500"}),C.cancellationConfirmationOptionsDate&&s.jsx("button",{onClick:()=>le.mutate(null),className:"p-1 text-red-500 hover:text-red-700 hover:bg-red-50 rounded",title:"Datum löschen",children:s.jsx(Ne,{className:"w-4 h-4"})})]})]})]}):s.jsx(Dt,{onUpload:async Z=>{await ut.uploadCancellationConfirmationOptions(c,Z),a.invalidateQueries({queryKey:["contract",e]})},accept:".pdf",label:"PDF hochladen"})]})]})]})]})]}),(C.portalUsername||C.stressfreiEmail||C.portalPasswordEncrypted)&&s.jsxs(X,{className:"mb-6",title:"Zugangsdaten",children:[s.jsxs("dl",{className:"grid grid-cols-2 gap-4",children:[(C.portalUsername||C.stressfreiEmail)&&s.jsxs("div",{children:[s.jsxs("dt",{className:"text-sm text-gray-500",children:["Benutzername",C.stressfreiEmail&&s.jsx("span",{className:"ml-2 text-xs text-blue-600",children:"(Stressfrei-Wechseln)"})]}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[((ae=C.stressfreiEmail)==null?void 0:ae.email)||C.portalUsername,s.jsx(oe,{value:((We=C.stressfreiEmail)==null?void 0:We.email)||C.portalUsername||""})]})]}),C.portalPasswordEncrypted&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Passwort"}),s.jsxs("dd",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-mono",children:d&&h?h:"••••••••"}),d&&h&&s.jsx(oe,{value:h}),s.jsx(T,{variant:"ghost",size:"sm",onClick:de,children:d?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Pe,{className:"w-4 h-4"})})]})]})]}),((xt=C.provider)==null?void 0:xt.portalUrl)&&(C.portalUsername||C.stressfreiEmail)&&C.portalPasswordEncrypted&&s.jsxs("div",{className:"mt-4 pt-4 border-t",children:[s.jsxs(T,{onClick:st,disabled:m,className:"w-full sm:w-auto",children:[s.jsx(ch,{className:"w-4 h-4 mr-2"}),m?"Wird geöffnet...":"Zum Kundenportal (Auto-Login)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"Öffnet das Portal mit vorausgefüllten Zugangsdaten"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6 mb-6",children:[C.address&&s.jsx(X,{title:"Lieferadresse",children:s.jsxs(Qu,{values:[`${C.address.street} ${C.address.houseNumber}`,`${C.address.postalCode} ${C.address.city}`,C.address.country],children:[s.jsxs("p",{children:[C.address.street," ",C.address.houseNumber]}),s.jsxs("p",{children:[C.address.postalCode," ",C.address.city]}),s.jsx("p",{className:"text-gray-500",children:C.address.country})]})}),(C.billingAddress||C.address)&&s.jsx(X,{title:"Rechnungsadresse",children:(()=>{const Z=C.billingAddress||C.address;return Z?s.jsxs(Qu,{values:[`${Z.street} ${Z.houseNumber}`,`${Z.postalCode} ${Z.city}`,Z.country],children:[s.jsxs("p",{children:[Z.street," ",Z.houseNumber]}),s.jsxs("p",{children:[Z.postalCode," ",Z.city]}),s.jsx("p",{className:"text-gray-500",children:Z.country}),!C.billingAddress&&C.address&&s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"(wie Lieferadresse)"})]}):null})()}),C.bankCard&&s.jsxs(X,{title:"Bankkarte",children:[s.jsx("p",{className:"font-medium",children:C.bankCard.accountHolder}),s.jsxs("p",{className:"font-mono flex items-center gap-1",children:[C.bankCard.iban,s.jsx(oe,{value:C.bankCard.iban})]}),C.bankCard.bankName&&s.jsx("p",{className:"text-gray-500",children:C.bankCard.bankName})]}),C.identityDocument&&s.jsxs(X,{title:"Ausweis",children:[s.jsxs("p",{className:"font-mono flex items-center gap-1",children:[C.identityDocument.documentNumber,s.jsx(oe,{value:C.identityDocument.documentNumber})]}),s.jsx("p",{className:"text-gray-500",children:C.identityDocument.type})]})]}),C.energyDetails&&s.jsxs(X,{className:"mb-6",title:C.type==="ELECTRICITY"?"Strom-Details":"Gas-Details",children:[s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[C.energyDetails.meter&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Zählernummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.energyDetails.meter.meterNumber,s.jsx(oe,{value:C.energyDetails.meter.meterNumber})]})]}),C.energyDetails.maloId&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"MaLo-ID"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.energyDetails.maloId,s.jsx(oe,{value:C.energyDetails.maloId})]})]}),C.energyDetails.annualConsumption&&s.jsxs("div",{children:[s.jsxs("dt",{className:"text-sm text-gray-500",children:["Jahresverbrauch ",C.type==="ELECTRICITY"?"":"(m³)"]}),s.jsxs("dd",{children:[C.energyDetails.annualConsumption.toLocaleString("de-DE")," ",C.type==="ELECTRICITY"?"kWh":"m³"]})]}),C.type==="GAS"&&C.energyDetails.annualConsumptionKwh&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Jahresverbrauch (kWh)"}),s.jsxs("dd",{children:[C.energyDetails.annualConsumptionKwh.toLocaleString("de-DE")," kWh"]})]}),C.energyDetails.basePrice!=null&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Grundpreis"}),s.jsxs("dd",{children:[C.energyDetails.basePrice.toLocaleString("de-DE",{minimumFractionDigits:2,maximumFractionDigits:10})," €/Monat"]})]}),C.energyDetails.unitPrice!=null&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Arbeitspreis"}),s.jsxs("dd",{children:[C.energyDetails.unitPrice.toLocaleString("de-DE",{minimumFractionDigits:2,maximumFractionDigits:10})," €/kWh"]})]}),C.energyDetails.bonus&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Bonus"}),s.jsxs("dd",{children:[C.energyDetails.bonus.toLocaleString("de-DE")," €"]})]}),C.energyDetails.previousProviderName&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vorversorger"}),s.jsx("dd",{children:C.energyDetails.previousProviderName})]}),C.energyDetails.previousCustomerNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vorherige Kundennr."}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.energyDetails.previousCustomerNumber,s.jsx(oe,{value:C.energyDetails.previousCustomerNumber})]})]})]}),C.energyDetails.meter&&s.jsx(uC,{meterId:C.energyDetails.meter.id,meterType:C.energyDetails.meter.type,readings:C.energyDetails.meter.readings||[],contractId:c,canEdit:i("contracts:update")&&!l}),C.energyDetails.meter&&C.startDate&&C.endDate&&s.jsx(hC,{contractType:C.type,readings:C.energyDetails.meter.readings||[],startDate:C.startDate,endDate:C.endDate,basePrice:C.energyDetails.basePrice,unitPrice:C.energyDetails.unitPrice,bonus:C.energyDetails.bonus}),s.jsx(Xk,{ecdId:C.energyDetails.id,invoices:C.energyDetails.invoices||[],contractId:c,canEdit:i("contracts:update")&&!l})]}),C.internetDetails&&s.jsxs(X,{className:"mb-6",title:C.type==="DSL"?"DSL-Details":C.type==="CABLE"?"Kabelinternet-Details":"Glasfaser-Details",children:[s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[C.internetDetails.downloadSpeed&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Download"}),s.jsxs("dd",{children:[C.internetDetails.downloadSpeed," Mbit/s"]})]}),C.internetDetails.uploadSpeed&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Upload"}),s.jsxs("dd",{children:[C.internetDetails.uploadSpeed," Mbit/s"]})]}),C.internetDetails.routerModel&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Router"}),s.jsx("dd",{children:C.internetDetails.routerModel})]}),C.internetDetails.routerSerialNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Router S/N"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.internetDetails.routerSerialNumber,s.jsx(oe,{value:C.internetDetails.routerSerialNumber})]})]}),C.internetDetails.installationDate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Installation"}),s.jsx("dd",{children:new Date(C.internetDetails.installationDate).toLocaleDateString("de-DE")})]}),C.internetDetails.homeId&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Home-ID"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.internetDetails.homeId,s.jsx(oe,{value:C.internetDetails.homeId})]})]}),C.internetDetails.activationCode&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Aktivierungscode"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.internetDetails.activationCode,s.jsx(oe,{value:C.internetDetails.activationCode})]})]})]}),(C.internetDetails.internetUsername||C.internetDetails.internetPasswordEncrypted)&&s.jsxs("div",{className:"mt-4 pt-4 border-t",children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-3",children:"Internet-Zugangsdaten"}),s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[C.internetDetails.internetUsername&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Benutzername"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.internetDetails.internetUsername,s.jsx(oe,{value:C.internetDetails.internetUsername})]})]}),C.internetDetails.internetPasswordEncrypted&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Passwort"}),s.jsxs("dd",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-mono",children:p&&g?g:"••••••••"}),p&&g&&s.jsx(oe,{value:g}),s.jsx(T,{variant:"ghost",size:"sm",onClick:_e,children:p?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Pe,{className:"w-4 h-4"})})]})]})]})]}),C.internetDetails.phoneNumbers&&C.internetDetails.phoneNumbers.length>0&&s.jsxs("div",{className:"mt-4 pt-4 border-t",children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-3",children:"Rufnummern & SIP-Zugangsdaten"}),s.jsx("div",{className:"space-y-3",children:C.internetDetails.phoneNumbers.map(Z=>s.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsxs("span",{className:"font-mono font-medium flex items-center gap-1",children:[Z.phoneNumber,s.jsx(oe,{value:Z.phoneNumber})]}),Z.isMain&&s.jsx(ve,{variant:"success",children:"Hauptnummer"})]}),(Z.sipUsername||Z.sipPasswordEncrypted||Z.sipServer)&&s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 text-sm",children:[Z.sipUsername&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"SIP-Benutzer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[Z.sipUsername,s.jsx(oe,{value:Z.sipUsername})]})]}),Z.sipPasswordEncrypted&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"SIP-Passwort"}),s.jsxs("dd",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-mono",children:v[Z.id]&&E[Z.id]?E[Z.id]:"••••••••"}),v[Z.id]&&E[Z.id]&&s.jsx(oe,{value:E[Z.id]}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>qe(Z.id),children:v[Z.id]?s.jsx(It,{className:"w-3 h-3"}):s.jsx(Pe,{className:"w-3 h-3"})})]})]}),Z.sipServer&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"SIP-Server"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[Z.sipServer,s.jsx(oe,{value:Z.sipServer})]})]})]})]},Z.id))})]})]}),C.mobileDetails&&s.jsxs(X,{className:"mb-6",title:"Mobilfunk-Details",children:[s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[C.mobileDetails.dataVolume&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Datenvolumen"}),s.jsxs("dd",{children:[C.mobileDetails.dataVolume," GB"]})]}),C.mobileDetails.includedMinutes&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Inklusiv-Minuten"}),s.jsx("dd",{children:C.mobileDetails.includedMinutes})]}),C.mobileDetails.includedSMS&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Inklusiv-SMS"}),s.jsx("dd",{children:C.mobileDetails.includedSMS})]}),C.mobileDetails.deviceModel&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Gerät"}),s.jsx("dd",{children:C.mobileDetails.deviceModel})]}),C.mobileDetails.deviceImei&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"IMEI"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.mobileDetails.deviceImei,s.jsx(oe,{value:C.mobileDetails.deviceImei})]})]}),C.mobileDetails.requiresMultisim&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Multisim"}),s.jsx("dd",{children:s.jsx(ve,{variant:"warning",children:"Erforderlich"})})]})]}),C.mobileDetails.simCards&&C.mobileDetails.simCards.length>0&&s.jsxs("div",{className:"mt-6 pt-6 border-t",children:[s.jsx("h4",{className:"font-medium mb-4",children:"SIM-Karten"}),s.jsx("div",{className:"space-y-3",children:C.mobileDetails.simCards.map(Z=>s.jsx(dC,{simCard:Z},Z.id))})]}),(!C.mobileDetails.simCards||C.mobileDetails.simCards.length===0)&&(C.mobileDetails.phoneNumber||C.mobileDetails.simCardNumber)&&s.jsxs("div",{className:"mt-6 pt-6 border-t",children:[s.jsx("h4",{className:"font-medium mb-4",children:"SIM-Karte (Legacy)"}),s.jsxs("dl",{className:"grid grid-cols-2 gap-4",children:[C.mobileDetails.phoneNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Rufnummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.mobileDetails.phoneNumber,s.jsx(oe,{value:C.mobileDetails.phoneNumber})]})]}),C.mobileDetails.simCardNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"SIM-Kartennummer"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.mobileDetails.simCardNumber,s.jsx(oe,{value:C.mobileDetails.simCardNumber})]})]})]})]})]}),C.tvDetails&&s.jsx(X,{className:"mb-6",title:"TV-Details",children:s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[C.tvDetails.receiverModel&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Receiver"}),s.jsx("dd",{children:C.tvDetails.receiverModel})]}),C.tvDetails.smartcardNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Smartcard"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.tvDetails.smartcardNumber,s.jsx(oe,{value:C.tvDetails.smartcardNumber})]})]}),C.tvDetails.package&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Paket"}),s.jsx("dd",{children:C.tvDetails.package})]})]})}),C.carInsuranceDetails&&s.jsx(X,{className:"mb-6",title:"KFZ-Versicherung Details",children:s.jsxs("dl",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[C.carInsuranceDetails.licensePlate&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Kennzeichen"}),s.jsxs("dd",{className:"font-mono font-bold flex items-center gap-1",children:[C.carInsuranceDetails.licensePlate,s.jsx(oe,{value:C.carInsuranceDetails.licensePlate})]})]}),C.carInsuranceDetails.vehicleType&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Fahrzeug"}),s.jsx("dd",{children:C.carInsuranceDetails.vehicleType})]}),C.carInsuranceDetails.hsn&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"HSN/TSN"}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.carInsuranceDetails.hsn,"/",C.carInsuranceDetails.tsn,s.jsx(oe,{value:`${C.carInsuranceDetails.hsn}/${C.carInsuranceDetails.tsn}`})]})]}),C.carInsuranceDetails.vin&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"FIN"}),s.jsxs("dd",{className:"font-mono text-sm flex items-center gap-1",children:[C.carInsuranceDetails.vin,s.jsx(oe,{value:C.carInsuranceDetails.vin})]})]}),C.carInsuranceDetails.firstRegistration&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Erstzulassung"}),s.jsx("dd",{children:new Date(C.carInsuranceDetails.firstRegistration).toLocaleDateString("de-DE")})]}),C.carInsuranceDetails.noClaimsClass&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"SF-Klasse"}),s.jsx("dd",{children:C.carInsuranceDetails.noClaimsClass})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Versicherungsart"}),s.jsx("dd",{children:s.jsx(ve,{variant:C.carInsuranceDetails.insuranceType==="FULL"?"success":C.carInsuranceDetails.insuranceType==="PARTIAL"?"warning":"default",children:C.carInsuranceDetails.insuranceType==="FULL"?"Vollkasko":C.carInsuranceDetails.insuranceType==="PARTIAL"?"Teilkasko":"Haftpflicht"})})]}),C.carInsuranceDetails.deductiblePartial&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"SB Teilkasko"}),s.jsxs("dd",{children:[C.carInsuranceDetails.deductiblePartial," €"]})]}),C.carInsuranceDetails.deductibleFull&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"SB Vollkasko"}),s.jsxs("dd",{children:[C.carInsuranceDetails.deductibleFull," €"]})]}),C.carInsuranceDetails.policyNumber&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Versicherungsschein-Nr."}),s.jsxs("dd",{className:"font-mono flex items-center gap-1",children:[C.carInsuranceDetails.policyNumber,s.jsx(oe,{value:C.carInsuranceDetails.policyNumber})]})]}),C.carInsuranceDetails.previousInsurer&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Vorversicherer"}),s.jsx("dd",{children:C.carInsuranceDetails.previousInsurer})]})]})}),s.jsx(fC,{contractId:c,canEdit:i("contracts:update"),isCustomerPortal:o}),!o&&i("contracts:read")&&C.customerId&&s.jsx(lk,{contractId:c,customerId:C.customerId}),C.notes&&s.jsx(X,{title:"Notizen",children:s.jsx("p",{className:"whitespace-pre-wrap",children:C.notes})}),I&&C.previousContract&&s.jsx(Jk,{contractId:C.previousContract.id,isOpen:!0,onClose:()=>w(!1)}),s.jsx(Ve,{isOpen:S,onClose:()=>P(!1),title:"Folgevertrag anlegen",size:"sm",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-700",children:"Möchten Sie wirklich einen Folgevertrag für diesen Vertrag anlegen?"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Die Daten des aktuellen Vertrags werden als Vorlage übernommen."}),s.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[s.jsx(T,{variant:"secondary",onClick:()=>P(!1),children:"Nein"}),s.jsx(T,{onClick:()=>{P(!1),B.mutate()},children:"Ja, anlegen"})]})]})}),s.jsx(oC,{isOpen:O,onClose:()=>R(!1)}),s.jsx(Ve,{isOpen:q,onClose:()=>D(!1),title:"Zurückstellung aufheben?",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-700",children:"Möchten Sie die Zurückstellung für diesen Vertrag wirklich aufheben?"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Der Vertrag wird danach wieder im Cockpit angezeigt, wenn Fristen anstehen oder abgelaufen sind."}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:()=>D(!1),children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:()=>_.mutate(),disabled:_.isPending,children:_.isPending?"Wird aufgehoben...":"Ja, aufheben"})]})]})})]})}const gC=[{value:"DRAFT",label:"Entwurf"},{value:"PENDING",label:"Ausstehend"},{value:"ACTIVE",label:"Aktiv"},{value:"CANCELLED",label:"Gekündigt"},{value:"EXPIRED",label:"Abgelaufen"},{value:"DEACTIVATED",label:"Deaktiviert"}],yC=[{status:"DRAFT",label:"Entwurf",description:"Vertrag wird noch vorbereitet",color:"text-gray-600"},{status:"PENDING",label:"Ausstehend",description:"Wartet auf Aktivierung",color:"text-yellow-600"},{status:"ACTIVE",label:"Aktiv",description:"Vertrag läuft normal",color:"text-green-600"},{status:"EXPIRED",label:"Abgelaufen",description:"Laufzeit vorbei, läuft aber ohne Kündigung weiter",color:"text-orange-600"},{status:"CANCELLED",label:"Gekündigt",description:"Aktive Kündigung eingereicht, Vertrag endet",color:"text-red-600"},{status:"DEACTIVATED",label:"Deaktiviert",description:"Manuell beendet/archiviert",color:"text-gray-500"}];function vC({isOpen:e,onClose:t}){return e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[s.jsx("div",{className:"fixed inset-0 bg-black/20",onClick:t}),s.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl p-4 max-w-sm w-full mx-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Vertragsstatus-Übersicht"}),s.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600",children:s.jsx(qt,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"space-y-2",children:yC.map(({status:n,label:r,description:a,color:i})=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:`font-medium text-sm min-w-[90px] ${i}`,children:r}),s.jsx("span",{className:"text-sm text-gray-600",children:a})]},n))})]})]}):null}function _x(){var li,Rl,oi,bh,Nh,wh,Sh,kh,Ch;const{id:e}=bc(),[t]=wc(),n=Yt(),r=ge(),a=!!e,i=t.get("customerId"),{register:l,handleSubmit:o,reset:c,watch:d,setValue:u,formState:{errors:h}}=qv({defaultValues:{customerId:i||"",type:"ELECTRICITY",status:"DRAFT",previousContractId:""}}),x=d("type"),m=d("customerId"),f=d("previousContractId"),{data:p}=fe({queryKey:["contract",e],queryFn:()=>Oe.getById(parseInt(e)),enabled:a}),{data:b}=fe({queryKey:["customers-all"],queryFn:()=>Pt.getAll({limit:1e3})}),{data:g}=fe({queryKey:["customer",m],queryFn:()=>Pt.getById(parseInt(m)),enabled:!!m}),{data:y}=fe({queryKey:["customer-contracts-for-predecessor",m],queryFn:()=>Oe.getAll({customerId:parseInt(m),limit:1e3}),enabled:!!m}),{data:v}=fe({queryKey:["platforms"],queryFn:()=>al.getAll()}),{data:N}=fe({queryKey:["cancellation-periods"],queryFn:()=>il.getAll()}),{data:E}=fe({queryKey:["contract-durations"],queryFn:()=>ll.getAll()}),{data:A}=fe({queryKey:["providers"],queryFn:()=>Xa.getAll()}),{data:I}=fe({queryKey:["contract-categories"],queryFn:()=>ol.getAll()}),w=d("providerId"),[S,P]=j.useState(null),[O,R]=j.useState([]),[q,D]=j.useState([]),[z,k]=j.useState(!1),[K,B]=j.useState("manual"),[_,Q]=j.useState(""),[le,de]=j.useState(!1),[_e,qe]=j.useState(!1),[st,C]=j.useState({}),[nt,es]=j.useState({}),[Vt,ae]=j.useState({}),[We,xt]=j.useState(!1);j.useEffect(()=>{a||k(!0)},[a]),j.useEffect(()=>{!a&&i&&(b!=null&&b.data)&&b.data.some(ie=>ie.id.toString()===i)&&u("customerId",i)},[a,i,b,u]),j.useEffect(()=>{z&&S&&w!==S&&u("tariffId",""),P(w)},[w,S,u,z]),j.useEffect(()=>{if(!a&&(I!=null&&I.data)&&I.data.length>0){const F=d("type"),ie=I.data.filter(pe=>pe.isActive),we=ie.some(pe=>pe.code===F);if(!F||!we){const pe=ie.sort((je,ct)=>je.sortOrder-ct.sortOrder)[0];pe&&u("type",pe.code)}}},[I,a,u,d]),j.useEffect(()=>{a&&(p!=null&&p.data)&&!m&&u("customerId",p.data.customerId.toString())},[a,p,m,u]),j.useEffect(()=>{var F,ie,we,pe,je,ct,Ce,ci,Eh,Dh,Ph,Ah,Mh,Th,Fh,Ih,Rh,Lh,Oh,zh,$h,_h,Kh,Bh,Uh,qh,Vh,Qh,Hh,Wh,Gh,Zh,Jh,Xh,Yh,ef,tf,sf,nf,rf,af,lf,of,cf,df,uf,mf,hf,ff,pf,xf,gf;if(p!=null&&p.data&&(v!=null&&v.data)&&(I!=null&&I.data)&&(A!=null&&A.data)&&(g!=null&&g.data)){const ne=p.data;c({customerId:ne.customerId.toString(),type:ne.type,status:ne.status,addressId:((F=ne.addressId)==null?void 0:F.toString())||"",billingAddressId:((ie=ne.billingAddressId)==null?void 0:ie.toString())||"",bankCardId:((we=ne.bankCardId)==null?void 0:we.toString())||"",identityDocumentId:((pe=ne.identityDocumentId)==null?void 0:pe.toString())||"",salesPlatformId:((je=ne.salesPlatformId)==null?void 0:je.toString())||"",providerId:((ct=ne.providerId)==null?void 0:ct.toString())||"",tariffId:((Ce=ne.tariffId)==null?void 0:Ce.toString())||"",providerName:ne.providerName||"",tariffName:ne.tariffName||"",customerNumberAtProvider:ne.customerNumberAtProvider||"",contractNumberAtProvider:ne.contractNumberAtProvider||"",priceFirst12Months:ne.priceFirst12Months||"",priceFrom13Months:ne.priceFrom13Months||"",priceAfter24Months:ne.priceAfter24Months||"",startDate:ne.startDate?ne.startDate.split("T")[0]:"",endDate:ne.endDate?ne.endDate.split("T")[0]:"",cancellationPeriodId:((ci=ne.cancellationPeriodId)==null?void 0:ci.toString())||"",contractDurationId:((Eh=ne.contractDurationId)==null?void 0:Eh.toString())||"",commission:ne.commission||"",portalUsername:ne.portalUsername||"",notes:ne.notes||"",meterId:((Ph=(Dh=ne.energyDetails)==null?void 0:Dh.meterId)==null?void 0:Ph.toString())||"",maloId:((Ah=ne.energyDetails)==null?void 0:Ah.maloId)||"",annualConsumption:((Mh=ne.energyDetails)==null?void 0:Mh.annualConsumption)||"",annualConsumptionKwh:((Th=ne.energyDetails)==null?void 0:Th.annualConsumptionKwh)||"",basePrice:((Fh=ne.energyDetails)==null?void 0:Fh.basePrice)||"",unitPrice:((Ih=ne.energyDetails)==null?void 0:Ih.unitPrice)||"",bonus:((Rh=ne.energyDetails)==null?void 0:Rh.bonus)||"",downloadSpeed:((Lh=ne.internetDetails)==null?void 0:Lh.downloadSpeed)||"",uploadSpeed:((Oh=ne.internetDetails)==null?void 0:Oh.uploadSpeed)||"",routerModel:((zh=ne.internetDetails)==null?void 0:zh.routerModel)||"",routerSerialNumber:(($h=ne.internetDetails)==null?void 0:$h.routerSerialNumber)||"",installationDate:(_h=ne.internetDetails)!=null&&_h.installationDate?ne.internetDetails.installationDate.split("T")[0]:"",internetUsername:((Kh=ne.internetDetails)==null?void 0:Kh.internetUsername)||"",homeId:((Bh=ne.internetDetails)==null?void 0:Bh.homeId)||"",activationCode:((Uh=ne.internetDetails)==null?void 0:Uh.activationCode)||"",requiresMultisim:((qh=ne.mobileDetails)==null?void 0:qh.requiresMultisim)||!1,dataVolume:((Vh=ne.mobileDetails)==null?void 0:Vh.dataVolume)||"",includedMinutes:((Qh=ne.mobileDetails)==null?void 0:Qh.includedMinutes)||"",includedSMS:((Hh=ne.mobileDetails)==null?void 0:Hh.includedSMS)||"",deviceModel:((Wh=ne.mobileDetails)==null?void 0:Wh.deviceModel)||"",deviceImei:((Gh=ne.mobileDetails)==null?void 0:Gh.deviceImei)||"",phoneNumber:((Zh=ne.mobileDetails)==null?void 0:Zh.phoneNumber)||"",simCardNumber:((Jh=ne.mobileDetails)==null?void 0:Jh.simCardNumber)||"",receiverModel:((Xh=ne.tvDetails)==null?void 0:Xh.receiverModel)||"",smartcardNumber:((Yh=ne.tvDetails)==null?void 0:Yh.smartcardNumber)||"",tvPackage:((ef=ne.tvDetails)==null?void 0:ef.package)||"",licensePlate:((tf=ne.carInsuranceDetails)==null?void 0:tf.licensePlate)||"",hsn:((sf=ne.carInsuranceDetails)==null?void 0:sf.hsn)||"",tsn:((nf=ne.carInsuranceDetails)==null?void 0:nf.tsn)||"",vin:((rf=ne.carInsuranceDetails)==null?void 0:rf.vin)||"",vehicleType:((af=ne.carInsuranceDetails)==null?void 0:af.vehicleType)||"",firstRegistration:(lf=ne.carInsuranceDetails)!=null&&lf.firstRegistration?ne.carInsuranceDetails.firstRegistration.split("T")[0]:"",noClaimsClass:((of=ne.carInsuranceDetails)==null?void 0:of.noClaimsClass)||"",insuranceType:((cf=ne.carInsuranceDetails)==null?void 0:cf.insuranceType)||"LIABILITY",deductiblePartial:((df=ne.carInsuranceDetails)==null?void 0:df.deductiblePartial)||"",deductibleFull:((uf=ne.carInsuranceDetails)==null?void 0:uf.deductibleFull)||"",policyNumber:((mf=ne.carInsuranceDetails)==null?void 0:mf.policyNumber)||"",previousInsurer:((hf=ne.carInsuranceDetails)==null?void 0:hf.previousInsurer)||"",cancellationConfirmationDate:ne.cancellationConfirmationDate?ne.cancellationConfirmationDate.split("T")[0]:"",cancellationConfirmationOptionsDate:ne.cancellationConfirmationOptionsDate?ne.cancellationConfirmationOptionsDate.split("T")[0]:"",wasSpecialCancellation:ne.wasSpecialCancellation||!1,previousContractId:((ff=ne.previousContractId)==null?void 0:ff.toString())||"",previousProviderId:((pf=ne.previousProviderId)==null?void 0:pf.toString())||"",previousCustomerNumber:ne.previousCustomerNumber||"",previousContractNumber:ne.previousContractNumber||""}),(xf=ne.mobileDetails)!=null&&xf.simCards&&ne.mobileDetails.simCards.length>0?R(ne.mobileDetails.simCards.map(ss=>({id:ss.id,phoneNumber:ss.phoneNumber||"",simCardNumber:ss.simCardNumber||"",pin:"",puk:"",hasExistingPin:!!ss.pin,hasExistingPuk:!!ss.puk,isMultisim:ss.isMultisim,isMain:ss.isMain}))):R([]),(gf=ne.internetDetails)!=null&&gf.phoneNumbers&&ne.internetDetails.phoneNumbers.length>0?D(ne.internetDetails.phoneNumbers.map(ss=>({id:ss.id,phoneNumber:ss.phoneNumber||"",sipUsername:ss.sipUsername||"",sipPassword:"",hasExistingSipPassword:!!ss.sipPasswordEncrypted,sipServer:ss.sipServer||"",isMain:ss.isMain}))):D([]),ne.stressfreiEmailId?(B("stressfrei"),Q(ne.stressfreiEmailId.toString())):(B("manual"),Q("")),k(!0)}},[p,c,v,I,A,g]);const Z=d("startDate"),Fe=d("contractDurationId");j.useEffect(()=>{if(Z&&Fe&&(E!=null&&E.data)){const F=E.data.find(ie=>ie.id===parseInt(Fe));if(F){const ie=new Date(Z),pe=F.code.match(/^(\d+)([MTJ])$/);if(pe){const je=parseInt(pe[1]),ct=pe[2];let Ce=new Date(ie);ct==="T"?Ce.setDate(Ce.getDate()+je):ct==="M"?Ce.setMonth(Ce.getMonth()+je):ct==="J"&&Ce.setFullYear(Ce.getFullYear()+je),u("endDate",Ce.toISOString().split("T")[0])}}}},[Z,Fe,E,u]);const Xe=G({mutationFn:Oe.create,onSuccess:(F,ie)=>{r.invalidateQueries({queryKey:["contracts"]}),ie.customerId&&r.invalidateQueries({queryKey:["customer",ie.customerId.toString()]}),r.invalidateQueries({queryKey:["customers"]}),n(i?`/customers/${i}?tab=contracts`:"/contracts")}}),J=G({mutationFn:F=>Oe.update(parseInt(e),F),onSuccess:(F,ie)=>{r.invalidateQueries({queryKey:["contracts"]}),r.invalidateQueries({queryKey:["contract",e]}),ie.customerId&&r.invalidateQueries({queryKey:["customer",ie.customerId.toString()]}),r.invalidateQueries({queryKey:["customers"]}),n(`/contracts/${e}`)}}),ue=F=>{const ie=Ce=>{if(Ce==null||Ce==="")return;const ci=parseInt(String(Ce));return isNaN(ci)?void 0:ci},we=kt.find(Ce=>Ce.code===F.type),pe=ie(F.customerId);if(!pe){alert("Bitte wählen Sie einen Kunden aus");return}if(!F.type||!we){alert("Bitte wählen Sie einen Vertragstyp aus");return}const je=Ce=>Ce==null||Ce===""?null:Ce,ct={customerId:pe,type:F.type,contractCategoryId:we.id,status:F.status,addressId:ie(F.addressId)??null,billingAddressId:ie(F.billingAddressId)??null,bankCardId:ie(F.bankCardId)??null,identityDocumentId:ie(F.identityDocumentId)??null,salesPlatformId:ie(F.salesPlatformId)??null,providerId:ie(F.providerId)??null,tariffId:ie(F.tariffId)??null,providerName:je(F.providerName),tariffName:je(F.tariffName),customerNumberAtProvider:je(F.customerNumberAtProvider),contractNumberAtProvider:je(F.contractNumberAtProvider),priceFirst12Months:je(F.priceFirst12Months),priceFrom13Months:je(F.priceFrom13Months),priceAfter24Months:je(F.priceAfter24Months),startDate:F.startDate?new Date(F.startDate):null,endDate:F.endDate?new Date(F.endDate):null,cancellationPeriodId:ie(F.cancellationPeriodId)??null,contractDurationId:ie(F.contractDurationId)??null,commission:F.commission?parseFloat(F.commission):null,portalUsername:K==="manual"?je(F.portalUsername):null,stressfreiEmailId:K==="stressfrei"&&_?parseInt(_):null,portalPassword:F.portalPassword||void 0,notes:je(F.notes),cancellationConfirmationDate:F.cancellationConfirmationDate?new Date(F.cancellationConfirmationDate):null,cancellationConfirmationOptionsDate:F.cancellationConfirmationOptionsDate?new Date(F.cancellationConfirmationOptionsDate):null,wasSpecialCancellation:F.wasSpecialCancellation||!1,previousContractId:ie(F.previousContractId)??null,previousProviderId:F.previousContractId?null:ie(F.previousProviderId)??null,previousCustomerNumber:F.previousContractId?null:je(F.previousCustomerNumber),previousContractNumber:F.previousContractId?null:je(F.previousContractNumber)};["ELECTRICITY","GAS"].includes(F.type)&&(ct.energyDetails={meterId:ie(F.meterId)??null,maloId:je(F.maloId),annualConsumption:F.annualConsumption?parseFloat(F.annualConsumption):null,annualConsumptionKwh:F.annualConsumptionKwh?parseFloat(F.annualConsumptionKwh):null,basePrice:F.basePrice?parseFloat(F.basePrice):null,unitPrice:F.unitPrice?parseFloat(F.unitPrice):null,bonus:F.bonus?parseFloat(F.bonus):null}),["DSL","CABLE","FIBER"].includes(F.type)&&(ct.internetDetails={downloadSpeed:ie(F.downloadSpeed)??null,uploadSpeed:ie(F.uploadSpeed)??null,routerModel:je(F.routerModel),routerSerialNumber:je(F.routerSerialNumber),installationDate:F.installationDate?new Date(F.installationDate):null,internetUsername:je(F.internetUsername),internetPassword:F.internetPassword||void 0,homeId:je(F.homeId),activationCode:je(F.activationCode),phoneNumbers:q.length>0?q.map(Ce=>({id:Ce.id,phoneNumber:Ce.phoneNumber||"",isMain:Ce.isMain??!1,sipUsername:je(Ce.sipUsername),sipPassword:Ce.sipPassword||void 0,sipServer:je(Ce.sipServer)})):void 0}),F.type==="MOBILE"&&(ct.mobileDetails={requiresMultisim:F.requiresMultisim||!1,dataVolume:F.dataVolume?parseFloat(F.dataVolume):null,includedMinutes:ie(F.includedMinutes)??null,includedSMS:ie(F.includedSMS)??null,deviceModel:je(F.deviceModel),deviceImei:je(F.deviceImei),phoneNumber:je(F.phoneNumber),simCardNumber:je(F.simCardNumber),simCards:O.length>0?O.map(Ce=>({id:Ce.id,phoneNumber:je(Ce.phoneNumber),simCardNumber:je(Ce.simCardNumber),pin:Ce.pin||void 0,puk:Ce.puk||void 0,isMultisim:Ce.isMultisim,isMain:Ce.isMain})):void 0}),F.type==="TV"&&(ct.tvDetails={receiverModel:je(F.receiverModel),smartcardNumber:je(F.smartcardNumber),package:je(F.tvPackage)}),F.type==="CAR_INSURANCE"&&(ct.carInsuranceDetails={licensePlate:je(F.licensePlate),hsn:je(F.hsn),tsn:je(F.tsn),vin:je(F.vin),vehicleType:je(F.vehicleType),firstRegistration:F.firstRegistration?new Date(F.firstRegistration):null,noClaimsClass:je(F.noClaimsClass),insuranceType:F.insuranceType,deductiblePartial:F.deductiblePartial?parseFloat(F.deductiblePartial):null,deductibleFull:F.deductibleFull?parseFloat(F.deductibleFull):null,policyNumber:je(F.policyNumber),previousInsurer:je(F.previousInsurer)}),a?J.mutate(ct):Xe.mutate(ct)},ts=Xe.isPending||J.isPending,cn=Xe.error||J.error,gt=g==null?void 0:g.data,L=(gt==null?void 0:gt.addresses)||[],U=((li=gt==null?void 0:gt.bankCards)==null?void 0:li.filter(F=>F.isActive))||[],W=((Rl=gt==null?void 0:gt.identityDocuments)==null?void 0:Rl.filter(F=>F.isActive))||[],ce=((oi=gt==null?void 0:gt.meters)==null?void 0:oi.filter(F=>F.isActive))||[],se=((bh=gt==null?void 0:gt.stressfreiEmails)==null?void 0:bh.filter(F=>F.isActive))||[],ee=(v==null?void 0:v.data)||[],ye=(N==null?void 0:N.data)||[],Le=(E==null?void 0:E.data)||[],Me=((Nh=A==null?void 0:A.data)==null?void 0:Nh.filter(F=>F.isActive))||[],kt=((wh=I==null?void 0:I.data)==null?void 0:wh.filter(F=>F.isActive).sort((F,ie)=>F.sortOrder-ie.sortOrder))||[],dn=kt.map(F=>({value:F.code,label:F.name})),Hs=((y==null?void 0:y.data)||[]).filter(F=>!a||F.id!==parseInt(e)).sort((F,ie)=>new Date(ie.startDate||0).getTime()-new Date(F.startDate||0).getTime()),Ln=Me.find(F=>F.id===parseInt(w||"0")),ii=((Sh=Ln==null?void 0:Ln.tariffs)==null?void 0:Sh.filter(F=>F.isActive))||[],sa=F=>{const ie=F.companyName||`${F.firstName} ${F.lastName}`,we=F.birthDate?` (geb. ${new Date(F.birthDate).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"})})`:"";return`${F.customerNumber} - ${ie}${we}`},Rc=(()=>{var we;const ie=((b==null?void 0:b.data)||[]).map(pe=>({value:pe.id.toString(),label:sa(pe)}));if(a&&((we=p==null?void 0:p.data)!=null&&we.customer)){const pe=p.data.customer;ie.some(ct=>ct.value===pe.id.toString())||ie.unshift({value:pe.id.toString(),label:sa(pe)})}return ie})();return s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold mb-6",children:a?"Vertrag bearbeiten":"Neuer Vertrag"}),cn&&s.jsx("div",{className:"mb-4 p-4 bg-red-50 border border-red-200 text-red-700 rounded-lg",children:cn instanceof Error?cn.message:"Ein Fehler ist aufgetreten"}),s.jsxs("form",{onSubmit:o(ue),children:[s.jsx(X,{className:"mb-6",title:"Vertragsdaten",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(Ie,{label:"Kunde *",...l("customerId",{required:"Kunde erforderlich"}),options:Rc,error:(kh=h.customerId)==null?void 0:kh.message}),s.jsx(Ie,{label:"Vertragstyp *",...l("type",{required:"Typ erforderlich"}),options:dn}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Status"}),s.jsx("button",{type:"button",onClick:()=>xt(!0),className:"text-gray-400 hover:text-blue-600 transition-colors",title:"Status-Erklärung",children:s.jsx(Al,{className:"w-4 h-4"})})]}),s.jsx(Ie,{...l("status"),options:gC})]}),s.jsx(Ie,{label:"Vertriebsplattform",...l("salesPlatformId"),options:ee.map(F=>({value:F.id,label:F.name}))}),m&&s.jsx(Ie,{label:"Vorgänger-Vertrag",...l("previousContractId"),options:Hs.map(F=>({value:F.id,label:`${F.contractNumber} (${F.type}${F.startDate?` - ${new Date(F.startDate).toLocaleDateString("de-DE")}`:""})`})),placeholder:"Keinen Vorgänger auswählen"}),m&&!f&&s.jsxs("div",{className:"mt-4 p-4 bg-gray-50 rounded-lg border border-gray-200",children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-3",children:"Altanbieter-Daten"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[s.jsx(Ie,{label:"Altanbieter",...l("previousProviderId"),options:Me.map(F=>({value:F.id,label:F.name})),placeholder:"Bitte wählen..."}),s.jsx(H,{label:"Kundennr. beim Altanbieter",...l("previousCustomerNumber")}),s.jsx(H,{label:"Vertragsnr. beim Altanbieter",...l("previousContractNumber")})]})]})]})}),m&&s.jsxs(X,{className:"mb-6",title:"Kundendaten verknüpfen",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[s.jsx(Ie,{label:"Lieferadresse",...l("addressId"),options:L.filter(F=>F.type==="DELIVERY_RESIDENCE").map(F=>({value:F.id,label:`${F.street} ${F.houseNumber}, ${F.postalCode} ${F.city}`}))}),s.jsx(Ie,{label:"Rechnungsadresse",...l("billingAddressId"),options:L.filter(F=>F.type==="BILLING").map(F=>({value:F.id,label:`${F.street} ${F.houseNumber}, ${F.postalCode} ${F.city}`})),placeholder:"Wie Lieferadresse"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(Ie,{label:"Bankkarte",...l("bankCardId"),options:U.map(F=>({value:F.id,label:`${F.iban} (${F.accountHolder})`}))}),s.jsx(Ie,{label:"Ausweis",...l("identityDocumentId"),options:W.map(F=>({value:F.id,label:`${F.documentNumber} (${F.type})`}))})]})]}),s.jsx(X,{className:"mb-6",title:"Anbieter & Tarif",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(Ie,{label:"Anbieter",...l("providerId"),options:Me.map(F=>({value:F.id,label:F.name}))}),s.jsx(Ie,{label:"Tarif",...l("tariffId"),options:ii.map(F=>({value:F.id,label:F.name})),disabled:!w}),s.jsx(H,{label:"Kundennummer beim Anbieter",...l("customerNumberAtProvider")}),s.jsx(H,{label:"Vertragsnummer beim Anbieter",...l("contractNumberAtProvider")}),s.jsx(H,{label:"Provision (€)",type:"number",step:"0.01",...l("commission")}),s.jsx(H,{label:"Preis erste 12 Monate",...l("priceFirst12Months"),placeholder:"z.B. 29,99 €/Monat"}),s.jsx(H,{label:"Preis ab 13. Monat",...l("priceFrom13Months"),placeholder:"z.B. 39,99 €/Monat"}),s.jsx(H,{label:"Preis nach 24 Monaten",...l("priceAfter24Months"),placeholder:"z.B. 49,99 €/Monat"})]})}),s.jsxs(X,{className:"mb-6",title:"Laufzeit und Kündigung",children:[s.jsxs("p",{className:"text-sm text-gray-500 mb-4 bg-blue-50 border border-blue-200 rounded-lg p-3",children:[s.jsx("strong",{children:"Hinweis:"})," Ist die Laufzeit ≤ 4 Wochen, 1 Monat oder 30 Tage, gilt der Vertrag als unbefristet mit der jeweiligen Kündigungsfrist."]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"Vertragsbeginn",type:"date",...l("startDate"),value:d("startDate")||"",onClear:()=>u("startDate","")}),s.jsx(H,{label:"Vertragsende (berechnet)",type:"date",...l("endDate"),disabled:!0,className:"bg-gray-50"}),s.jsx(Ie,{label:"Vertragslaufzeit",...l("contractDurationId"),options:Le.map(F=>({value:F.id,label:F.description}))}),s.jsx(Ie,{label:"Kündigungsfrist",...l("cancellationPeriodId"),options:ye.map(F=>({value:F.id,label:F.description}))}),s.jsx(H,{label:"Kündigungsbestätigungsdatum",type:"date",...l("cancellationConfirmationDate"),value:d("cancellationConfirmationDate")||"",onClear:()=>u("cancellationConfirmationDate","")}),s.jsx(H,{label:"Kündigungsbestätigungsoptionendatum",type:"date",...l("cancellationConfirmationOptionsDate"),value:d("cancellationConfirmationOptionsDate")||"",onClear:()=>u("cancellationConfirmationOptionsDate","")}),s.jsx("div",{className:"col-span-2",children:s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",...l("wasSpecialCancellation"),className:"rounded border-gray-300"}),s.jsx("span",{children:"Wurde sondergekündigt?"})]})})]})]}),s.jsx(X,{className:"mb-6",title:"Zugangsdaten (verschlüsselt gespeichert)",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Portal Benutzername"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"radio",name:"usernameType",checked:K==="manual",onChange:()=>{B("manual"),Q("")},className:"text-blue-600"}),s.jsx("span",{className:"text-sm",children:"Manuell eingeben"})]}),K==="manual"&&s.jsx(H,{...l("portalUsername"),placeholder:"Benutzername eingeben..."}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"radio",name:"usernameType",checked:K==="stressfrei",onChange:()=>{B("stressfrei"),u("portalUsername","")},className:"text-blue-600"}),s.jsx("span",{className:"text-sm",children:"Stressfrei-Wechseln Adresse"})]}),K==="stressfrei"&&s.jsx(Ie,{value:_,onChange:F=>Q(F.target.value),options:se.map(F=>({value:F.id,label:F.email+(F.notes?` (${F.notes})`:"")})),placeholder:se.length===0?"Keine Stressfrei-Adressen vorhanden":"Adresse auswählen..."}),K==="stressfrei"&&se.length===0&&s.jsx("p",{className:"text-xs text-amber-600",children:"Keine Stressfrei-Wechseln Adressen für diesen Kunden vorhanden. Bitte zuerst beim Kunden anlegen."})]})]}),s.jsxs("div",{className:"mt-8",children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:a?"Neues Passwort (leer lassen = unverändert)":"Portal Passwort"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:le?"text":"password",...l("portalPassword"),className:"block w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("button",{type:"button",onClick:()=>de(!le),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600",children:le?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Pe,{className:"w-4 h-4"})})]})]})]})}),["ELECTRICITY","GAS"].includes(x)&&s.jsxs(X,{className:"mb-6",title:x==="ELECTRICITY"?"Strom-Details":"Gas-Details",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(Ie,{label:"Zähler",...l("meterId"),options:ce.filter(F=>F.type===x).map(F=>({value:F.id,label:`${F.meterNumber}${F.location?` (${F.location})`:""}`}))}),s.jsx(H,{label:"MaLo-ID (Marktlokations-ID)",...l("maloId")}),s.jsx(H,{label:`Jahresverbrauch (${x==="ELECTRICITY"?"kWh":"m³"})`,type:"number",...l("annualConsumption")}),x==="GAS"&&s.jsx(H,{label:"Jahresverbrauch (kWh)",type:"number",...l("annualConsumptionKwh")}),s.jsx(H,{label:"Grundpreis (€/Monat)",type:"number",step:"any",...l("basePrice")}),s.jsx(H,{label:"Arbeitspreis (€/kWh)",type:"number",step:"any",...l("unitPrice")}),s.jsx(H,{label:"Bonus (€)",type:"number",step:"0.01",...l("bonus")})]}),a&&s.jsxs("div",{className:"mt-4 p-3 bg-blue-50 border border-blue-200 rounded-lg text-sm text-blue-700",children:[s.jsx("strong",{children:"Hinweis:"})," Zählerstände und Rechnungen werden in der"," ",s.jsx("span",{className:"font-medium",children:"Vertragsdetailansicht"})," verwaltet, nicht hier im Bearbeitungsformular."]})]}),["DSL","CABLE","FIBER"].includes(x)&&s.jsxs(s.Fragment,{children:[s.jsx(X,{className:"mb-6",title:x==="DSL"?"DSL-Details":x==="CABLE"?"Kabelinternet-Details":"Glasfaser-Details",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"Download (Mbit/s)",type:"number",...l("downloadSpeed")}),s.jsx(H,{label:"Upload (Mbit/s)",type:"number",...l("uploadSpeed")}),s.jsx(H,{label:"Router Modell",...l("routerModel")}),s.jsx(H,{label:"Router Seriennummer",...l("routerSerialNumber")}),s.jsx(H,{label:"Installationsdatum",type:"date",...l("installationDate"),value:d("installationDate")||"",onClear:()=>u("installationDate","")}),x==="FIBER"&&s.jsx(H,{label:"Home-ID",...l("homeId")}),((Ch=Ln==null?void 0:Ln.name)==null?void 0:Ch.toLowerCase().includes("vodafone"))&&["DSL","CABLE"].includes(x)&&s.jsx(H,{label:"Aktivierungscode",...l("activationCode")})]})}),s.jsx(X,{className:"mb-6",title:"Internet-Zugangsdaten (verschlüsselt)",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"Benutzername",...l("internetUsername")}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:a?"Neues Passwort (leer = beibehalten)":"Passwort"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:_e?"text":"password",...l("internetPassword"),className:"block w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("button",{type:"button",onClick:()=>qe(!_e),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600",children:_e?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Pe,{className:"w-4 h-4"})})]})]})]})}),s.jsxs(X,{className:"mb-6",title:"Rufnummern & SIP-Zugangsdaten",children:[s.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Hier können Sie Festnetz-Rufnummern mit SIP-Zugangsdaten erfassen."}),q.length>0&&s.jsx("div",{className:"space-y-4 mb-4",children:q.map((F,ie)=>s.jsxs("div",{className:"p-4 border rounded-lg bg-gray-50",children:[s.jsxs("div",{className:"flex justify-between items-center mb-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("span",{className:"font-medium",children:["Rufnummer ",ie+1]}),s.jsxs("label",{className:"flex items-center gap-1 text-sm",children:[s.jsx("input",{type:"checkbox",checked:F.isMain,onChange:we=>{const pe=[...q];we.target.checked?pe.forEach((je,ct)=>je.isMain=ct===ie):pe[ie].isMain=!1,D(pe)},className:"rounded border-gray-300"}),"Hauptnummer"]})]}),s.jsx(T,{type:"button",variant:"ghost",size:"sm",onClick:()=>{D(q.filter((we,pe)=>pe!==ie))},children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[s.jsx(H,{label:"Rufnummer",value:F.phoneNumber,onChange:we=>{const pe=[...q];pe[ie].phoneNumber=we.target.value,D(pe)},placeholder:"z.B. 030 123456"}),s.jsx(H,{label:"SIP-Benutzername",value:F.sipUsername,onChange:we=>{const pe=[...q];pe[ie].sipUsername=we.target.value,D(pe)}}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:F.hasExistingSipPassword?"SIP-Passwort (bereits hinterlegt)":"SIP-Passwort"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:st[ie]?"text":"password",value:F.sipPassword,onChange:we=>{const pe=[...q];pe[ie].sipPassword=we.target.value,D(pe)},placeholder:F.hasExistingSipPassword?"Leer = beibehalten":"",className:"block w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("button",{type:"button",onClick:()=>C(we=>({...we,[ie]:!we[ie]})),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600",children:st[ie]?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Pe,{className:"w-4 h-4"})})]})]}),s.jsx(H,{label:"SIP-Server",value:F.sipServer,onChange:we=>{const pe=[...q];pe[ie].sipServer=we.target.value,D(pe)},placeholder:"z.B. sip.provider.de"})]})]},ie))}),s.jsxs(T,{type:"button",variant:"secondary",onClick:()=>{D([...q,{phoneNumber:"",sipUsername:"",sipPassword:"",sipServer:"",isMain:q.length===0}])},children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Rufnummer hinzufügen"]})]})]}),x==="MOBILE"&&s.jsxs(s.Fragment,{children:[s.jsxs(X,{className:"mb-6",title:"Mobilfunk-Details",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"Datenvolumen (GB)",type:"number",...l("dataVolume")}),s.jsx(H,{label:"Inklusiv-Minuten",type:"number",...l("includedMinutes")}),s.jsx(H,{label:"Inklusiv-SMS",type:"number",...l("includedSMS")}),s.jsx(H,{label:"Gerät (Modell)",...l("deviceModel")}),s.jsx(H,{label:"Gerät (IMEI)",...l("deviceImei")})]}),s.jsx("div",{className:"mt-4 pt-4 border-t",children:s.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[s.jsx("input",{type:"checkbox",...l("requiresMultisim"),className:"mt-1 rounded border-gray-300"}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium",children:"Multisim erforderlich"}),s.jsx("p",{className:"text-sm text-amber-600 mt-1",children:"Hinweis: Multisim ist bei Klarmobil, Congstar und Otelo nicht buchbar. Muss Freenet oder vergleichbar sein."})]})]})})]}),s.jsxs(X,{className:"mb-6",title:"SIM-Karten",children:[s.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Hier können Sie alle SIM-Karten zum Vertrag erfassen (Hauptkarte und Multisim-Karten)."}),O.length>0&&s.jsx("div",{className:"space-y-4 mb-4",children:O.map((F,ie)=>s.jsxs("div",{className:"p-4 border rounded-lg bg-gray-50",children:[s.jsxs("div",{className:"flex justify-between items-center mb-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("span",{className:"font-medium",children:["SIM-Karte ",ie+1]}),s.jsxs("label",{className:"flex items-center gap-1 text-sm",children:[s.jsx("input",{type:"checkbox",checked:F.isMain,onChange:we=>{const pe=[...O];we.target.checked?pe.forEach((je,ct)=>je.isMain=ct===ie):pe[ie].isMain=!1,R(pe)},className:"rounded border-gray-300"}),"Hauptkarte"]}),s.jsxs("label",{className:"flex items-center gap-1 text-sm",children:[s.jsx("input",{type:"checkbox",checked:F.isMultisim,onChange:we=>{const pe=[...O];pe[ie].isMultisim=we.target.checked,R(pe)},className:"rounded border-gray-300"}),"Multisim"]})]}),s.jsx(T,{type:"button",variant:"ghost",size:"sm",onClick:()=>{R(O.filter((we,pe)=>pe!==ie))},children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:[s.jsx(H,{label:"Rufnummer",value:F.phoneNumber,onChange:we=>{const pe=[...O];pe[ie].phoneNumber=we.target.value,R(pe)},placeholder:"z.B. 0171 1234567"}),s.jsx(H,{label:"SIM-Kartennummer",value:F.simCardNumber,onChange:we=>{const pe=[...O];pe[ie].simCardNumber=we.target.value,R(pe)},placeholder:"ICCID"}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:F.hasExistingPin?"PIN (bereits hinterlegt)":"PIN"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:nt[ie]?"text":"password",value:F.pin,onChange:we=>{const pe=[...O];pe[ie].pin=we.target.value,R(pe)},placeholder:F.hasExistingPin?"Leer = beibehalten":"4-stellig",className:"block w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("button",{type:"button",onClick:()=>es(we=>({...we,[ie]:!we[ie]})),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600",children:nt[ie]?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Pe,{className:"w-4 h-4"})})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:F.hasExistingPuk?"PUK (bereits hinterlegt)":"PUK"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:Vt[ie]?"text":"password",value:F.puk,onChange:we=>{const pe=[...O];pe[ie].puk=we.target.value,R(pe)},placeholder:F.hasExistingPuk?"Leer = beibehalten":"8-stellig",className:"block w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("button",{type:"button",onClick:()=>ae(we=>({...we,[ie]:!we[ie]})),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600",children:Vt[ie]?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Pe,{className:"w-4 h-4"})})]})]})]})]},ie))}),s.jsxs(T,{type:"button",variant:"secondary",onClick:()=>{R([...O,{phoneNumber:"",simCardNumber:"",pin:"",puk:"",isMultisim:!1,isMain:O.length===0}])},children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"SIM-Karte hinzufügen"]})]})]}),x==="TV"&&s.jsx(X,{className:"mb-6",title:"TV-Details",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(H,{label:"Receiver Modell",...l("receiverModel")}),s.jsx(H,{label:"Smartcard-Nummer",...l("smartcardNumber")}),s.jsx(H,{label:"Paket",...l("tvPackage"),placeholder:"z.B. Basis, Premium, Sport"})]})}),x==="CAR_INSURANCE"&&s.jsx(X,{className:"mb-6",title:"KFZ-Versicherung Details",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[s.jsx(H,{label:"Kennzeichen",...l("licensePlate")}),s.jsx(H,{label:"HSN",...l("hsn")}),s.jsx(H,{label:"TSN",...l("tsn")}),s.jsx(H,{label:"FIN (VIN)",...l("vin")}),s.jsx(H,{label:"Fahrzeugtyp",...l("vehicleType")}),s.jsx(H,{label:"Erstzulassung",type:"date",...l("firstRegistration"),value:d("firstRegistration")||"",onClear:()=>u("firstRegistration","")}),s.jsx(H,{label:"SF-Klasse",...l("noClaimsClass")}),s.jsx(Ie,{label:"Versicherungsart",...l("insuranceType"),options:[{value:"LIABILITY",label:"Haftpflicht"},{value:"PARTIAL",label:"Teilkasko"},{value:"FULL",label:"Vollkasko"}]}),s.jsx(H,{label:"SB Teilkasko (€)",type:"number",...l("deductiblePartial")}),s.jsx(H,{label:"SB Vollkasko (€)",type:"number",...l("deductibleFull")}),s.jsx(H,{label:"Versicherungsscheinnummer",...l("policyNumber")}),s.jsx(H,{label:"Vorversicherer",...l("previousInsurer")})]})}),s.jsx(X,{className:"mb-6",title:"Notizen",children:s.jsx("textarea",{...l("notes"),rows:4,className:"block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Interne Notizen..."})}),s.jsxs("div",{className:"flex justify-end gap-4",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:()=>n(-1),children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:ts,children:ts?"Speichern...":"Speichern"})]})]}),s.jsx(vC,{isOpen:We,onClose:()=>xt(!1)})]})}const jC={ELECTRICITY:ph,GAS:Cv,DSL:Ea,CABLE:Ea,FIBER:Ea,MOBILE:hh,TV:Tv,CAR_INSURANCE:kv},bC={ELECTRICITY:"Strom",GAS:"Gas",DSL:"DSL",CABLE:"Kabel",FIBER:"Glasfaser",MOBILE:"Mobilfunk",TV:"TV",CAR_INSURANCE:"KFZ"},NC={critical:"bg-red-100 border-red-300 text-red-800",warning:"bg-yellow-100 border-yellow-300 text-yellow-800",ok:"bg-green-100 border-green-300 text-green-800",none:"bg-gray-100 border-gray-300 text-gray-800"},wC={critical:"danger",warning:"warning",ok:"success",none:"default"},SC={cancellation_deadline:Sv,contract_ending:Mn,missing_cancellation_letter:Ke,missing_cancellation_confirmation:Ke,missing_portal_credentials:R2,missing_customer_number:Ke,missing_provider:Ke,missing_address:Ke,missing_bank:Ke,missing_meter:ph,missing_sim:hh,open_tasks:cl,pending_status:Mn,draft_status:Ke,review_due:mh,missing_invoice:uh},kC={cancellationDeadlines:"Kündigungsfristen",contractEnding:"Vertragsenden",missingCredentials:"Fehlende Zugangsdaten",missingData:"Fehlende Daten",openTasks:"Offene Aufgaben",pendingContracts:"Wartende Verträge",missingInvoices:"Fehlende Rechnungen",reviewDue:"Erneute Prüfung fällig"};function CC(){var w;const[e,t]=wc(),[n,r]=j.useState(new Set),a=e.get("filter"),[i,l]=j.useState(a||"all");j.useEffect(()=>{i==="all"?e.delete("filter"):e.set("filter",i),t(e,{replace:!0})},[i,e,t]);const{data:o,isLoading:c,error:d}=fe({queryKey:["contract-cockpit"],queryFn:()=>Oe.getCockpit(),staleTime:0}),u=ge(),[h,x]=j.useState(null),[m,f]=j.useState(""),p=j.useRef(null);j.useEffect(()=>{const S=P=>{p.current&&!p.current.contains(P.target)&&(x(null),f(""))};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);const b=G({mutationFn:({contractId:S,data:P})=>Oe.snooze(S,P),onSuccess:()=>{u.invalidateQueries({queryKey:["contract-cockpit"]}),x(null),f("")}}),g=(S,P)=>{P?b.mutate({contractId:S,data:{months:P}}):m&&b.mutate({contractId:S,data:{nextReviewDate:m}})},y=S=>{b.mutate({contractId:S,data:{}})},v=S=>{r(P=>{const O=new Set(P);return O.has(S)?O.delete(S):O.add(S),O})},N=j.useMemo(()=>{var P;if(!((P=o==null?void 0:o.data)!=null&&P.contracts))return[];const S=o.data.contracts;switch(i){case"critical":return S.filter(O=>O.highestUrgency==="critical");case"warning":return S.filter(O=>O.highestUrgency==="warning");case"ok":return S.filter(O=>O.highestUrgency==="ok");case"deadlines":return S.filter(O=>O.issues.some(R=>["cancellation_deadline","contract_ending"].includes(R.type)));case"credentials":return S.filter(O=>O.issues.some(R=>R.type.includes("credentials")));case"data":return S.filter(O=>O.issues.some(R=>R.type.startsWith("missing_")&&!R.type.includes("credentials")));case"tasks":return S.filter(O=>O.issues.some(R=>["open_tasks","pending_status","draft_status"].includes(R.type)));case"review":return S.filter(O=>O.issues.some(R=>R.type==="review_due"));case"invoices":return S.filter(O=>O.issues.some(R=>R.type.includes("invoice")));default:return S}},[(w=o==null?void 0:o.data)==null?void 0:w.contracts,i]);if(c)return s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx("div",{className:"text-gray-500",children:"Laden..."})});if(d||!(o!=null&&o.data))return s.jsx("div",{className:"text-center py-12",children:s.jsx("p",{className:"text-red-500",children:"Fehler beim Laden des Cockpits"})});const{summary:E,thresholds:A}=o.data,I=S=>{var R,q,D,z;const P=n.has(S.id),O=jC[S.type]||Ke;return s.jsxs("div",{className:`border rounded-lg mb-2 ${NC[S.highestUrgency]}`,children:[s.jsxs("div",{className:"flex items-center p-4 cursor-pointer hover:bg-opacity-50",onClick:()=>v(S.id),children:[s.jsx("div",{className:"w-6 mr-2",children:P?s.jsx(Rn,{className:"w-5 h-5"}):s.jsx(Ft,{className:"w-5 h-5"})}),s.jsx(O,{className:"w-5 h-5 mr-3"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(ke,{to:`/contracts/${S.id}`,state:{from:"cockpit",filter:i!=="all"?i:void 0},className:"font-medium hover:underline",onClick:k=>k.stopPropagation(),children:S.contractNumber}),s.jsxs(ve,{variant:wC[S.highestUrgency],children:[S.issues.length," ",S.highestUrgency==="ok"?S.issues.length===1?"Hinweis":"Hinweise":S.issues.length===1?"Problem":"Probleme"]}),s.jsx("span",{className:"text-sm",children:bC[S.type]})]}),s.jsxs("div",{className:"text-sm mt-1",children:[s.jsxs(ke,{to:`/customers/${S.customer.id}`,className:"hover:underline",onClick:k=>k.stopPropagation(),children:[S.customer.customerNumber," - ",S.customer.name]}),(((R=S.provider)==null?void 0:R.name)||S.providerName)&&s.jsxs("span",{className:"ml-2",children:["| ",((q=S.provider)==null?void 0:q.name)||S.providerName,(((D=S.tariff)==null?void 0:D.name)||S.tariffName)&&` - ${((z=S.tariff)==null?void 0:z.name)||S.tariffName}`]})]})]}),s.jsxs("div",{className:"flex items-center gap-1 ml-4",children:[s.jsxs("div",{className:"relative",ref:h===S.id?p:void 0,children:[s.jsx("button",{onClick:k=>{k.stopPropagation(),x(h===S.id?null:S.id),f("")},className:"p-2 hover:bg-white hover:bg-opacity-50 rounded",title:"Zurückstellen",children:s.jsx(wv,{className:"w-4 h-4"})}),h===S.id&&s.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 bg-white border rounded-lg shadow-lg z-50 p-3",onClick:k=>k.stopPropagation(),children:[s.jsx("div",{className:"text-sm font-medium mb-2",children:"Zurückstellen"}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("button",{onClick:()=>g(S.id,3),className:"w-full text-left px-3 py-2 text-sm hover:bg-gray-100 rounded",disabled:b.isPending,children:"+3 Monate"}),s.jsxs("button",{onClick:()=>g(S.id,6),className:"w-full text-left px-3 py-2 text-sm hover:bg-gray-100 rounded bg-blue-50 border-blue-200",disabled:b.isPending,children:["+6 Monate ",s.jsx("span",{className:"text-xs text-gray-500",children:"(Empfohlen)"})]}),s.jsx("button",{onClick:()=>g(S.id,12),className:"w-full text-left px-3 py-2 text-sm hover:bg-gray-100 rounded",disabled:b.isPending,children:"+12 Monate"})]}),s.jsxs("div",{className:"border-t mt-2 pt-2",children:[s.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Eigenes Datum:"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(H,{type:"date",value:m,onChange:k=>f(k.target.value),className:"flex-1 text-sm",min:new Date().toISOString().split("T")[0]}),s.jsx(T,{size:"sm",onClick:()=>g(S.id),disabled:!m||b.isPending,children:"OK"})]})]}),S.issues.some(k=>k.type==="review_due")&&s.jsx("div",{className:"border-t mt-2 pt-2",children:s.jsxs("button",{onClick:()=>y(S.id),className:"w-full text-left px-3 py-2 text-sm hover:bg-red-50 text-red-600 rounded flex items-center gap-2",disabled:b.isPending,children:[s.jsx(mh,{className:"w-4 h-4"}),"Snooze aufheben"]})})]})]}),s.jsx(ke,{to:`/contracts/${S.id}`,state:{from:"cockpit",filter:i!=="all"?i:void 0},className:"p-2 hover:bg-white hover:bg-opacity-50 rounded",onClick:k=>k.stopPropagation(),title:"Zum Vertrag",children:s.jsx(Pe,{className:"w-4 h-4"})})]})]}),P&&s.jsx("div",{className:"border-t px-4 py-3 bg-white bg-opacity-50",children:s.jsx("div",{className:"space-y-2",children:S.issues.map((k,K)=>{const B=SC[k.type]||wn,_=k.urgency==="critical"?wn:k.urgency==="warning"?hs:k.urgency==="ok"?Ps:Mn;return s.jsxs("div",{className:"flex items-start gap-3 text-sm",children:[s.jsx(_,{className:`w-4 h-4 mt-0.5 flex-shrink-0 ${k.urgency==="critical"?"text-red-500":k.urgency==="warning"?"text-yellow-500":k.urgency==="ok"?"text-green-500":"text-gray-500"}`}),s.jsx(B,{className:"w-4 h-4 mt-0.5 flex-shrink-0 text-gray-500"}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium",children:k.label}),k.details&&s.jsx("span",{className:"text-gray-600 ml-2",children:k.details})]})]},K)})})})]},S.id)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(wn,{className:"w-6 h-6 text-red-500"}),s.jsx("h1",{className:"text-2xl font-bold",children:"Vertrags-Cockpit"})]}),s.jsx(ke,{to:"/settings/deadlines",className:"text-sm text-blue-600 hover:underline",children:"Fristenschwellen anpassen"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[s.jsx(X,{className:"!p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-red-100 rounded-lg",children:s.jsx(wn,{className:"w-6 h-6 text-red-500"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-red-600",children:E.criticalCount}),s.jsxs("p",{className:"text-sm text-gray-500",children:["Kritisch (<",A.criticalDays," Tage)"]})]})]})}),s.jsx(X,{className:"!p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-yellow-100 rounded-lg",children:s.jsx(hs,{className:"w-6 h-6 text-yellow-500"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-yellow-600",children:E.warningCount}),s.jsxs("p",{className:"text-sm text-gray-500",children:["Warnung (<",A.warningDays," Tage)"]})]})]})}),s.jsx(X,{className:"!p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:s.jsx(Ps,{className:"w-6 h-6 text-green-500"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-green-600",children:E.okCount}),s.jsxs("p",{className:"text-sm text-gray-500",children:["OK (<",A.okDays," Tage)"]})]})]})}),s.jsx(X,{className:"!p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-gray-100 rounded-lg",children:s.jsx(Ke,{className:"w-6 h-6 text-gray-500"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold text-gray-600",children:E.totalContracts}),s.jsx("p",{className:"text-sm text-gray-500",children:"Verträge mit Handlungsbedarf"})]})]})})]}),s.jsx(X,{className:"mb-6",children:s.jsx("div",{className:"flex flex-wrap gap-4",children:Object.entries(E.byCategory).map(([S,P])=>P>0&&s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsxs("span",{className:"font-medium",children:[kC[S]||S,":"]}),s.jsx(ve,{variant:"default",children:P})]},S))})}),s.jsx(X,{className:"mb-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-sm text-gray-600",children:"Filter:"}),s.jsx(Ie,{value:i,onChange:S=>l(S.target.value),options:[{value:"all",label:`Alle (${o.data.contracts.length})`},{value:"critical",label:`Kritisch (${E.criticalCount})`},{value:"warning",label:`Warnung (${E.warningCount})`},{value:"ok",label:`OK (${E.okCount})`},{value:"deadlines",label:`Fristen (${E.byCategory.cancellationDeadlines+E.byCategory.contractEnding})`},{value:"credentials",label:`Zugangsdaten (${E.byCategory.missingCredentials})`},{value:"data",label:`Fehlende Daten (${E.byCategory.missingData})`},{value:"tasks",label:`Aufgaben/Status (${E.byCategory.openTasks+E.byCategory.pendingContracts})`},{value:"review",label:`Erneute Prüfung (${E.byCategory.reviewDue||0})`},{value:"invoices",label:`Fehlende Rechnungen (${E.byCategory.missingInvoices||0})`}],className:"w-64"}),s.jsxs("span",{className:"text-sm text-gray-500",children:[N.length," Verträge angezeigt"]})]})}),N.length===0?s.jsx(X,{children:s.jsx("div",{className:"text-center py-8 text-gray-500",children:i==="all"?s.jsxs(s.Fragment,{children:[s.jsx(Ps,{className:"w-12 h-12 mx-auto mb-4 text-green-500"}),s.jsx("p",{className:"text-lg font-medium",children:"Alles in Ordnung!"}),s.jsx("p",{children:"Keine Verträge mit Handlungsbedarf gefunden."})]}):s.jsx("p",{children:"Keine Verträge für diesen Filter gefunden."})})}):s.jsx("div",{children:N.map(I)})]})}const Kx={OPEN:"Offen",COMPLETED:"Erledigt"},EC={OPEN:"warning",COMPLETED:"success"};function DC(){var B;const e=Yt(),t=ge(),{isCustomerPortal:n,user:r,hasPermission:a}=He(),[i,l]=j.useState("OPEN"),[o,c]=j.useState(new Set),[d,u]=j.useState(!1),[h,x]=j.useState({}),[m,f]=j.useState(null),p=n?"Support-Anfragen":"Aufgaben",b=n?"Anfrage":"Aufgabe",{data:g,isLoading:y}=fe({queryKey:["app-settings-public"],queryFn:()=>Xr.getPublic(),enabled:n,staleTime:0}),v=!y&&((B=g==null?void 0:g.data)==null?void 0:B.customerSupportTicketsEnabled)==="true",{data:N,isLoading:E}=fe({queryKey:["all-tasks",i],queryFn:()=>et.getAll({status:i||void 0}),staleTime:0}),A=G({mutationFn:_=>et.completeSubtask(_),onSuccess:()=>{t.invalidateQueries({queryKey:["all-tasks"]}),t.invalidateQueries({queryKey:["task-stats"]})}}),I=G({mutationFn:_=>et.reopenSubtask(_),onSuccess:()=>{t.invalidateQueries({queryKey:["all-tasks"]}),t.invalidateQueries({queryKey:["task-stats"]})}}),w=G({mutationFn:({taskId:_,title:Q})=>n?et.createReply(_,Q):et.createSubtask(_,Q),onSuccess:(_,{taskId:Q})=>{t.invalidateQueries({queryKey:["all-tasks"]}),x(le=>({...le,[Q]:""}))}}),S=G({mutationFn:_=>et.delete(_),onSuccess:()=>{t.invalidateQueries({queryKey:["all-tasks"]}),t.invalidateQueries({queryKey:["task-stats"]})}}),P=G({mutationFn:({taskId:_,data:Q})=>et.update(_,Q),onSuccess:()=>{t.invalidateQueries({queryKey:["all-tasks"]}),f(null)}}),O=j.useMemo(()=>{var de;if(!(N!=null&&N.data))return{ownTasks:[],representedTasks:[],allTasks:[]};const _=N.data;if(!n)return{allTasks:_,ownTasks:[],representedTasks:[]};const Q=[],le=[];for(const _e of _)((de=_e.contract)==null?void 0:de.customerId)===(r==null?void 0:r.customerId)?Q.push(_e):le.push(_e);return{ownTasks:Q,representedTasks:le,allTasks:[]}},[N==null?void 0:N.data,n,r==null?void 0:r.customerId]),R=_=>{c(Q=>{const le=new Set(Q);return le.has(_)?le.delete(_):le.add(_),le})},q=_=>{A.isPending||I.isPending||(_.status==="COMPLETED"?I.mutate(_.id):A.mutate(_.id))},D=_=>{var le;const Q=(le=h[_])==null?void 0:le.trim();Q&&w.mutate({taskId:_,title:Q})},z=!n&&a("contracts:update"),k=(_,Q=!1)=>{var We,xt,Z,Fe,Xe,J;const le=o.has(_.id),de=_.subtasks&&_.subtasks.length>0,_e=((We=_.subtasks)==null?void 0:We.filter(ue=>ue.status==="COMPLETED").length)||0,qe=((xt=_.subtasks)==null?void 0:xt.length)||0,st=_.status==="COMPLETED",C=new Date(_.createdAt).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),nt=!n&&a("contracts:update"),es=!n&&a("contracts:update"),Vt=_.contract?`${_.contract.contractNumber} - ${((Z=_.contract.provider)==null?void 0:Z.name)||_.contract.providerName||"Kein Anbieter"}`:`Vertrag #${_.contractId}`,ae=(Fe=_.contract)!=null&&Fe.customer?_.contract.customer.companyName||`${_.contract.customer.firstName} ${_.contract.customer.lastName}`:"";return s.jsxs("div",{className:"border rounded-lg mb-2",children:[s.jsxs("div",{className:"flex items-center p-4 hover:bg-gray-50 cursor-pointer",onClick:()=>R(_.id),children:[s.jsx("div",{className:"w-6 mr-2",children:le?s.jsx(Rn,{className:"w-5 h-5 text-gray-400"}):s.jsx(Ft,{className:"w-5 h-5 text-gray-400"})}),s.jsx("div",{className:"mr-3",children:_.status==="COMPLETED"?s.jsx(Ps,{className:"w-5 h-5 text-green-500"}):s.jsx(Mn,{className:"w-5 h-5 text-yellow-500"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"font-medium",children:_.title}),s.jsx(ve,{variant:EC[_.status],children:Kx[_.status]}),de&&s.jsxs("span",{className:"text-xs text-gray-500",children:["(",_e,"/",qe," erledigt)"]})]}),s.jsxs("div",{className:"text-sm text-gray-500 mt-1 flex items-center gap-2",children:[s.jsx(Ke,{className:"w-4 h-4"}),s.jsx(ke,{to:`/contracts/${_.contractId}`,className:"text-blue-600 hover:underline",onClick:ue=>ue.stopPropagation(),children:Vt}),Q&&ae&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-gray-400",children:"|"}),s.jsx("span",{children:ae})]})]}),_.description&&s.jsx("p",{className:"text-sm text-gray-600 mt-1 line-clamp-2",children:_.description}),s.jsxs("div",{className:"text-xs text-gray-400 mt-1",children:[_.createdBy," • ",C]})]}),s.jsxs("div",{className:"ml-4 flex gap-2",children:[nt&&s.jsx(T,{variant:"ghost",size:"sm",onClick:ue=>{ue.stopPropagation(),f(_)},title:"Bearbeiten",children:s.jsx(Je,{className:"w-4 h-4"})}),es&&s.jsx(T,{variant:"ghost",size:"sm",onClick:ue=>{ue.stopPropagation(),confirm("Aufgabe wirklich löschen?")&&S.mutate(_.id)},title:"Löschen",className:"text-red-500 hover:text-red-700",children:s.jsx(Ne,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:ue=>{ue.stopPropagation(),e(`/contracts/${_.contractId}`)},title:"Zum Vertrag",children:s.jsx(Pe,{className:"w-4 h-4"})})]})]}),le&&s.jsxs("div",{className:"border-t bg-gray-50 px-4 py-3",children:[de&&s.jsx("div",{className:"space-y-2 mb-4",children:(Xe=_.subtasks)==null?void 0:Xe.map(ue=>{const ts=new Date(ue.createdAt).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"});return s.jsxs("div",{className:`flex items-start gap-2 text-sm ml-6 ${z?"cursor-pointer hover:bg-gray-100 rounded px-2 py-1 -mx-2":""}`,onClick:z?()=>q(ue):void 0,children:[s.jsx("span",{className:"flex-shrink-0 mt-0.5",children:ue.status==="COMPLETED"?s.jsx(Ps,{className:"w-4 h-4 text-green-500"}):s.jsx(No,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:ue.status==="COMPLETED"?"text-gray-500 line-through":"",children:[ue.title,s.jsxs("span",{className:"text-xs text-gray-400 ml-2",children:[ue.createdBy," • ",ts]})]})]},ue.id)})}),!st&&(z||n)&&s.jsxs("div",{className:"flex gap-2 ml-6",children:[s.jsx(H,{placeholder:n?"Antwort schreiben...":"Neue Unteraufgabe...",value:h[_.id]||"",onChange:ue=>x(ts=>({...ts,[_.id]:ue.target.value})),onKeyDown:ue=>{ue.key==="Enter"&&!ue.shiftKey&&(ue.preventDefault(),D(_.id))},className:"flex-1"}),s.jsx(T,{size:"sm",onClick:()=>D(_.id),disabled:!((J=h[_.id])!=null&&J.trim())||w.isPending,children:s.jsx(Tl,{className:"w-4 h-4"})})]}),!de&&st&&s.jsx("p",{className:"text-gray-500 text-sm text-center py-2",children:"Keine Unteraufgaben vorhanden."})]})]},_.id)},K=n?v:a("contracts:update");return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"text-2xl font-bold",children:p}),K&&s.jsxs(T,{onClick:()=>u(!0),children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Neue ",b]})]}),s.jsx(X,{className:"mb-6",children:s.jsx("div",{className:"flex gap-4 flex-wrap items-center",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-gray-600",children:"Status:"}),s.jsx(Ie,{value:i,onChange:_=>l(_.target.value),options:[{value:"",label:"Alle"},...Object.entries(Kx).map(([_,Q])=>({value:_,label:Q}))],className:"w-40"})]})})}),E?s.jsx(X,{children:s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."})}):s.jsx(s.Fragment,{children:n?s.jsxs("div",{className:"space-y-6",children:[s.jsxs(X,{children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 pb-3 border-b",children:[s.jsx(Fl,{className:"w-5 h-5 text-blue-600"}),s.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:["Meine ",p]}),s.jsx(ve,{variant:"default",children:O.ownTasks.length})]}),O.ownTasks.length>0?s.jsx("div",{children:O.ownTasks.map(_=>k(_,!1))}):s.jsxs("p",{className:"text-gray-500 text-center py-4",children:["Keine eigenen ",p.toLowerCase()," vorhanden."]})]}),O.representedTasks.length>0&&s.jsxs(X,{children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 pb-3 border-b",children:[s.jsx(Ca,{className:"w-5 h-5 text-purple-600"}),s.jsxs("h2",{className:"text-lg font-semibold text-gray-900",children:[p," freigegebener Kunden"]}),s.jsx(ve,{variant:"default",children:O.representedTasks.length})]}),s.jsx("div",{children:O.representedTasks.map(_=>k(_,!0))})]})]}):s.jsx(X,{children:O.allTasks&&O.allTasks.length>0?s.jsx("div",{children:O.allTasks.map(_=>k(_,!0))}):s.jsxs("div",{className:"text-center py-8 text-gray-500",children:["Keine ",p.toLowerCase()," gefunden."]})})}),n?s.jsx(PC,{isOpen:d,onClose:()=>u(!1)}):s.jsx(AC,{isOpen:d,onClose:()=>u(!1)}),m&&s.jsx(MC,{task:m,onClose:()=>f(null),onSave:_=>P.mutate({taskId:m.id,data:_}),isPending:P.isPending})]})}function PC({isOpen:e,onClose:t}){const{user:n}=He(),r=Yt(),a=ge(),[i,l]=j.useState("own"),[o,c]=j.useState(null),[d,u]=j.useState(""),[h,x]=j.useState(""),[m,f]=j.useState(!1),[p,b]=j.useState(""),{data:g}=fe({queryKey:["contracts",n==null?void 0:n.customerId],queryFn:()=>Oe.getAll({customerId:n==null?void 0:n.customerId}),enabled:e}),y=j.useMemo(()=>{if(!(g!=null&&g.data))return{own:[],represented:{}};const w=[],S={};for(const P of g.data)if(P.customerId===(n==null?void 0:n.customerId))w.push(P);else{if(!S[P.customerId]){const O=P.customer?P.customer.companyName||`${P.customer.firstName} ${P.customer.lastName}`:`Kunde ${P.customerId}`;S[P.customerId]={name:O,contracts:[]}}S[P.customerId].contracts.push(P)}return{own:w,represented:S}},[g==null?void 0:g.data,n==null?void 0:n.customerId]),v=Object.keys(y.represented).length>0,N=j.useMemo(()=>{var w;return i==="own"?y.own:((w=y.represented[i])==null?void 0:w.contracts)||[]},[i,y]),E=j.useMemo(()=>{if(!p)return N;const w=p.toLowerCase();return N.filter(S=>S.contractNumber.toLowerCase().includes(w)||(S.providerName||"").toLowerCase().includes(w)||(S.tariffName||"").toLowerCase().includes(w))},[N,p]),A=async()=>{if(!(!o||!d.trim())){f(!0);try{await et.createSupportTicket(o,{title:d.trim(),description:h.trim()||void 0}),a.invalidateQueries({queryKey:["all-tasks"]}),a.invalidateQueries({queryKey:["task-stats"]}),t(),u(""),x(""),c(null),l("own"),r(`/contracts/${o}`)}catch(w){console.error("Fehler beim Erstellen der Support-Anfrage:",w),alert("Fehler beim Erstellen der Support-Anfrage. Bitte versuchen Sie es erneut.")}finally{f(!1)}}},I=()=>{u(""),x(""),c(null),l("own"),b(""),t()};return s.jsx(Ve,{isOpen:e,onClose:I,title:"Neue Support-Anfrage",children:s.jsxs("div",{className:"space-y-4",children:[v&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Kunde"}),s.jsxs("select",{value:i,onChange:w=>{const S=w.target.value;l(S==="own"?"own":parseInt(S)),c(null),b("")},className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",children:[s.jsx("option",{value:"own",children:"Eigene Verträge"}),Object.entries(y.represented).map(([w,{name:S}])=>s.jsx("option",{value:w,children:S},w))]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Vertrag *"}),s.jsx(H,{placeholder:"Vertrag suchen...",value:p,onChange:w=>b(w.target.value),className:"mb-2"}),s.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-lg",children:E.length>0?E.map(w=>s.jsxs("div",{onClick:()=>c(w.id),className:`p-3 cursor-pointer border-b last:border-b-0 hover:bg-gray-50 ${o===w.id?"bg-blue-50 border-blue-200":""}`,children:[s.jsx("div",{className:"font-medium",children:w.contractNumber}),s.jsxs("div",{className:"text-sm text-gray-500",children:[w.providerName||"Kein Anbieter",w.tariffName&&` - ${w.tariffName}`]})]},w.id)):s.jsx("div",{className:"p-3 text-gray-500 text-center",children:"Keine Verträge gefunden."})})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Titel *"}),s.jsx(H,{value:d,onChange:w=>u(w.target.value),placeholder:"Kurze Beschreibung Ihres Anliegens"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Beschreibung"}),s.jsx("textarea",{value:h,onChange:w=>x(w.target.value),placeholder:"Detaillierte Beschreibung (optional)",rows:4,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:I,children:"Abbrechen"}),s.jsx(T,{onClick:A,disabled:!o||!d.trim()||m,children:m?"Wird erstellt...":"Anfrage erstellen"})]})]})})}function AC({isOpen:e,onClose:t}){const n=Yt(),r=ge(),[a,i]=j.useState(null),[l,o]=j.useState(null),[c,d]=j.useState(""),[u,h]=j.useState(""),[x,m]=j.useState(!1),[f,p]=j.useState(!1),[b,g]=j.useState(""),[y,v]=j.useState(""),{data:N}=fe({queryKey:["customers-for-task"],queryFn:()=>Pt.getAll({limit:100}),enabled:e}),{data:E}=fe({queryKey:["contracts-for-task",a],queryFn:()=>Oe.getAll({customerId:a}),enabled:e&&a!==null}),A=j.useMemo(()=>{if(!(N!=null&&N.data))return[];if(!b)return N.data;const O=b.toLowerCase();return N.data.filter(R=>R.customerNumber.toLowerCase().includes(O)||R.firstName.toLowerCase().includes(O)||R.lastName.toLowerCase().includes(O)||(R.companyName||"").toLowerCase().includes(O))},[N==null?void 0:N.data,b]),I=j.useMemo(()=>{if(!(E!=null&&E.data))return[];if(!y)return E.data;const O=y.toLowerCase();return E.data.filter(R=>R.contractNumber.toLowerCase().includes(O)||(R.providerName||"").toLowerCase().includes(O)||(R.tariffName||"").toLowerCase().includes(O))},[E==null?void 0:E.data,y]),w=async()=>{if(!(!l||!c.trim())){p(!0);try{await et.create(l,{title:c.trim(),description:u.trim()||void 0,visibleInPortal:x}),r.invalidateQueries({queryKey:["all-tasks"]}),r.invalidateQueries({queryKey:["task-stats"]}),t(),d(""),h(""),m(!1),o(null),i(null),n(`/contracts/${l}`)}catch(O){console.error("Fehler beim Erstellen der Aufgabe:",O),alert("Fehler beim Erstellen der Aufgabe. Bitte versuchen Sie es erneut.")}finally{p(!1)}}},S=()=>{d(""),h(""),m(!1),o(null),i(null),g(""),v(""),t()},P=O=>{const R=O.companyName||`${O.firstName} ${O.lastName}`;return`${O.customerNumber} - ${R}`};return s.jsx(Ve,{isOpen:e,onClose:S,title:"Neue Aufgabe",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Kunde *"}),s.jsx(H,{placeholder:"Kunde suchen...",value:b,onChange:O=>g(O.target.value),className:"mb-2"}),s.jsx("div",{className:"max-h-40 overflow-y-auto border rounded-lg",children:A.length>0?A.map(O=>s.jsx("div",{onClick:()=>{i(O.id),o(null),v("")},className:`p-3 cursor-pointer border-b last:border-b-0 hover:bg-gray-50 ${a===O.id?"bg-blue-50 border-blue-200":""}`,children:s.jsx("div",{className:"font-medium",children:P(O)})},O.id)):s.jsx("div",{className:"p-3 text-gray-500 text-center",children:"Keine Kunden gefunden."})})]}),a&&s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Vertrag *"}),s.jsx(H,{placeholder:"Vertrag suchen...",value:y,onChange:O=>v(O.target.value),className:"mb-2"}),s.jsx("div",{className:"max-h-40 overflow-y-auto border rounded-lg",children:I.length>0?I.map(O=>s.jsxs("div",{onClick:()=>o(O.id),className:`p-3 cursor-pointer border-b last:border-b-0 hover:bg-gray-50 ${l===O.id?"bg-blue-50 border-blue-200":""}`,children:[s.jsx("div",{className:"font-medium",children:O.contractNumber}),s.jsxs("div",{className:"text-sm text-gray-500",children:[O.providerName||"Kein Anbieter",O.tariffName&&` - ${O.tariffName}`]})]},O.id)):s.jsx("div",{className:"p-3 text-gray-500 text-center",children:E?"Keine Verträge gefunden.":"Laden..."})})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Titel *"}),s.jsx(H,{value:c,onChange:O=>d(O.target.value),placeholder:"Aufgabentitel"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Beschreibung"}),s.jsx("textarea",{value:u,onChange:O=>h(O.target.value),placeholder:"Detaillierte Beschreibung (optional)",rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),s.jsx("div",{children:s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:x,onChange:O=>m(O.target.checked),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),s.jsx("span",{className:"text-sm text-gray-700",children:"Im Kundenportal sichtbar"})]})}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:S,children:"Abbrechen"}),s.jsx(T,{onClick:w,disabled:!l||!c.trim()||f,children:f?"Wird erstellt...":"Aufgabe erstellen"})]})]})})}function MC({task:e,onClose:t,onSave:n,isPending:r}){const[a,i]=j.useState(e.title),[l,o]=j.useState(e.description||""),[c,d]=j.useState(e.visibleInPortal||!1),u=()=>{a.trim()&&n({title:a.trim(),description:l.trim()||void 0,visibleInPortal:c})};return s.jsx(Ve,{isOpen:!0,onClose:t,title:"Aufgabe bearbeiten",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Titel *"}),s.jsx(H,{value:a,onChange:h=>i(h.target.value),placeholder:"Aufgabentitel"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Beschreibung"}),s.jsx("textarea",{value:l,onChange:h=>o(h.target.value),placeholder:"Detaillierte Beschreibung (optional)",rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),s.jsx("div",{children:s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:c,onChange:h=>d(h.target.checked),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),s.jsx("span",{className:"text-sm text-gray-700",children:"Im Kundenportal sichtbar"})]})}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[s.jsx(T,{variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{onClick:u,disabled:!a.trim()||r,children:r?"Wird gespeichert...":"Speichern"})]})]})})}function TC(){const[e,t]=j.useState(!1),[n,r]=j.useState(null),[a,i]=j.useState(!1),{hasPermission:l}=He(),o=ge(),{data:c,isLoading:d}=fe({queryKey:["platforms",a],queryFn:()=>al.getAll(a)}),u=G({mutationFn:al.delete,onSuccess:()=>{o.invalidateQueries({queryKey:["platforms"]})}}),h=m=>{r(m),t(!0)},x=()=>{t(!1),r(null)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Vertriebsplattformen"}),l("platforms:create")&&s.jsxs(T,{onClick:()=>t(!0),children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Neue Plattform"]})]}),s.jsxs(X,{children:[s.jsx("div",{className:"mb-4",children:s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:a,onChange:m=>i(m.target.checked),className:"rounded"}),"Inaktive anzeigen"]})}),d?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):c!=null&&c.data&&c.data.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Name"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Kontakt"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Status"}),s.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsx("tbody",{children:c.data.map(m=>s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[s.jsx("td",{className:"py-3 px-4 font-medium",children:m.name}),s.jsx("td",{className:"py-3 px-4 text-gray-500",children:m.contactInfo||"-"}),s.jsx("td",{className:"py-3 px-4",children:s.jsx(ve,{variant:m.isActive?"success":"danger",children:m.isActive?"Aktiv":"Inaktiv"})}),s.jsx("td",{className:"py-3 px-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[l("platforms:update")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>h(m),children:s.jsx(Je,{className:"w-4 h-4"})}),l("platforms:delete")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Plattform wirklich löschen?")&&u.mutate(m.id)},children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})})]},m.id))})]})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Plattformen vorhanden."})]}),s.jsx(FC,{isOpen:e,onClose:x,platform:n})]})}function FC({isOpen:e,onClose:t,platform:n}){const r=ge(),[a,i]=j.useState({name:"",contactInfo:"",isActive:!0});j.useState(()=>{i(n?{name:n.name,contactInfo:n.contactInfo||"",isActive:n.isActive}:{name:"",contactInfo:"",isActive:!0})}),n&&a.name!==n.name?i({name:n.name,contactInfo:n.contactInfo||"",isActive:n.isActive}):!n&&a.name;const l=G({mutationFn:al.create,onSuccess:()=>{r.invalidateQueries({queryKey:["platforms"]}),t(),i({name:"",contactInfo:"",isActive:!0})}}),o=G({mutationFn:u=>al.update(n.id,u),onSuccess:()=>{r.invalidateQueries({queryKey:["platforms"]}),t()}}),c=u=>{u.preventDefault(),n?o.mutate(a):l.mutate(a)},d=l.isPending||o.isPending;return s.jsx(Ve,{isOpen:e,onClose:t,title:n?"Plattform bearbeiten":"Neue Plattform",children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(H,{label:"Name *",value:a.name,onChange:u=>i({...a,name:u.target.value}),required:!0}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Kontaktinformationen"}),s.jsx("textarea",{value:a.contactInfo,onChange:u=>i({...a,contactInfo:u.target.value}),rows:3,className:"block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"E-Mail, Telefon, Ansprechpartner..."})]}),n&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:a.isActive,onChange:u=>i({...a,isActive:u.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:d,children:d?"Speichern...":"Speichern"})]})]})})}function IC(){const[e,t]=j.useState(!1),[n,r]=j.useState(null),[a,i]=j.useState(!1),{hasPermission:l}=He(),o=ge(),{data:c,isLoading:d}=fe({queryKey:["cancellation-periods",a],queryFn:()=>il.getAll(a)}),u=G({mutationFn:il.delete,onSuccess:()=>{o.invalidateQueries({queryKey:["cancellation-periods"]})}}),h=m=>{r(m),t(!0)},x=()=>{t(!1),r(null)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Vs,{className:"w-4 h-4"})})}),s.jsx("h1",{className:"text-2xl font-bold flex-1",children:"Kündigungsfristen"}),l("platforms:create")&&s.jsxs(T,{onClick:()=>t(!0),children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Neue Frist"]})]}),s.jsxs(X,{children:[s.jsx("div",{className:"mb-4",children:s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:a,onChange:m=>i(m.target.checked),className:"rounded"}),"Inaktive anzeigen"]})}),s.jsxs("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-lg text-sm",children:[s.jsx("strong",{children:"Code-Format:"})," Zahl + Buchstabe (T=Tage, M=Monate, J=Jahre)",s.jsx("br",{}),s.jsx("strong",{children:"Beispiele:"})," 14T = 14 Tage, 3M = 3 Monate, 1J = 1 Jahr"]}),d?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):c!=null&&c.data&&c.data.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Code"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Beschreibung"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Status"}),s.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsx("tbody",{children:c.data.map(m=>s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[s.jsx("td",{className:"py-3 px-4 font-mono font-medium",children:m.code}),s.jsx("td",{className:"py-3 px-4",children:m.description}),s.jsx("td",{className:"py-3 px-4",children:s.jsx(ve,{variant:m.isActive?"success":"danger",children:m.isActive?"Aktiv":"Inaktiv"})}),s.jsx("td",{className:"py-3 px-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[l("platforms:update")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>h(m),children:s.jsx(Je,{className:"w-4 h-4"})}),l("platforms:delete")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Kündigungsfrist wirklich löschen?")&&u.mutate(m.id)},children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})})]},m.id))})]})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Kündigungsfristen vorhanden."})]}),s.jsx(RC,{isOpen:e,onClose:x,period:n})]})}function RC({isOpen:e,onClose:t,period:n}){const r=ge(),[a,i]=j.useState({code:"",description:"",isActive:!0});j.useEffect(()=>{e&&i(n?{code:n.code,description:n.description,isActive:n.isActive}:{code:"",description:"",isActive:!0})},[e,n]);const l=G({mutationFn:il.create,onSuccess:()=>{r.invalidateQueries({queryKey:["cancellation-periods"]}),t(),i({code:"",description:"",isActive:!0})}}),o=G({mutationFn:u=>il.update(n.id,u),onSuccess:()=>{r.invalidateQueries({queryKey:["cancellation-periods"]}),t()}}),c=u=>{u.preventDefault(),n?o.mutate(a):l.mutate(a)},d=l.isPending||o.isPending;return s.jsx(Ve,{isOpen:e,onClose:t,title:n?"Kündigungsfrist bearbeiten":"Neue Kündigungsfrist",children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(H,{label:"Code *",value:a.code,onChange:u=>i({...a,code:u.target.value.toUpperCase()}),required:!0,placeholder:"z.B. 14T, 3M, 1J"}),s.jsx(H,{label:"Beschreibung *",value:a.description,onChange:u=>i({...a,description:u.target.value}),required:!0,placeholder:"z.B. 14 Tage, 3 Monate, 1 Jahr"}),n&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:a.isActive,onChange:u=>i({...a,isActive:u.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:d,children:d?"Speichern...":"Speichern"})]})]})})}function LC(){const[e,t]=j.useState(!1),[n,r]=j.useState(null),[a,i]=j.useState(!1),{hasPermission:l}=He(),o=ge(),{data:c,isLoading:d}=fe({queryKey:["contract-durations",a],queryFn:()=>ll.getAll(a)}),u=G({mutationFn:ll.delete,onSuccess:()=>{o.invalidateQueries({queryKey:["contract-durations"]})}}),h=m=>{r(m),t(!0)},x=()=>{t(!1),r(null)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Vs,{className:"w-4 h-4"})})}),s.jsx("h1",{className:"text-2xl font-bold flex-1",children:"Vertragslaufzeiten"}),l("platforms:create")&&s.jsxs(T,{onClick:()=>t(!0),children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Neue Laufzeit"]})]}),s.jsxs(X,{children:[s.jsx("div",{className:"mb-4",children:s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:a,onChange:m=>i(m.target.checked),className:"rounded"}),"Inaktive anzeigen"]})}),s.jsxs("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-lg text-sm",children:[s.jsx("strong",{children:"Code-Format:"})," Zahl + Buchstabe (T=Tage, M=Monate, J=Jahre)",s.jsx("br",{}),s.jsx("strong",{children:"Beispiele:"})," 12M = 12 Monate, 24M = 24 Monate, 2J = 2 Jahre"]}),d?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):c!=null&&c.data&&c.data.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Code"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Beschreibung"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Status"}),s.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsx("tbody",{children:c.data.map(m=>s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[s.jsx("td",{className:"py-3 px-4 font-mono font-medium",children:m.code}),s.jsx("td",{className:"py-3 px-4",children:m.description}),s.jsx("td",{className:"py-3 px-4",children:s.jsx(ve,{variant:m.isActive?"success":"danger",children:m.isActive?"Aktiv":"Inaktiv"})}),s.jsx("td",{className:"py-3 px-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[l("platforms:update")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>h(m),children:s.jsx(Je,{className:"w-4 h-4"})}),l("platforms:delete")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Laufzeit wirklich löschen?")&&u.mutate(m.id)},children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})})]},m.id))})]})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Laufzeiten vorhanden."})]}),s.jsx(OC,{isOpen:e,onClose:x,duration:n})]})}function OC({isOpen:e,onClose:t,duration:n}){const r=ge(),[a,i]=j.useState({code:"",description:"",isActive:!0});j.useEffect(()=>{e&&i(n?{code:n.code,description:n.description,isActive:n.isActive}:{code:"",description:"",isActive:!0})},[e,n]);const l=G({mutationFn:ll.create,onSuccess:()=>{r.invalidateQueries({queryKey:["contract-durations"]}),t(),i({code:"",description:"",isActive:!0})}}),o=G({mutationFn:u=>ll.update(n.id,u),onSuccess:()=>{r.invalidateQueries({queryKey:["contract-durations"]}),t()}}),c=u=>{u.preventDefault(),n?o.mutate(a):l.mutate(a)},d=l.isPending||o.isPending;return s.jsx(Ve,{isOpen:e,onClose:t,title:n?"Laufzeit bearbeiten":"Neue Laufzeit",children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(H,{label:"Code *",value:a.code,onChange:u=>i({...a,code:u.target.value.toUpperCase()}),required:!0,placeholder:"z.B. 12M, 24M, 2J"}),s.jsx(H,{label:"Beschreibung *",value:a.description,onChange:u=>i({...a,description:u.target.value}),required:!0,placeholder:"z.B. 12 Monate, 24 Monate, 2 Jahre"}),n&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:a.isActive,onChange:u=>i({...a,isActive:u.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:d,children:d?"Speichern...":"Speichern"})]})]})})}function zC(){const[e,t]=j.useState(!1),[n,r]=j.useState(null),[a,i]=j.useState(!1),[l,o]=j.useState(new Set),{hasPermission:c}=He(),d=ge(),{data:u,isLoading:h}=fe({queryKey:["providers",a],queryFn:()=>Xa.getAll(a)}),x=G({mutationFn:Xa.delete,onSuccess:()=>{d.invalidateQueries({queryKey:["providers"]})},onError:b=>{alert(b.message)}}),m=b=>{o(g=>{const y=new Set(g);return y.has(b)?y.delete(b):y.add(b),y})},f=b=>{r(b),t(!0)},p=()=>{t(!1),r(null)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Vs,{className:"w-4 h-4"})})}),s.jsx("h1",{className:"text-2xl font-bold flex-1",children:"Anbieter & Tarife"}),c("providers:create")&&s.jsxs(T,{onClick:()=>t(!0),children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Neuer Anbieter"]})]}),s.jsxs(X,{children:[s.jsx("div",{className:"mb-4",children:s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:a,onChange:b=>i(b.target.checked),className:"rounded"}),"Inaktive anzeigen"]})}),h?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):u!=null&&u.data&&u.data.length>0?s.jsx("div",{className:"space-y-2",children:u.data.map(b=>s.jsx($C,{provider:b,isExpanded:l.has(b.id),onToggle:()=>m(b.id),onEdit:()=>f(b),onDelete:()=>{confirm("Anbieter wirklich löschen?")&&x.mutate(b.id)},hasPermission:c,showInactive:a},b.id))}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Anbieter vorhanden."})]}),s.jsx(_C,{isOpen:e,onClose:p,provider:n})]})}function $C({provider:e,isExpanded:t,onToggle:n,onEdit:r,onDelete:a,hasPermission:i,showInactive:l}){var f,p;const[o,c]=j.useState(!1),[d,u]=j.useState(null),h=ge(),x=G({mutationFn:gv.delete,onSuccess:()=>{h.invalidateQueries({queryKey:["providers"]})},onError:b=>{alert(b.message)}}),m=((f=e.tariffs)==null?void 0:f.filter(b=>l||b.isActive))||[];return s.jsxs("div",{className:"border rounded-lg",children:[s.jsxs("div",{className:"flex items-center p-4 hover:bg-gray-50",children:[s.jsx("button",{onClick:n,className:"mr-3 p-1 hover:bg-gray-200 rounded",children:t?s.jsx(Rn,{className:"w-5 h-5 text-gray-400"}):s.jsx(Ft,{className:"w-5 h-5 text-gray-400"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"font-medium",children:e.name}),s.jsx(ve,{variant:e.isActive?"success":"danger",children:e.isActive?"Aktiv":"Inaktiv"}),s.jsxs("span",{className:"text-sm text-gray-500",children:["(",m.length," Tarife, ",((p=e._count)==null?void 0:p.contracts)||0," Verträge)"]})]}),e.portalUrl&&s.jsxs("a",{href:e.portalUrl,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:underline flex items-center gap-1 mt-1",children:[s.jsx(ch,{className:"w-3 h-3"}),e.portalUrl]})]}),s.jsxs("div",{className:"flex gap-2 ml-4",children:[i("providers:update")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:r,title:"Bearbeiten",children:s.jsx(Je,{className:"w-4 h-4"})}),i("providers:delete")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:a,title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]}),t&&s.jsxs("div",{className:"border-t bg-gray-50 p-4",children:[s.jsxs("div",{className:"flex justify-between items-center mb-3",children:[s.jsx("h4",{className:"font-medium text-gray-700",children:"Tarife"}),i("providers:create")&&s.jsxs(T,{size:"sm",onClick:()=>c(!0),children:[s.jsx(Ue,{className:"w-4 h-4 mr-1"}),"Tarif hinzufügen"]})]}),m.length>0?s.jsx("div",{className:"space-y-2",children:m.map(b=>{var g;return s.jsxs("div",{className:"flex items-center justify-between bg-white p-3 rounded border",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{children:b.name}),s.jsx(ve,{variant:b.isActive?"success":"danger",className:"text-xs",children:b.isActive?"Aktiv":"Inaktiv"}),((g=b._count)==null?void 0:g.contracts)!==void 0&&s.jsxs("span",{className:"text-xs text-gray-500",children:["(",b._count.contracts," Verträge)"]})]}),s.jsxs("div",{className:"flex gap-1",children:[i("providers:update")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{u(b),c(!0)},title:"Bearbeiten",children:s.jsx(Je,{className:"w-3 h-3"})}),i("providers:delete")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Tarif wirklich löschen?")&&x.mutate(b.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-3 h-3 text-red-500"})})]})]},b.id)})}):s.jsx("p",{className:"text-sm text-gray-500",children:"Keine Tarife vorhanden."})]}),s.jsx(KC,{isOpen:o,onClose:()=>{c(!1),u(null)},providerId:e.id,tariff:d})]})}function _C({isOpen:e,onClose:t,provider:n}){const r=ge(),[a,i]=j.useState({name:"",portalUrl:"",usernameFieldName:"",passwordFieldName:"",isActive:!0});j.useEffect(()=>{e&&i(n?{name:n.name,portalUrl:n.portalUrl||"",usernameFieldName:n.usernameFieldName||"",passwordFieldName:n.passwordFieldName||"",isActive:n.isActive}:{name:"",portalUrl:"",usernameFieldName:"",passwordFieldName:"",isActive:!0})},[e,n]);const l=G({mutationFn:Xa.create,onSuccess:()=>{r.invalidateQueries({queryKey:["providers"]}),t()},onError:u=>{alert(u.message)}}),o=G({mutationFn:u=>Xa.update(n.id,u),onSuccess:()=>{r.invalidateQueries({queryKey:["providers"]}),t()},onError:u=>{alert(u.message)}}),c=u=>{u.preventDefault(),n?o.mutate(a):l.mutate(a)},d=l.isPending||o.isPending;return s.jsx(Ve,{isOpen:e,onClose:t,title:n?"Anbieter bearbeiten":"Neuer Anbieter",children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(H,{label:"Anbietername *",value:a.name,onChange:u=>i({...a,name:u.target.value}),required:!0,placeholder:"z.B. Vodafone, E.ON, Allianz"}),s.jsx(H,{label:"Portal-URL (Login-Seite)",value:a.portalUrl,onChange:u=>i({...a,portalUrl:u.target.value}),placeholder:"https://kundenportal.anbieter.de/login"}),s.jsxs("div",{className:"p-3 bg-gray-50 rounded-lg space-y-3",children:[s.jsxs("p",{className:"text-sm text-gray-600",children:[s.jsx("strong",{children:"Auto-Login Felder"})," (optional)",s.jsx("br",{}),"Feldnamen für URL-Parameter beim Auto-Login:"]}),s.jsx(H,{label:"Benutzername-Feldname",value:a.usernameFieldName,onChange:u=>i({...a,usernameFieldName:u.target.value}),placeholder:"z.B. username, email, login"}),s.jsx(H,{label:"Passwort-Feldname",value:a.passwordFieldName,onChange:u=>i({...a,passwordFieldName:u.target.value}),placeholder:"z.B. password, pwd, kennwort"})]}),n&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:a.isActive,onChange:u=>i({...a,isActive:u.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:d,children:d?"Speichern...":"Speichern"})]})]})})}function KC({isOpen:e,onClose:t,providerId:n,tariff:r}){const a=ge(),[i,l]=j.useState({name:"",isActive:!0});j.useEffect(()=>{e&&l(r?{name:r.name,isActive:r.isActive}:{name:"",isActive:!0})},[e,r]);const o=G({mutationFn:h=>Xa.createTariff(n,h),onSuccess:()=>{a.invalidateQueries({queryKey:["providers"]}),t()},onError:h=>{alert(h.message)}}),c=G({mutationFn:h=>gv.update(r.id,h),onSuccess:()=>{a.invalidateQueries({queryKey:["providers"]}),t()},onError:h=>{alert(h.message)}}),d=h=>{h.preventDefault(),r?c.mutate(i):o.mutate(i)},u=o.isPending||c.isPending;return s.jsx(Ve,{isOpen:e,onClose:t,title:r?"Tarif bearbeiten":"Neuer Tarif",children:s.jsxs("form",{onSubmit:d,className:"space-y-4",children:[s.jsx(H,{label:"Tarifname *",value:i.name,onChange:h=>l({...i,name:h.target.value}),required:!0,placeholder:"z.B. Comfort Plus, Basic 100"}),r&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:i.isActive,onChange:h=>l({...i,isActive:h.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:u,children:u?"Speichern...":"Speichern"})]})]})})}const Gu={Zap:s.jsx(ph,{className:"w-5 h-5"}),Flame:s.jsx(Cv,{className:"w-5 h-5"}),Wifi:s.jsx(Ea,{className:"w-5 h-5"}),Cable:s.jsx(D2,{className:"w-5 h-5"}),Network:s.jsx(K2,{className:"w-5 h-5"}),Smartphone:s.jsx(hh,{className:"w-5 h-5"}),Tv:s.jsx(Tv,{className:"w-5 h-5"}),Car:s.jsx(kv,{className:"w-5 h-5"}),FileText:s.jsx(Ke,{className:"w-5 h-5"})},BC=[{value:"Zap",label:"Blitz (Strom)"},{value:"Flame",label:"Flamme (Gas)"},{value:"Wifi",label:"WLAN (DSL)"},{value:"Cable",label:"Kabel"},{value:"Network",label:"Netzwerk (Glasfaser)"},{value:"Smartphone",label:"Smartphone (Mobilfunk)"},{value:"Tv",label:"TV"},{value:"Car",label:"Auto (KFZ)"},{value:"FileText",label:"Dokument (Sonstige)"}],UC=[{value:"#FFC107",label:"Gelb"},{value:"#FF5722",label:"Orange"},{value:"#2196F3",label:"Blau"},{value:"#9C27B0",label:"Lila"},{value:"#4CAF50",label:"Grün"},{value:"#E91E63",label:"Pink"},{value:"#607D8B",label:"Grau"},{value:"#795548",label:"Braun"},{value:"#00BCD4",label:"Cyan"},{value:"#F44336",label:"Rot"}];function qC(){const[e,t]=j.useState(!1),[n,r]=j.useState(null),[a,i]=j.useState(!1),{hasPermission:l}=He(),o=ge(),{data:c,isLoading:d}=fe({queryKey:["contract-categories",a],queryFn:()=>ol.getAll(a)}),u=G({mutationFn:ol.delete,onSuccess:()=>{o.invalidateQueries({queryKey:["contract-categories"]})},onError:m=>{alert(m.message)}}),h=m=>{r(m),t(!0)},x=()=>{t(!1),r(null)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Vs,{className:"w-4 h-4"})})}),s.jsx("h1",{className:"text-2xl font-bold flex-1",children:"Vertragstypen"}),l("developer:access")&&s.jsxs(T,{onClick:()=>t(!0),children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Neuer Vertragstyp"]})]}),s.jsxs(X,{children:[s.jsx("div",{className:"mb-4",children:s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:a,onChange:m=>i(m.target.checked),className:"rounded"}),"Inaktive anzeigen"]})}),d?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):c!=null&&c.data&&c.data.length>0?s.jsx("div",{className:"space-y-2",children:c.data.map(m=>{var f;return s.jsxs("div",{className:"flex items-center p-4 border rounded-lg hover:bg-gray-50",children:[s.jsx("div",{className:"mr-3 text-gray-400",children:s.jsx(I2,{className:"w-5 h-5"})}),s.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center mr-4",style:{backgroundColor:m.color||"#E5E7EB",color:"#fff"},children:m.icon&&Gu[m.icon]?Gu[m.icon]:s.jsx(Ke,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"font-medium",children:m.name}),s.jsx(ve,{variant:m.isActive?"success":"danger",children:m.isActive?"Aktiv":"Inaktiv"}),s.jsxs("span",{className:"text-sm text-gray-500",children:["(",((f=m._count)==null?void 0:f.contracts)||0," Verträge)"]})]}),s.jsxs("div",{className:"text-sm text-gray-500",children:["Code: ",s.jsx("span",{className:"font-mono",children:m.code})]})]}),s.jsxs("div",{className:"flex gap-2 ml-4",children:[l("developer:access")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>h(m),title:"Bearbeiten",children:s.jsx(Je,{className:"w-4 h-4"})}),l("developer:access")&&s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>{confirm("Vertragstyp wirklich löschen?")&&u.mutate(m.id)},title:"Löschen",children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]},m.id)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Vertragstypen vorhanden."})]}),s.jsx(VC,{isOpen:e,onClose:x,category:n})]})}function VC({isOpen:e,onClose:t,category:n}){const r=ge(),[a,i]=j.useState({code:"",name:"",icon:"FileText",color:"#607D8B",sortOrder:0,isActive:!0});j.useEffect(()=>{e&&i(n?{code:n.code,name:n.name,icon:n.icon||"FileText",color:n.color||"#607D8B",sortOrder:n.sortOrder,isActive:n.isActive}:{code:"",name:"",icon:"FileText",color:"#607D8B",sortOrder:0,isActive:!0})},[e,n]);const l=G({mutationFn:ol.create,onSuccess:()=>{r.invalidateQueries({queryKey:["contract-categories"]}),t()},onError:u=>{alert(u.message)}}),o=G({mutationFn:u=>ol.update(n.id,u),onSuccess:()=>{r.invalidateQueries({queryKey:["contract-categories"]}),t()},onError:u=>{alert(u.message)}}),c=u=>{u.preventDefault(),n?o.mutate(a):l.mutate(a)},d=l.isPending||o.isPending;return s.jsx(Ve,{isOpen:e,onClose:t,title:n?"Vertragstyp bearbeiten":"Neuer Vertragstyp",children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(H,{label:"Code (technisch) *",value:a.code,onChange:u=>i({...a,code:u.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"")}),required:!0,placeholder:"z.B. ELECTRICITY, MOBILE_BUSINESS",disabled:!!n}),s.jsx(H,{label:"Anzeigename *",value:a.name,onChange:u=>i({...a,name:u.target.value}),required:!0,placeholder:"z.B. Strom, Mobilfunk Business"}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Icon"}),s.jsx("div",{className:"grid grid-cols-4 gap-2",children:BC.map(u=>s.jsxs("button",{type:"button",onClick:()=>i({...a,icon:u.value}),className:`p-3 border rounded-lg flex flex-col items-center gap-1 text-xs ${a.icon===u.value?"border-blue-500 bg-blue-50":"border-gray-200 hover:bg-gray-50"}`,children:[Gu[u.value],s.jsx("span",{className:"truncate w-full text-center",children:u.label.split(" ")[0]})]},u.value))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Farbe"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:UC.map(u=>s.jsx("button",{type:"button",onClick:()=>i({...a,color:u.value}),className:`w-8 h-8 rounded-full border-2 ${a.color===u.value?"border-gray-800 ring-2 ring-offset-2 ring-gray-400":"border-transparent"}`,style:{backgroundColor:u.value},title:u.label},u.value))})]}),s.jsx(H,{label:"Sortierung",type:"number",value:a.sortOrder,onChange:u=>i({...a,sortOrder:parseInt(u.target.value)||0}),placeholder:"0"}),n&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:a.isActive,onChange:u=>i({...a,isActive:u.target.checked}),className:"rounded"}),"Aktiv"]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:d,children:d?"Speichern...":"Speichern"})]})]})})}const QC=[{value:"0.1",label:"10%"},{value:"0.2",label:"20%"},{value:"0.3",label:"30%"},{value:"0.4",label:"40%"},{value:"0.5",label:"50%"},{value:"0.6",label:"60%"},{value:"0.7",label:"70% (Standard)"},{value:"0.8",label:"80%"},{value:"0.9",label:"90%"},{value:"999",label:"Deaktiviert"}];function HC(){const{settings:e,updateSettings:t}=jv();return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:s.jsx(Vs,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Pe,{className:"w-6 h-6"}),s.jsx("h1",{className:"text-2xl font-bold",children:"Ansicht"})]})]}),s.jsx(X,{title:"Scroll-Verhalten",children:s.jsx("div",{className:"space-y-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:"Nach-oben-Button"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Ab welcher Scroll-Position der Button unten rechts erscheinen soll"})]}),s.jsx("div",{className:"w-48",children:s.jsx(Ie,{options:QC,value:e.scrollToTopThreshold.toString(),onChange:n=>t({scrollToTopThreshold:parseFloat(n.target.value)})})})]})})})]})}function WC(){const e=ge(),{data:t,isLoading:n}=fe({queryKey:["app-settings"],queryFn:()=>Xr.getAll()}),[r,a]=j.useState(!1);j.useEffect(()=>{t!=null&&t.data&&a(t.data.customerSupportTicketsEnabled==="true")},[t]);const i=G({mutationFn:o=>Xr.update(o),onSuccess:()=>{e.invalidateQueries({queryKey:["app-settings"]}),e.invalidateQueries({queryKey:["app-settings-public"]})}}),l=o=>{a(o),i.mutate({customerSupportTicketsEnabled:o?"true":"false"})};return n?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx("div",{className:"text-gray-500",children:"Laden..."})}):s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",className:"text-gray-500 hover:text-gray-700",children:s.jsx(Vs,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(dh,{className:"w-6 h-6"}),s.jsx("h1",{className:"text-2xl font-bold",children:"Kundenportal"})]})]}),s.jsxs(X,{title:"Support-Anfragen",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(dl,{className:"w-5 h-5 text-gray-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:"Kunden können Support-Anfragen erstellen"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Wenn aktiviert, können Kunden im Portal Support-Anfragen zu ihren Verträgen erstellen. Diese erscheinen als Aufgaben in der Vertragsdetailansicht."})]})]}),s.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:o=>l(o.target.checked),disabled:i.isPending,className:"sr-only peer"}),s.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"})]})]}),r&&s.jsx("div",{className:"mt-4 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:s.jsxs("p",{className:"text-sm text-blue-800",children:[s.jsx("strong",{children:"Hinweis:"}),' Kunden sehen diese Anfragen als "Support-Anfragen" in ihrem Portal. Sie können die Anfrage mit einem Titel und einer Beschreibung erstellen. Ihre Mitarbeiter können dann mit Antworten (Unteraufgaben) reagieren.']})})]})]})}function GC(){const e=ge(),{data:t,isLoading:n}=fe({queryKey:["app-settings"],queryFn:()=>Xr.getAll()}),[r,a]=j.useState("14"),[i,l]=j.useState("42"),[o,c]=j.useState("90"),[d,u]=j.useState(!1);j.useEffect(()=>{t!=null&&t.data&&(a(t.data.deadlineCriticalDays||"14"),l(t.data.deadlineWarningDays||"42"),c(t.data.deadlineOkDays||"90"),u(!1))},[t]);const h=G({mutationFn:f=>Xr.update(f),onSuccess:()=>{e.invalidateQueries({queryKey:["app-settings"]}),e.invalidateQueries({queryKey:["contract-cockpit"]}),u(!1)}}),x=()=>{const f=parseInt(r),p=parseInt(i),b=parseInt(o);if(isNaN(f)||isNaN(p)||isNaN(b)){alert("Bitte gültige Zahlen eingeben");return}if(f>=p||p>=b){alert("Die Werte müssen aufsteigend sein: Kritisch < Warnung < OK");return}h.mutate({deadlineCriticalDays:r,deadlineWarningDays:i,deadlineOkDays:o})},m=(f,p)=>{f(p),u(!0)};return n?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx("div",{className:"text-gray-500",children:"Laden..."})}):s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",className:"text-gray-500 hover:text-gray-700",children:s.jsx(Vs,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Mn,{className:"w-6 h-6"}),s.jsx("h1",{className:"text-2xl font-bold",children:"Fristenschwellen"})]})]}),s.jsxs(X,{title:"Farbkodierung für Fristen",children:[s.jsx("p",{className:"text-gray-600 mb-6",children:"Definiere, ab wann Vertragsfristen als kritisch (rot), Warnung (gelb) oder OK (grün) angezeigt werden sollen. Die Werte geben die Anzahl der Tage bis zur Frist an."}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-4 p-4 bg-red-50 border border-red-200 rounded-lg",children:[s.jsx(wn,{className:"w-8 h-8 text-red-500 flex-shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block font-medium text-red-800 mb-1",children:"Kritisch (Rot)"}),s.jsx("p",{className:"text-sm text-red-600 mb-2",children:"Fristen mit weniger als X Tagen werden rot markiert"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(H,{type:"number",min:"1",value:r,onChange:f=>m(a,f.target.value),className:"w-24"}),s.jsx("span",{className:"text-red-700",children:"Tage"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 p-4 bg-yellow-50 border border-yellow-200 rounded-lg",children:[s.jsx(hs,{className:"w-8 h-8 text-yellow-500 flex-shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block font-medium text-yellow-800 mb-1",children:"Warnung (Gelb)"}),s.jsx("p",{className:"text-sm text-yellow-600 mb-2",children:"Fristen mit weniger als X Tagen werden gelb markiert"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(H,{type:"number",min:"1",value:i,onChange:f=>m(l,f.target.value),className:"w-24"}),s.jsx("span",{className:"text-yellow-700",children:"Tage"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 p-4 bg-green-50 border border-green-200 rounded-lg",children:[s.jsx(Ps,{className:"w-8 h-8 text-green-500 flex-shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"block font-medium text-green-800 mb-1",children:"OK (Grün)"}),s.jsx("p",{className:"text-sm text-green-600 mb-2",children:"Fristen mit weniger als X Tagen werden grün markiert (darüber nicht angezeigt)"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(H,{type:"number",min:"1",value:o,onChange:f=>m(c,f.target.value),className:"w-24"}),s.jsx("span",{className:"text-green-700",children:"Tage"})]})]})]})]}),s.jsxs("div",{className:"mt-6 pt-4 border-t flex justify-between items-center",children:[s.jsx("p",{className:"text-sm text-gray-500",children:"Beispiel: Bei 14/42/90 Tagen wird eine Frist die in 10 Tagen abläuft rot, eine in 30 Tagen gelb, und eine in 60 Tagen grün markiert."}),s.jsx(T,{onClick:x,disabled:!d||h.isPending,children:h.isPending?"Speichere...":"Speichern"})]})]})]})}const ZC=[{value:"PLESK",label:"Plesk"},{value:"CPANEL",label:"cPanel"},{value:"DIRECTADMIN",label:"DirectAdmin"}],Bx=[{value:"SSL",label:"SSL/TLS",description:"Verschlüsselung von Anfang an"},{value:"STARTTLS",label:"STARTTLS",description:"Startet unverschlüsselt, dann Upgrade"},{value:"NONE",label:"Keine",description:"Keine Verschlüsselung"}],vd={name:"",type:"PLESK",apiUrl:"",apiKey:"",username:"",password:"",domain:"stressfrei-wechseln.de",defaultForwardEmail:"",imapEncryption:"SSL",smtpEncryption:"SSL",allowSelfSignedCerts:!1,isActive:!0,isDefault:!1};function JC(){const e=Yt(),t=ge(),[n,r]=j.useState(!1),[a,i]=j.useState(null),[l,o]=j.useState(vd),[c,d]=j.useState(!1),[u,h]=j.useState(null),[x,m]=j.useState(!1),[f,p]=j.useState({}),[b,g]=j.useState(null),{data:y,isLoading:v}=fe({queryKey:["email-provider-configs"],queryFn:()=>xn.getConfigs()}),N=G({mutationFn:k=>xn.createConfig(k),onSuccess:()=>{t.invalidateQueries({queryKey:["email-provider-configs"]}),P()}}),E=G({mutationFn:({id:k,data:K})=>xn.updateConfig(k,K),onSuccess:()=>{t.invalidateQueries({queryKey:["email-provider-configs"]}),P()}}),A=G({mutationFn:k=>xn.deleteConfig(k),onSuccess:()=>{t.invalidateQueries({queryKey:["email-provider-configs"]})}}),I=(y==null?void 0:y.data)||[],w=()=>{o(vd),i(null),d(!1),h(null),r(!0)},S=k=>{o({name:k.name,type:k.type,apiUrl:k.apiUrl,apiKey:k.apiKey||"",username:k.username||"",password:"",domain:k.domain,defaultForwardEmail:k.defaultForwardEmail||"",imapEncryption:k.imapEncryption??"SSL",smtpEncryption:k.smtpEncryption??"SSL",allowSelfSignedCerts:k.allowSelfSignedCerts??!1,isActive:k.isActive,isDefault:k.isDefault}),i(k.id),d(!1),h(null),r(!0)},P=()=>{r(!1),i(null),o(vd),d(!1),h(null)},O=async k=>{var K,B,_;g(k.id),p(Q=>({...Q,[k.id]:null}));try{const Q=await xn.testConnection({id:k.id}),le={success:((K=Q.data)==null?void 0:K.success)||!1,message:(B=Q.data)==null?void 0:B.message,error:(_=Q.data)==null?void 0:_.error};p(de=>({...de,[k.id]:le}))}catch(Q){p(le=>({...le,[k.id]:{success:!1,error:Q instanceof Error?Q.message:"Unbekannter Fehler beim Testen"}}))}finally{g(null)}},R=async()=>{var k,K,B;if(!l.apiUrl||!l.domain){h({success:!1,error:"Bitte geben Sie API-URL und Domain ein."});return}m(!0),h(null);try{const _=await xn.testConnection({testData:{type:l.type,apiUrl:l.apiUrl,apiKey:l.apiKey||void 0,username:l.username||void 0,password:l.password||void 0,domain:l.domain}});h({success:((k=_.data)==null?void 0:k.success)||!1,message:(K=_.data)==null?void 0:K.message,error:(B=_.data)==null?void 0:B.error})}catch(_){h({success:!1,error:_ instanceof Error?_.message:"Unbekannter Fehler beim Verbindungstest"})}finally{m(!1)}},q=k=>{k.preventDefault();const K={name:l.name,type:l.type,apiUrl:l.apiUrl,apiKey:l.apiKey,username:l.username,domain:l.domain,defaultForwardEmail:l.defaultForwardEmail,imapEncryption:l.imapEncryption,smtpEncryption:l.smtpEncryption,allowSelfSignedCerts:l.allowSelfSignedCerts,isActive:l.isActive,isDefault:l.isDefault};l.password&&(K.password=l.password),a?E.mutate({id:a,data:K}):N.mutate(K)},D=(k,K)=>{confirm(`Möchten Sie den Provider "${K}" wirklich löschen?`)&&A.mutate(k)},z=k=>k.error?k.error:k.message?k.message:"Verbindung fehlgeschlagen";return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs(T,{variant:"ghost",onClick:()=>e("/settings"),children:[s.jsx(Vs,{className:"w-4 h-4 mr-2"}),"Zurück"]}),s.jsx("h1",{className:"text-2xl font-bold",children:"Email-Provisionierung"})]}),s.jsxs(X,{className:"mb-6",children:[s.jsx("p",{className:"text-gray-600 mb-4",children:'Hier konfigurieren Sie die automatische Erstellung von Stressfrei-Wechseln E-Mail-Adressen. Wenn beim Anlegen einer Stressfrei-Adresse die Option "Bei Provider anlegen" aktiviert ist, wird die E-Mail-Weiterleitung automatisch erstellt.'}),s.jsxs(T,{onClick:w,children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Provider hinzufügen"]})]}),v?s.jsx("div",{className:"text-center py-8",children:"Laden..."}):I.length===0?s.jsx(X,{children:s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Noch keine Email-Provider konfiguriert."})}):s.jsx("div",{className:"space-y-4",children:I.map(k=>{const K=f[k.id],B=b===k.id;return s.jsx(X,{children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"font-semibold text-lg",children:k.name}),s.jsx("span",{className:"px-2 py-1 text-xs rounded bg-blue-100 text-blue-800",children:k.type}),k.isDefault&&s.jsx("span",{className:"px-2 py-1 text-xs rounded bg-green-100 text-green-800",children:"Standard"}),!k.isActive&&s.jsx("span",{className:"px-2 py-1 text-xs rounded bg-gray-100 text-gray-600",children:"Inaktiv"})]}),s.jsxs("dl",{className:"mt-3 grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"API-URL"}),s.jsx("dd",{className:"font-mono text-xs truncate",children:k.apiUrl})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"Domain"}),s.jsx("dd",{children:k.domain})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"Benutzer"}),s.jsx("dd",{children:k.username||"-"})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-gray-500",children:"Standard-Weiterleitung"}),s.jsx("dd",{className:"truncate",children:k.defaultForwardEmail||"-"})]})]}),K&&s.jsx("div",{className:`mt-3 p-3 rounded-lg text-sm ${K.success?"bg-green-50 text-green-800":"bg-red-50 text-red-800"}`,children:K.success?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(xr,{className:"w-4 h-4 flex-shrink-0"}),s.jsx("span",{children:"Verbindung erfolgreich!"})]}):s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(px,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),s.jsx("span",{children:z(K)})]})})]}),s.jsxs("div",{className:"flex gap-2 ml-4",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>O(k),disabled:B,title:"Verbindung testen",children:B?s.jsx("span",{className:"w-4 h-4 border-2 border-gray-400 border-t-transparent rounded-full animate-spin"}):s.jsx(Ea,{className:"w-4 h-4 text-blue-500"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>S(k),children:s.jsx(Je,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>D(k.id,k.name),children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})]})},k.id)})}),n&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsx("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-lg mx-4 max-h-[90vh] overflow-y-auto",children:s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx("h2",{className:"text-xl font-semibold",children:a?"Provider bearbeiten":"Neuer Provider"}),s.jsx("button",{onClick:P,className:"text-gray-400 hover:text-gray-600",children:s.jsx(qt,{className:"w-5 h-5"})})]}),(N.error||E.error)&&s.jsx("div",{className:"mb-4 p-3 rounded-lg bg-red-50 text-red-800 text-sm",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(qt,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),s.jsx("span",{children:N.error instanceof Error?N.error.message:E.error instanceof Error?E.error.message:"Fehler beim Speichern"})]})}),s.jsxs("form",{onSubmit:q,className:"space-y-4",children:[s.jsx(H,{label:"Name *",value:l.name,onChange:k=>o({...l,name:k.target.value}),placeholder:"z.B. Plesk Hauptserver",required:!0}),s.jsx(Ie,{label:"Provider-Typ *",value:l.type,onChange:k=>o({...l,type:k.target.value}),options:ZC}),s.jsx(H,{label:"API-URL *",value:l.apiUrl,onChange:k=>o({...l,apiUrl:k.target.value}),placeholder:"https://server.de:8443",required:!0}),s.jsx(H,{label:"API-Key",value:l.apiKey,onChange:k=>o({...l,apiKey:k.target.value}),placeholder:"Optional - alternativ zu Benutzername/Passwort"}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(H,{label:"Benutzername",value:l.username,onChange:k=>o({...l,username:k.target.value}),placeholder:"admin"}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:a?"Neues Passwort (leer = beibehalten)":"Passwort"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:c?"text":"password",value:l.password,onChange:k=>o({...l,password:k.target.value}),className:"block w-full px-3 py-2 pr-10 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}),s.jsx("button",{type:"button",onClick:()=>d(!c),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-400 hover:text-gray-600",children:c?s.jsx(It,{className:"w-4 h-4"}):s.jsx(Pe,{className:"w-4 h-4"})})]})]})]}),s.jsx(H,{label:"Domain *",value:l.domain,onChange:k=>o({...l,domain:k.target.value}),placeholder:"stressfrei-wechseln.de",required:!0}),s.jsx(H,{label:"Standard-Weiterleitungsadresse",value:l.defaultForwardEmail,onChange:k=>o({...l,defaultForwardEmail:k.target.value}),placeholder:"info@meinefirma.de",type:"email"}),s.jsx("p",{className:"text-xs text-gray-500 -mt-2",children:"Diese E-Mail-Adresse wird zusätzlich zur Kunden-E-Mail als Weiterleitungsziel hinzugefügt."}),s.jsxs("div",{className:"pt-4 border-t",children:[s.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-3",children:"E-Mail-Verbindungseinstellungen"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["IMAP Verschlüsselung",s.jsxs("span",{className:"text-gray-400 font-normal ml-1",children:["(Port ",l.imapEncryption==="SSL"?"993":"143",")"]})]}),s.jsx("select",{value:l.imapEncryption,onChange:k=>o({...l,imapEncryption:k.target.value}),className:"block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm",children:Bx.map(k=>s.jsxs("option",{value:k.value,children:[k.label," - ",k.description]},k.value))})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["SMTP Verschlüsselung",s.jsxs("span",{className:"text-gray-400 font-normal ml-1",children:["(Port ",l.smtpEncryption==="SSL"?"465":l.smtpEncryption==="STARTTLS"?"587":"25",")"]})]}),s.jsx("select",{value:l.smtpEncryption,onChange:k=>o({...l,smtpEncryption:k.target.value}),className:"block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm",children:Bx.map(k=>s.jsxs("option",{value:k.value,children:[k.label," - ",k.description]},k.value))})]})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:l.allowSelfSignedCerts,onChange:k=>o({...l,allowSelfSignedCerts:k.target.checked}),className:"rounded border-gray-300"}),s.jsx("span",{className:"text-sm",children:"Selbstsignierte Zertifikate erlauben"})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"Aktivieren Sie diese Option für Testumgebungen mit selbstsignierten SSL-Zertifikaten."})]})]}),s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:l.isActive,onChange:k=>o({...l,isActive:k.target.checked}),className:"rounded border-gray-300"}),s.jsx("span",{className:"text-sm",children:"Aktiv"})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:l.isDefault,onChange:k=>o({...l,isDefault:k.target.checked}),className:"rounded border-gray-300"}),s.jsx("span",{className:"text-sm",children:"Als Standard verwenden"})]})]}),s.jsxs("div",{className:"pt-4 border-t",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:R,disabled:x,className:"w-full",children:x?"Teste Verbindung...":s.jsxs(s.Fragment,{children:[s.jsx(Ea,{className:"w-4 h-4 mr-2"}),"Verbindung testen"]})}),u&&s.jsx("div",{className:`mt-2 p-3 rounded-lg text-sm ${u.success?"bg-green-50 text-green-800":"bg-red-50 text-red-800"}`,children:u.success?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(xr,{className:"w-4 h-4 flex-shrink-0"}),s.jsx("span",{children:"Verbindung erfolgreich!"})]}):s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(px,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),s.jsx("span",{children:z(u)})]})})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:P,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:N.isPending||E.isPending,children:N.isPending||E.isPending?"Speichern...":"Speichern"})]})]})]})})})]})}function XC(){const[e,t]=j.useState(null),[n,r]=j.useState(null),[a,i]=j.useState(!1),[l,o]=j.useState(""),[c,d]=j.useState(null),u=j.useRef(null),h=ge(),{logout:x}=He(),{data:m,isLoading:f}=fe({queryKey:["backups"],queryFn:()=>br.list()}),p=(m==null?void 0:m.data)||[],b=G({mutationFn:()=>br.create(),onSuccess:()=>{h.invalidateQueries({queryKey:["backups"]})}}),g=G({mutationFn:S=>br.restore(S),onSuccess:()=>{h.invalidateQueries({queryKey:["backups"]}),t(null)}}),y=G({mutationFn:S=>br.delete(S),onSuccess:()=>{h.invalidateQueries({queryKey:["backups"]}),r(null)}}),v=G({mutationFn:S=>br.upload(S),onSuccess:()=>{h.invalidateQueries({queryKey:["backups"]}),d(null),u.current&&(u.current.value="")},onError:S=>{d(S.message||"Upload fehlgeschlagen")}}),N=G({mutationFn:()=>br.factoryReset(),onSuccess:()=>{i(!1),o(""),x()}}),E=S=>{var O;const P=(O=S.target.files)==null?void 0:O[0];if(P){if(!P.name.endsWith(".zip")){d("Nur ZIP-Dateien sind erlaubt");return}d(null),v.mutate(P)}},A=async S=>{const P=localStorage.getItem("token"),O=br.getDownloadUrl(S);try{const R=await fetch(O,{headers:{Authorization:`Bearer ${P}`}});if(!R.ok)throw new Error("Download fehlgeschlagen");const q=await R.blob(),D=window.URL.createObjectURL(q),z=document.createElement("a");z.href=D,z.download=`opencrm-backup-${S}.zip`,document.body.appendChild(z),z.click(),document.body.removeChild(z),window.URL.revokeObjectURL(D)}catch(R){console.error("Download error:",R)}},I=S=>new Date(S).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),w=S=>S<1024?`${S} B`:S<1024*1024?`${(S/1024).toFixed(1)} KB`:`${(S/(1024*1024)).toFixed(1)} MB`;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-lg font-semibold text-gray-900 flex items-center gap-2",children:[s.jsx(Tc,{className:"w-5 h-5"}),"Datenbank & Zurücksetzen"]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Backups erstellen, wiederherstellen oder auf Werkseinstellungen zurücksetzen."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"file",ref:u,accept:".zip",onChange:E,className:"hidden"}),s.jsx(T,{variant:"secondary",onClick:()=>{var S;return(S=u.current)==null?void 0:S.click()},disabled:v.isPending,children:v.isPending?s.jsxs(s.Fragment,{children:[s.jsx(Sr,{className:"w-4 h-4 mr-2 animate-spin"}),"Hochladen..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Vu,{className:"w-4 h-4 mr-2"}),"Backup hochladen"]})}),s.jsx(T,{onClick:()=>b.mutate(),disabled:b.isPending,children:b.isPending?s.jsxs(s.Fragment,{children:[s.jsx(Sr,{className:"w-4 h-4 mr-2 animate-spin"}),"Wird erstellt..."]}):s.jsxs(s.Fragment,{children:[s.jsx(As,{className:"w-4 h-4 mr-2"}),"Neues Backup"]})})]})]}),c&&s.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-red-700",children:c}),s.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[s.jsx("h4",{className:"text-sm font-medium text-blue-800 mb-2",children:"Hinweise zur Datensicherung"}),s.jsxs("ul",{className:"text-sm text-blue-700 space-y-1 list-disc list-inside",children:[s.jsx("li",{children:"Backups enthalten alle Datenbankdaten und hochgeladene Dokumente"}),s.jsx("li",{children:"Erstellen Sie vor Datenbankmigrationen immer ein Backup"}),s.jsx("li",{children:"Backups können als ZIP heruntergeladen und auf einem anderen System wiederhergestellt werden"}),s.jsx("li",{children:"Bei der Wiederherstellung werden bestehende Daten mit dem Backup-Stand überschrieben"})]})]}),s.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 bg-gray-50 border-b border-gray-200",children:s.jsx("h3",{className:"text-sm font-medium text-gray-700",children:"Verfügbare Backups"})}),f?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Sr,{className:"w-6 h-6 animate-spin text-gray-400"})}):p.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(hx,{className:"w-12 h-12 mb-2 opacity-30"}),s.jsx("p",{children:"Keine Backups vorhanden"}),s.jsx("p",{className:"text-sm mt-1",children:"Erstellen Sie Ihr erstes Backup"})]}):s.jsx("div",{className:"divide-y divide-gray-200",children:p.map(S=>s.jsx("div",{className:"p-4 hover:bg-gray-50",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[s.jsx("span",{className:"font-mono text-sm bg-gray-100 px-2 py-1 rounded",children:S.name}),s.jsxs("span",{className:"text-sm text-gray-500 flex items-center gap-1",children:[s.jsx(Mn,{className:"w-4 h-4"}),I(S.timestamp)]})]}),s.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Ke,{className:"w-4 h-4"}),S.totalRecords.toLocaleString("de-DE")," Datensätze"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(hx,{className:"w-4 h-4"}),w(S.sizeBytes)]}),S.hasUploads&&s.jsxs("span",{className:"flex items-center gap-1 text-green-600",children:[s.jsx(F2,{className:"w-4 h-4"}),"Dokumente (",w(S.uploadSizeBytes),")"]})]}),s.jsxs("details",{className:"mt-2",children:[s.jsxs("summary",{className:"text-xs text-gray-500 cursor-pointer hover:text-gray-700",children:["Tabellen anzeigen (",S.tables.filter(P=>P.count>0).length," mit Daten)"]}),s.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:S.tables.filter(P=>P.count>0).map(P=>s.jsxs("span",{className:"text-xs bg-gray-100 px-2 py-0.5 rounded",children:[P.table,": ",P.count]},P.table))})]})]}),s.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>A(S.name),title:"Als ZIP herunterladen",children:s.jsx(C2,{className:"w-4 h-4"})}),s.jsxs(T,{variant:"secondary",size:"sm",onClick:()=>t(S.name),disabled:g.isPending,children:[s.jsx(Vu,{className:"w-4 h-4 mr-1"}),"Wiederherstellen"]}),s.jsx(T,{variant:"danger",size:"sm",onClick:()=>r(S.name),disabled:y.isPending,children:s.jsx(Ne,{className:"w-4 h-4"})})]})]})},S.name))})]}),e&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Backup wiederherstellen?"}),s.jsxs("p",{className:"text-gray-600 mb-4",children:["Möchten Sie das Backup ",s.jsx("strong",{children:e})," wirklich wiederherstellen?"]}),s.jsxs("p",{className:"text-amber-600 text-sm mb-4 bg-amber-50 p-3 rounded-lg",children:[s.jsx("strong",{children:"Achtung:"})," Bestehende Daten und Dokumente werden mit dem Backup-Stand überschrieben. Dies kann nicht rückgängig gemacht werden."]}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:()=>t(null),disabled:g.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"primary",onClick:()=>g.mutate(e),disabled:g.isPending,children:g.isPending?s.jsxs(s.Fragment,{children:[s.jsx(Sr,{className:"w-4 h-4 mr-2 animate-spin"}),"Wird wiederhergestellt..."]}):"Ja, wiederherstellen"})]})]})}),n&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-md mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Backup löschen?"}),s.jsxs("p",{className:"text-gray-600 mb-4",children:["Möchten Sie das Backup ",s.jsx("strong",{children:n})," wirklich löschen? Dies kann nicht rückgängig gemacht werden."]}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:()=>r(null),disabled:y.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:()=>y.mutate(n),disabled:y.isPending,children:y.isPending?"Wird gelöscht...":"Ja, löschen"})]})]})}),s.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 mt-8",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-red-100 rounded-lg",children:s.jsx(hs,{className:"w-6 h-6 text-red-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"text-lg font-semibold text-red-800 mb-2",children:"Werkseinstellungen"}),s.jsxs("p",{className:"text-sm text-red-700 mb-4",children:["Setzt das System auf den Ausgangszustand zurück. ",s.jsx("strong",{children:"Alle Daten werden unwiderruflich gelöscht"})," - Kunden, Verträge, Benutzer, Dokumente und Einstellungen. Nur die hier gespeicherten Backups bleiben erhalten."]}),s.jsxs("ul",{className:"text-sm text-red-700 mb-4 list-disc list-inside space-y-1",children:[s.jsx("li",{children:"Alle Kunden und Verträge werden gelöscht"}),s.jsx("li",{children:"Alle Benutzer werden gelöscht"}),s.jsx("li",{children:"Alle hochgeladenen Dokumente werden gelöscht"}),s.jsx("li",{children:"Ein neuer Admin-Benutzer wird erstellt (admin@admin.com / admin)"}),s.jsxs("li",{children:[s.jsx("strong",{children:"Backups bleiben erhalten"})," und können danach wiederhergestellt werden"]})]}),s.jsxs(T,{variant:"danger",onClick:()=>i(!0),children:[s.jsx(mh,{className:"w-4 h-4 mr-2"}),"Werkseinstellungen"]})]})]})}),a&&s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white rounded-lg shadow-xl p-6 max-w-lg mx-4",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"p-2 bg-red-100 rounded-lg",children:s.jsx(hs,{className:"w-6 h-6 text-red-600"})}),s.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Wirklich auf Werkseinstellungen zurücksetzen?"})]}),s.jsxs("p",{className:"text-gray-600 mb-4",children:["Diese Aktion löscht ",s.jsx("strong",{children:"alle Daten unwiderruflich"}),". Es gibt kein Zurück!"]}),s.jsxs("p",{className:"text-sm text-gray-600 mb-4",children:["Geben Sie zur Bestätigung ",s.jsx("strong",{className:"font-mono bg-gray-100 px-1",children:"LÖSCHEN"})," ein:"]}),s.jsx("input",{type:"text",value:l,onChange:S=>o(S.target.value),placeholder:"LÖSCHEN",className:"w-full px-3 py-2 border border-gray-300 rounded-lg mb-4 focus:ring-2 focus:ring-red-500 focus:border-red-500"}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(T,{variant:"secondary",onClick:()=>{i(!1),o("")},disabled:N.isPending,children:"Abbrechen"}),s.jsx(T,{variant:"danger",onClick:()=>N.mutate(),disabled:l!=="LÖSCHEN"||N.isPending,children:N.isPending?s.jsxs(s.Fragment,{children:[s.jsx(Sr,{className:"w-4 h-4 mr-2 animate-spin"}),"Wird zurückgesetzt..."]}):"Ja, alles löschen"})]})]})})]})}function YC(){var y;const[e,t]=j.useState(""),[n,r]=j.useState(1),[a,i]=j.useState(!1),[l,o]=j.useState(null),c=ge(),{refreshUser:d}=He(),{data:u,isLoading:h}=fe({queryKey:["users",e,n],queryFn:()=>Ri.getAll({search:e||void 0,page:n,limit:20})}),{data:x}=fe({queryKey:["roles"],queryFn:()=>Ri.getRoles()}),m=G({mutationFn:Ri.delete,onSuccess:()=>{c.invalidateQueries({queryKey:["users"]})},onError:v=>{alert((v==null?void 0:v.message)||"Fehler beim Löschen des Benutzers")}}),f=v=>{var N;return(N=v.roles)==null?void 0:N.some(E=>E.name==="Admin")},p=((y=u==null?void 0:u.data)==null?void 0:y.filter(v=>v.isActive&&f(v)).length)||0,b=v=>{o(v),i(!0)},g=()=>{i(!1),o(null)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx(ke,{to:"/settings",children:s.jsx(T,{variant:"ghost",size:"sm",children:s.jsx(Vs,{className:"w-4 h-4"})})}),s.jsx("h1",{className:"text-2xl font-bold flex-1",children:"Benutzer"}),s.jsxs(T,{onClick:()=>i(!0),children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Neuer Benutzer"]})]}),s.jsx(X,{className:"mb-6",children:s.jsxs("div",{className:"flex gap-4",children:[s.jsx("div",{className:"flex-1",children:s.jsx(H,{placeholder:"Suchen...",value:e,onChange:v=>t(v.target.value)})}),s.jsx(T,{variant:"secondary",children:s.jsx(Ml,{className:"w-4 h-4"})})]})}),s.jsxs("div",{className:"mb-6 bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start gap-3",children:[s.jsx(Al,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm text-blue-800",children:[s.jsx("strong",{children:"Hinweis:"})," Bei Änderungen an Rollen oder Berechtigungen wird der betroffene Benutzer automatisch ausgeloggt und muss sich erneut anmelden."]})]}),s.jsx(X,{children:h?s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Laden..."}):u!=null&&u.data&&u.data.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Name"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"E-Mail"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Rollen"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium text-gray-600",children:"Status"}),s.jsx("th",{className:"text-right py-3 px-4 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsx("tbody",{children:u.data.map(v=>{var N;return s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[s.jsxs("td",{className:"py-3 px-4",children:[v.firstName," ",v.lastName]}),s.jsx("td",{className:"py-3 px-4",children:v.email}),s.jsx("td",{className:"py-3 px-4",children:s.jsx("div",{className:"flex gap-1 flex-wrap",children:(N=v.roles)==null?void 0:N.filter(E=>E.name!=="Developer").map(E=>s.jsx(ve,{variant:"info",children:E.name},E.id||E.name))})}),s.jsx("td",{className:"py-3 px-4",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ve,{variant:v.isActive?"success":"danger",children:v.isActive?"Aktiv":"Inaktiv"}),v.hasDeveloperAccess&&s.jsxs(ve,{variant:"warning",className:"flex items-center gap-1",children:[s.jsx(Mc,{className:"w-3 h-3"}),"Dev"]})]})}),s.jsx("td",{className:"py-3 px-4 text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>b(v),children:s.jsx(Je,{className:"w-4 h-4"})}),(()=>{const E=f(v)&&v.isActive&&p<=1;return s.jsx(T,{variant:"ghost",size:"sm",disabled:E,title:E?"Letzter Administrator kann nicht gelöscht werden":void 0,onClick:()=>{confirm("Benutzer wirklich löschen?")&&m.mutate(v.id)},children:s.jsx(Ne,{className:`w-4 h-4 ${E?"text-gray-300":"text-red-500"}`})})})()]})})]},v.id)})})]})}),u.pagination&&u.pagination.totalPages>1&&s.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["Seite ",u.pagination.page," von ",u.pagination.totalPages]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>r(v=>Math.max(1,v-1)),disabled:n===1,children:"Zurück"}),s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>r(v=>v+1),disabled:n>=u.pagination.totalPages,children:"Weiter"})]})]})]}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Keine Benutzer gefunden."})}),s.jsx(e4,{isOpen:a,onClose:g,user:l,roles:(x==null?void 0:x.data)||[],onUserUpdated:d})]})}function e4({isOpen:e,onClose:t,user:n,roles:r,onUserUpdated:a}){const i=ge(),[l,o]=j.useState(null),[c,d]=j.useState({email:"",password:"",firstName:"",lastName:"",roleIds:[],isActive:!0,hasDeveloperAccess:!1});j.useEffect(()=>{var p;e&&(o(null),d(n?{email:n.email,password:"",firstName:n.firstName,lastName:n.lastName,roleIds:((p=n.roles)==null?void 0:p.filter(b=>b.name!=="Developer").map(b=>b.id))||[],isActive:n.isActive??!0,hasDeveloperAccess:n.hasDeveloperAccess??!1}:{email:"",password:"",firstName:"",lastName:"",roleIds:[],isActive:!0,hasDeveloperAccess:!1}))},[e,n]);const u=G({mutationFn:Ri.create,onSuccess:()=>{i.invalidateQueries({queryKey:["users"]}),t()},onError:p=>{o((p==null?void 0:p.message)||"Fehler beim Erstellen des Benutzers")}}),h=G({mutationFn:p=>Ri.update(n.id,p),onSuccess:async()=>{i.invalidateQueries({queryKey:["users"]}),await a(),t()},onError:p=>{o((p==null?void 0:p.message)||"Fehler beim Aktualisieren des Benutzers")}}),x=p=>{if(p.preventDefault(),n){const b={email:c.email,firstName:c.firstName,lastName:c.lastName,roleIds:c.roleIds,isActive:c.isActive,hasDeveloperAccess:c.hasDeveloperAccess};c.password&&(b.password=c.password),h.mutate(b)}else u.mutate({email:c.email,password:c.password,firstName:c.firstName,lastName:c.lastName,roleIds:c.roleIds,hasDeveloperAccess:c.hasDeveloperAccess})},m=p=>{d(b=>({...b,roleIds:b.roleIds.includes(p)?b.roleIds.filter(g=>g!==p):[...b.roleIds,p]}))},f=u.isPending||h.isPending;return s.jsx(Ve,{isOpen:e,onClose:t,title:n?"Benutzer bearbeiten":"Neuer Benutzer",children:s.jsxs("form",{onSubmit:x,className:"space-y-4",children:[l&&s.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3 flex items-start gap-2",children:[s.jsx(hs,{className:"w-5 h-5 text-red-500 flex-shrink-0 mt-0.5"}),s.jsx("p",{className:"text-red-700 text-sm",children:l})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(H,{label:"Vorname *",value:c.firstName,onChange:p=>d({...c,firstName:p.target.value}),required:!0}),s.jsx(H,{label:"Nachname *",value:c.lastName,onChange:p=>d({...c,lastName:p.target.value}),required:!0})]}),s.jsx(H,{label:"E-Mail *",type:"email",value:c.email,onChange:p=>d({...c,email:p.target.value}),required:!0}),s.jsx(H,{label:n?"Neues Passwort (leer = unverändert)":"Passwort *",type:"password",value:c.password,onChange:p=>d({...c,password:p.target.value}),required:!n}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Rollen"}),s.jsxs("div",{className:"space-y-2",children:[r.filter(p=>p.name!=="Developer").map(p=>s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:c.roleIds.includes(p.id),onChange:()=>m(p.id),className:"rounded"}),s.jsx("span",{children:p.name}),p.description&&s.jsxs("span",{className:"text-sm text-gray-500",children:["(",p.description,")"]})]},p.id)),s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:c.hasDeveloperAccess,onChange:p=>d({...c,hasDeveloperAccess:p.target.checked}),className:"rounded border-purple-300 text-purple-600 focus:ring-purple-500"}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Mc,{className:"w-4 h-4 text-purple-600"}),"Entwicklerzugriff"]}),s.jsx("span",{className:"text-sm text-gray-500",children:"(Datenbanktools)"})]})]}),n&&s.jsxs("p",{className:"mt-2 text-xs text-amber-600 flex items-center gap-1",children:[s.jsx(hs,{className:"w-3 h-3"}),"Bei Rollenänderung wird der Benutzer automatisch ausgeloggt."]})]}),n&&s.jsx("div",{className:"space-y-3 pt-3 border-t",children:s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:c.isActive,onChange:p=>d({...c,isActive:p.target.checked}),className:"rounded"}),"Aktiv"]})}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(T,{type:"button",variant:"secondary",onClick:t,children:"Abbrechen"}),s.jsx(T,{type:"submit",disabled:f,children:f?"Speichern...":"Speichern"})]})]})})}function t4(){const{hasPermission:e,developerMode:t,setDeveloperMode:n}=He(),r=[{to:"/settings/users",icon:V2,title:"Benutzer",description:"Verwalten Sie Benutzerkonten, Rollen und Berechtigungen.",show:e("users:read")},{to:"/settings/platforms",icon:U2,title:"Vertriebsplattformen",description:"Verwalten Sie die Plattformen, über die Verträge abgeschlossen werden.",show:e("platforms:read")},{to:"/settings/cancellation-periods",icon:Mn,title:"Kündigungsfristen",description:"Konfigurieren Sie die verfügbaren Kündigungsfristen für Verträge.",show:e("platforms:read")},{to:"/settings/contract-durations",icon:Sv,title:"Vertragslaufzeiten",description:"Konfigurieren Sie die verfügbaren Laufzeiten für Verträge.",show:e("platforms:read")},{to:"/settings/providers",icon:E2,title:"Anbieter & Tarife",description:"Verwalten Sie Anbieter und deren Tarife für Verträge.",show:e("providers:read")||e("platforms:read")},{to:"/settings/contract-categories",icon:T2,title:"Vertragstypen",description:"Konfigurieren Sie die verfügbaren Vertragstypen (Strom, Gas, Mobilfunk, etc.).",show:e("platforms:read")}];return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[s.jsx(Mv,{className:"w-6 h-6"}),s.jsx("h1",{className:"text-2xl font-bold",children:"Einstellungen"})]}),s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-lg font-semibold mb-4 text-gray-700",children:"Stammdaten"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:r.filter(a=>a.show).map(a=>s.jsx(ke,{to:a.to,className:"block p-4 bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md hover:border-blue-300 transition-all group",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors",children:s.jsx(a.icon,{className:"w-6 h-6 text-blue-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("h3",{className:"font-semibold text-gray-900 group-hover:text-blue-600 transition-colors flex items-center gap-2",children:[a.title,s.jsx(Ft,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:a.description})]})]})},a.to))})]}),e("settings:update")&&s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-lg font-semibold mb-4 text-gray-700",children:"System"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(ke,{to:"/settings/portal",className:"block p-4 bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md hover:border-blue-300 transition-all group",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors",children:s.jsx(dh,{className:"w-6 h-6 text-blue-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("h3",{className:"font-semibold text-gray-900 group-hover:text-blue-600 transition-colors flex items-center gap-2",children:["Kundenportal",s.jsx(Ft,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Konfigurieren Sie das Kundenportal und Support-Anfragen."})]})]})}),s.jsx(ke,{to:"/settings/deadlines",className:"block p-4 bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md hover:border-blue-300 transition-all group",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors",children:s.jsx(Mn,{className:"w-6 h-6 text-blue-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("h3",{className:"font-semibold text-gray-900 group-hover:text-blue-600 transition-colors flex items-center gap-2",children:["Fristenschwellen",s.jsx(Ft,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Konfigurieren Sie die Farbkodierung für Vertragsfristen im Cockpit."})]})]})}),s.jsx(ke,{to:"/settings/email-providers",className:"block p-4 bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md hover:border-blue-300 transition-all group",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors",children:s.jsx(nn,{className:"w-6 h-6 text-blue-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("h3",{className:"font-semibold text-gray-900 group-hover:text-blue-600 transition-colors flex items-center gap-2",children:["Email-Provisionierung",s.jsx(Ft,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Konfigurieren Sie die automatische E-Mail-Erstellung für Stressfrei-Wechseln Adressen."})]})]})}),s.jsx(ke,{to:"/settings/database-backup",className:"block p-4 bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md hover:border-blue-300 transition-all group",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors",children:s.jsx(Tc,{className:"w-6 h-6 text-blue-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("h3",{className:"font-semibold text-gray-900 group-hover:text-blue-600 transition-colors flex items-center gap-2",children:["Datenbank & Zurücksetzen",s.jsx(Ft,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Backups erstellen, wiederherstellen oder auf Werkseinstellungen zurücksetzen."})]})]})})]})]}),s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-lg font-semibold mb-4 text-gray-700",children:"Persönlich"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:s.jsx(ke,{to:"/settings/view",className:"block p-4 bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md hover:border-blue-300 transition-all group",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors",children:s.jsx(Pe,{className:"w-6 h-6 text-blue-600"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("h3",{className:"font-semibold text-gray-900 group-hover:text-blue-600 transition-colors flex items-center gap-2",children:["Ansicht",s.jsx(Ft,{className:"w-4 h-4 opacity-0 group-hover:opacity-100 transition-opacity"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Passen Sie die Darstellung der Anwendung an."})]})]})})})]}),e("developer:access")&&s.jsxs(X,{title:"Entwickleroptionen",className:"mb-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Mc,{className:"w-5 h-5 text-gray-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:"Entwicklermodus"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Aktiviert erweiterte Funktionen wie direkten Datenbankzugriff"})]})]}),s.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:t,onChange:a=>n(a.target.checked),className:"sr-only peer"}),s.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"})]})]}),t&&s.jsx("div",{className:"mt-4 p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:s.jsxs("p",{className:"text-sm text-yellow-800",children:[s.jsx("strong",{children:"Warnung:"})," Der Entwicklermodus ermöglicht direkten Zugriff auf die Datenbank. Unsachgemäße Änderungen können zu Datenverlust oder Inkonsistenzen führen."]})})]}),s.jsx(X,{title:"Über",children:s.jsxs("dl",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"Version"}),s.jsx("dd",{children:"1.0.0"})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm text-gray-500",children:"System"}),s.jsx("dd",{children:"OpenCRM"})]})]})})]})}function s4({onSelectTable:e}){const t=j.useRef(null),[n,r]=j.useState(1),[a,i]=j.useState({x:0,y:0}),[l,o]=j.useState(!1),[c,d]=j.useState({x:0,y:0}),[u,h]=j.useState({}),[x,m]=j.useState(null),{data:f,isLoading:p}=fe({queryKey:["developer-schema"],queryFn:ki.getSchema}),b=(f==null?void 0:f.data)||[];j.useEffect(()=>{if(b.length>0&&Object.keys(u).length===0){const w=Math.ceil(Math.sqrt(b.length)),S={x:280,y:200},P={};b.forEach((O,R)=>{const q=R%w,D=Math.floor(R/w);P[O.name]={x:50+q*S.x,y:50+D*S.y}}),h(P)}},[b,u]);const g=j.useCallback(w=>{(w.target===w.currentTarget||w.target.tagName==="svg")&&(o(!0),d({x:w.clientX-a.x,y:w.clientY-a.y}))},[a]),y=j.useCallback(w=>{var S;if(l&&!x)i({x:w.clientX-c.x,y:w.clientY-c.y});else if(x){const P=(S=t.current)==null?void 0:S.getBoundingClientRect();P&&h(O=>({...O,[x]:{x:(w.clientX-P.left-a.x)/n-100,y:(w.clientY-P.top-a.y)/n-20}}))}},[l,x,c,a,n]),v=j.useCallback(()=>{o(!1),m(null)},[]),N=w=>{r(S=>Math.min(2,Math.max(.3,S+w)))},E=()=>{r(1),i({x:0,y:0})},A=j.useCallback(()=>{const w=[];return b.forEach(S=>{const P=u[S.name];P&&S.foreignKeys.forEach(O=>{const R=u[O.targetTable];if(!R)return;const q=b.find(z=>z.name===O.targetTable),D=q==null?void 0:q.relations.find(z=>z.targetTable===S.name);w.push({from:{table:S.name,x:P.x+100,y:P.y+60},to:{table:O.targetTable,x:R.x+100,y:R.y+60},type:(D==null?void 0:D.type)||"one",label:O.field})})}),w},[b,u]);if(p)return s.jsx("div",{className:"flex items-center justify-center h-full",children:"Laden..."});const I=A();return s.jsxs("div",{className:"relative h-full w-full bg-gray-50 overflow-hidden",ref:t,children:[s.jsxs("div",{className:"absolute top-4 right-4 z-10 flex gap-2 bg-white rounded-lg shadow-md p-2",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>N(.1),title:"Vergrößern",children:s.jsx(H2,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>N(-.1),title:"Verkleinern",children:s.jsx(W2,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:E,title:"Zurücksetzen",children:s.jsx($2,{className:"w-4 h-4"})}),s.jsxs("div",{className:"text-xs text-gray-500 flex items-center px-2",children:[Math.round(n*100),"%"]})]}),s.jsxs("div",{className:"absolute top-4 left-4 z-10 bg-white rounded-lg shadow-md p-2 text-xs text-gray-500",children:[s.jsx(_2,{className:"w-3 h-3 inline mr-1"}),"Tabellen ziehen zum Verschieben"]}),s.jsx("svg",{className:"w-full h-full cursor-grab",style:{cursor:l?"grabbing":"grab"},onMouseDown:g,onMouseMove:y,onMouseUp:v,onMouseLeave:v,children:s.jsxs("g",{transform:`translate(${a.x}, ${a.y}) scale(${n})`,children:[s.jsxs("defs",{children:[s.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:"9",refY:"3.5",orient:"auto",children:s.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#6b7280"})}),s.jsx("marker",{id:"many-marker",markerWidth:"12",markerHeight:"12",refX:"6",refY:"6",orient:"auto",children:s.jsx("circle",{cx:"6",cy:"6",r:"3",fill:"#6b7280"})})]}),I.map((w,S)=>{const P=w.to.x-w.from.x,O=w.to.y-w.from.y,R=w.from.x+P/2,q=w.from.y+O/2,D=w.from.x+P*.25,z=w.from.y,k=w.from.x+P*.75,K=w.to.y;return s.jsxs("g",{children:[s.jsx("path",{d:`M ${w.from.x} ${w.from.y} C ${D} ${z}, ${k} ${K}, ${w.to.x} ${w.to.y}`,fill:"none",stroke:"#9ca3af",strokeWidth:"2",markerEnd:"url(#arrowhead)"}),s.jsx("text",{x:R,y:q-8,fontSize:"10",fill:"#6b7280",textAnchor:"middle",className:"select-none",children:w.type==="many"?"1:n":"1:1"})]},S)}),b.map(w=>{const S=u[w.name];if(!S)return null;const P=200,O=32,R=20,q=[...new Set([w.primaryKey,...w.foreignKeys.map(z=>z.field)])],D=O+Math.min(q.length,5)*R+8;return s.jsxs("g",{transform:`translate(${S.x}, ${S.y})`,style:{cursor:"move"},onMouseDown:z=>{z.stopPropagation(),m(w.name)},children:[s.jsx("rect",{x:"3",y:"3",width:P,height:D,rx:"6",fill:"rgba(0,0,0,0.1)"}),s.jsx("rect",{x:"0",y:"0",width:P,height:D,rx:"6",fill:"white",stroke:"#e5e7eb",strokeWidth:"1"}),s.jsx("rect",{x:"0",y:"0",width:P,height:O,rx:"6",fill:"#3b82f6",className:"cursor-pointer",onClick:()=>e==null?void 0:e(w.name)}),s.jsx("rect",{x:"0",y:O-6,width:P,height:"6",fill:"#3b82f6"}),s.jsx("text",{x:P/2,y:"21",fontSize:"13",fontWeight:"bold",fill:"white",textAnchor:"middle",className:"select-none pointer-events-none",children:w.name}),q.slice(0,5).map((z,k)=>{const K=z===w.primaryKey||w.primaryKey.includes(z),B=w.foreignKeys.some(_=>_.field===z);return s.jsx("g",{transform:`translate(8, ${O+4+k*R})`,children:s.jsxs("text",{x:"0",y:"14",fontSize:"11",fill:K?"#dc2626":B?"#2563eb":"#374151",fontFamily:"monospace",className:"select-none",children:[K&&"🔑 ",B&&!K&&"🔗 ",z]})},z)}),q.length>5&&s.jsxs("text",{x:P/2,y:D-4,fontSize:"10",fill:"#9ca3af",textAnchor:"middle",className:"select-none",children:["+",q.length-5," mehr..."]})]},w.name)})]})}),s.jsxs("div",{className:"absolute bottom-4 left-4 bg-white rounded-lg shadow-md p-3 text-xs",children:[s.jsx("div",{className:"font-medium mb-2",children:"Legende"}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-red-600",children:"🔑"}),s.jsx("span",{children:"Primary Key"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-blue-600",children:"🔗"}),s.jsx("span",{children:"Foreign Key"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-0.5 bg-gray-400"}),s.jsx("span",{children:"Beziehung"})]})]})]})]})}function n4(){var I;const[e,t]=j.useState(null),[n,r]=j.useState(1),[a,i]=j.useState(null),[l,o]=j.useState(!1),c=ge(),{data:d,isLoading:u,error:h}=fe({queryKey:["developer-schema"],queryFn:ki.getSchema});console.log("Schema data:",d),console.log("Schema error:",h);const{data:x,isLoading:m}=fe({queryKey:["developer-table",e,n],queryFn:()=>ki.getTableData(e,n),enabled:!!e}),f=G({mutationFn:({tableName:w,id:S,data:P})=>ki.updateRow(w,S,P),onSuccess:()=>{c.invalidateQueries({queryKey:["developer-table",e]}),i(null)},onError:w=>{var S,P;alert(((P=(S=w.response)==null?void 0:S.data)==null?void 0:P.error)||"Fehler beim Speichern")}}),p=G({mutationFn:({tableName:w,id:S})=>ki.deleteRow(w,S),onSuccess:()=>{c.invalidateQueries({queryKey:["developer-table",e]})},onError:w=>{var S,P;alert(((P=(S=w.response)==null?void 0:S.data)==null?void 0:P.error)||"Fehler beim Löschen")}}),b=(d==null?void 0:d.data)||[],g=b.find(w=>w.name===e),y=(w,S)=>S.primaryKey.includes(",")?S.primaryKey.split(",").map(P=>w[P]).join("-"):String(w[S.primaryKey]),v=w=>w==null?"-":typeof w=="boolean"?w?"Ja":"Nein":typeof w=="object"?w instanceof Date||typeof w=="string"&&w.match(/^\d{4}-\d{2}-\d{2}/)?new Date(w).toLocaleString("de-DE"):JSON.stringify(w):String(w),N=()=>{!a||!e||f.mutate({tableName:e,id:a.id,data:a.data})},E=w=>{e&&confirm("Datensatz wirklich löschen?")&&p.mutate({tableName:e,id:w})};if(u)return s.jsx("div",{className:"text-center py-8",children:"Laden..."});const A=w=>{t(w),r(1),o(!1)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Tc,{className:"w-6 h-6"}),s.jsx("h1",{className:"text-2xl font-bold",children:"Datenbankstruktur"})]}),s.jsxs(T,{onClick:()=>o(!0),children:[s.jsx(mx,{className:"w-4 h-4 mr-2"}),"ER-Diagramm"]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[s.jsx(X,{title:"Tabellen",className:"lg:col-span-1",children:s.jsx("div",{className:"space-y-1 max-h-[600px] overflow-y-auto",children:b.map(w=>s.jsxs("button",{onClick:()=>{t(w.name),r(1)},className:`w-full text-left px-3 py-2 rounded-lg flex items-center gap-2 transition-colors ${e===w.name?"bg-blue-100 text-blue-700":"hover:bg-gray-100"}`,children:[s.jsx(q2,{className:"w-4 h-4"}),s.jsx("span",{className:"text-sm font-mono",children:w.name})]},w.name))})}),s.jsx("div",{className:"lg:col-span-3 space-y-6",children:e&&g?s.jsxs(s.Fragment,{children:[s.jsxs(X,{title:`${e} - Beziehungen`,children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium text-gray-500 mb-2",children:"Fremdschlüssel (referenziert)"}),g.foreignKeys.length>0?s.jsx("div",{className:"space-y-1",children:g.foreignKeys.map(w=>s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"font-mono text-gray-600",children:w.field}),s.jsx(Nv,{className:"w-4 h-4 text-gray-400"}),s.jsx(ve,{variant:"info",className:"cursor-pointer",onClick:()=>{t(w.targetTable),r(1)},children:w.targetTable})]},w.field))}):s.jsx("p",{className:"text-sm text-gray-400",children:"Keine"})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium text-gray-500 mb-2",children:"Relationen (wird referenziert von)"}),g.relations.length>0?s.jsx("div",{className:"space-y-1",children:g.relations.map(w=>s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"font-mono text-gray-600",children:w.field}),s.jsx(ve,{variant:w.type==="many"?"warning":"default",children:w.type==="many"?"1:n":"1:1"}),s.jsx(ve,{variant:"info",className:"cursor-pointer",onClick:()=>{t(w.targetTable),r(1)},children:w.targetTable})]},w.field))}):s.jsx("p",{className:"text-sm text-gray-400",children:"Keine"})]})]}),s.jsx("div",{className:"mt-4 pt-4 border-t",children:s.jsxs("div",{className:"flex gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"Primary Key:"})," ",s.jsx("span",{className:"font-mono",children:g.primaryKey})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"Readonly:"})," ",s.jsx("span",{className:"font-mono text-red-600",children:g.readonlyFields.join(", ")||"-"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"Required:"})," ",s.jsx("span",{className:"font-mono text-green-600",children:g.requiredFields.join(", ")||"-"})]})]})})]}),s.jsx(X,{title:`${e} - Daten`,children:m?s.jsx("div",{className:"text-center py-4",children:"Laden..."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b bg-gray-50",children:[(x==null?void 0:x.data)&&x.data.length>0&&Object.keys(x.data[0]).map(w=>s.jsxs("th",{className:"text-left py-2 px-3 font-medium text-gray-600 whitespace-nowrap",children:[w,g.readonlyFields.includes(w)&&s.jsx("span",{className:"ml-1 text-red-400 text-xs",children:"*"}),g.requiredFields.includes(w)&&s.jsx("span",{className:"ml-1 text-green-400 text-xs",children:"!"})]},w)),s.jsx("th",{className:"text-right py-2 px-3 font-medium text-gray-600",children:"Aktionen"})]})}),s.jsxs("tbody",{children:[(I=x==null?void 0:x.data)==null?void 0:I.map(w=>{const S=y(w,g);return s.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[Object.entries(w).map(([P,O])=>s.jsx("td",{className:"py-2 px-3 font-mono text-xs max-w-[200px] truncate",children:v(O)},P)),s.jsx("td",{className:"py-2 px-3 text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex justify-end gap-1",children:[s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>i({id:S,data:{...w}}),children:s.jsx(Je,{className:"w-4 h-4"})}),s.jsx(T,{variant:"ghost",size:"sm",onClick:()=>E(S),children:s.jsx(Ne,{className:"w-4 h-4 text-red-500"})})]})})]},S)}),(!(x!=null&&x.data)||x.data.length===0)&&s.jsx("tr",{children:s.jsx("td",{colSpan:100,className:"py-4 text-center text-gray-500",children:"Keine Daten vorhanden"})})]})]})}),(x==null?void 0:x.pagination)&&x.pagination.totalPages>1&&s.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[s.jsxs("p",{className:"text-sm text-gray-500",children:["Seite ",x.pagination.page," von ",x.pagination.totalPages," (",x.pagination.total," Einträge)"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>r(w=>Math.max(1,w-1)),disabled:n===1,children:s.jsx(A2,{className:"w-4 h-4"})}),s.jsx(T,{variant:"secondary",size:"sm",onClick:()=>r(w=>w+1),disabled:n>=x.pagination.totalPages,children:s.jsx(Ft,{className:"w-4 h-4"})})]})]})]})})]}):s.jsx(X,{children:s.jsx("div",{className:"text-center py-8 text-gray-500",children:"Wähle eine Tabelle aus der Liste aus"})})})]}),s.jsx(Ve,{isOpen:!!a,onClose:()=>i(null),title:`${e} bearbeiten`,children:a&&g&&s.jsxs("div",{className:"space-y-4 max-h-[60vh] overflow-y-auto",children:[Object.entries(a.data).map(([w,S])=>{const P=g.readonlyFields.includes(w),O=g.requiredFields.includes(w);return s.jsxs("div",{children:[s.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[w,P&&s.jsx("span",{className:"ml-1 text-red-400",children:"(readonly)"}),O&&s.jsx("span",{className:"ml-1 text-green-600",children:"*"})]}),P?s.jsx("div",{className:"px-3 py-2 bg-gray-100 rounded-lg font-mono text-sm",children:v(S)}):typeof S=="boolean"?s.jsxs("select",{value:String(a.data[w]),onChange:R=>i({...a,data:{...a.data,[w]:R.target.value==="true"}}),className:"w-full px-3 py-2 border rounded-lg",children:[s.jsx("option",{value:"true",children:"Ja"}),s.jsx("option",{value:"false",children:"Nein"})]}):s.jsx("input",{type:typeof S=="number"?"number":"text",value:a.data[w]??"",onChange:R=>i({...a,data:{...a.data,[w]:typeof S=="number"?R.target.value?Number(R.target.value):null:R.target.value||null}}),className:"w-full px-3 py-2 border rounded-lg font-mono text-sm",disabled:P})]},w)}),s.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[s.jsxs(T,{variant:"secondary",onClick:()=>i(null),children:[s.jsx(qt,{className:"w-4 h-4 mr-2"}),"Abbrechen"]}),s.jsxs(T,{onClick:N,disabled:f.isPending,children:[s.jsx(Av,{className:"w-4 h-4 mr-2"}),f.isPending?"Speichern...":"Speichern"]})]})]})}),l&&s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[s.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>o(!1)}),s.jsxs("div",{className:"relative bg-white rounded-xl shadow-2xl w-[90vw] h-[85vh] flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(mx,{className:"w-5 h-5 text-blue-600"}),s.jsx("h2",{className:"text-lg font-semibold",children:"ER-Diagramm - Datenbankbeziehungen"})]}),s.jsx("button",{onClick:()=>o(!1),className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:s.jsx(qt,{className:"w-5 h-5"})})]}),s.jsx("div",{className:"flex-1 overflow-hidden",children:s.jsx(s4,{onSelectTable:A})})]})]})]})}function r4({children:e}){const{isAuthenticated:t,isLoading:n}=He();return n?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("div",{className:"text-gray-500",children:"Laden..."})}):t?s.jsx(s.Fragment,{children:e}):s.jsx(va,{to:"/login",replace:!0})}function a4({children:e}){const{hasPermission:t,developerMode:n}=He();return!t("developer:access")||!n?s.jsx(va,{to:"/",replace:!0}):s.jsx(s.Fragment,{children:e})}function i4(){const{isAuthenticated:e,isLoading:t}=He();return t?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("div",{className:"text-gray-500",children:"Laden..."})}):s.jsxs(s.Fragment,{children:[s.jsx(N2,{}),s.jsxs(mw,{children:[s.jsx(ze,{path:"/login",element:e?s.jsx(va,{to:"/",replace:!0}):s.jsx(X2,{})}),s.jsxs(ze,{path:"/",element:s.jsx(r4,{children:s.jsx(J2,{})}),children:[s.jsx(ze,{index:!0,element:s.jsx(Y2,{})}),s.jsx(ze,{path:"customers",element:s.jsx(tk,{})}),s.jsx(ze,{path:"customers/new",element:s.jsx(Ix,{})}),s.jsx(ze,{path:"customers/:id",element:s.jsx(ck,{})}),s.jsx(ze,{path:"customers/:id/edit",element:s.jsx(Ix,{})}),s.jsx(ze,{path:"contracts",element:s.jsx(Hk,{})}),s.jsx(ze,{path:"contracts/cockpit",element:s.jsx(CC,{})}),s.jsx(ze,{path:"contracts/new",element:s.jsx(_x,{})}),s.jsx(ze,{path:"contracts/:id",element:s.jsx(xC,{})}),s.jsx(ze,{path:"contracts/:id/edit",element:s.jsx(_x,{})}),s.jsx(ze,{path:"tasks",element:s.jsx(DC,{})}),s.jsx(ze,{path:"settings",element:s.jsx(t4,{})}),s.jsx(ze,{path:"settings/users",element:s.jsx(YC,{})}),s.jsx(ze,{path:"settings/platforms",element:s.jsx(TC,{})}),s.jsx(ze,{path:"settings/cancellation-periods",element:s.jsx(IC,{})}),s.jsx(ze,{path:"settings/contract-durations",element:s.jsx(LC,{})}),s.jsx(ze,{path:"settings/providers",element:s.jsx(zC,{})}),s.jsx(ze,{path:"settings/contract-categories",element:s.jsx(qC,{})}),s.jsx(ze,{path:"settings/view",element:s.jsx(HC,{})}),s.jsx(ze,{path:"settings/portal",element:s.jsx(WC,{})}),s.jsx(ze,{path:"settings/deadlines",element:s.jsx(GC,{})}),s.jsx(ze,{path:"settings/email-providers",element:s.jsx(JC,{})}),s.jsx(ze,{path:"settings/database-backup",element:s.jsx(XC,{})}),s.jsx(ze,{path:"users",element:s.jsx(va,{to:"/settings/users",replace:!0})}),s.jsx(ze,{path:"platforms",element:s.jsx(va,{to:"/settings/platforms",replace:!0})}),s.jsx(ze,{path:"developer/database",element:s.jsx(a4,{children:s.jsx(n4,{})})})]}),s.jsx(ze,{path:"*",element:s.jsx(va,{to:"/",replace:!0})})]})]})}const l4=new Jw({defaultOptions:{queries:{retry:1,staleTime:0,gcTime:0,refetchOnMount:"always"}}});jd.createRoot(document.getElementById("root")).render(s.jsx(Tt.StrictMode,{children:s.jsx(Xw,{client:l4,children:s.jsx(bw,{children:s.jsx(b2,{children:s.jsxs(j2,{children:[s.jsx(i4,{}),s.jsx(q1,{position:"top-right",toastOptions:{duration:4e3,style:{background:"#363636",color:"#fff"},success:{iconTheme:{primary:"#10b981",secondary:"#fff"}},error:{iconTheme:{primary:"#ef4444",secondary:"#fff"}}}})]})})})})})); diff --git a/frontend/dist/assets/index-b8RXSgxB.css b/frontend/dist/assets/index-b8RXSgxB.css new file mode 100644 index 00000000..021dfd72 --- /dev/null +++ b/frontend/dist/assets/index-b8RXSgxB.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.bottom-4{bottom:1rem}.bottom-6{bottom:1.5rem}.left-3{left:.75rem}.left-4{left:1rem}.right-0{right:0}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-0{top:0}.top-1\/2{top:50%}.top-4{top:1rem}.top-full{top:100%}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2 / span 2}.-mx-2{margin-left:-.5rem;margin-right:-.5rem}.-mx-6{margin-left:-1.5rem;margin-right:-1.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-3{margin-top:.75rem;margin-bottom:.75rem}.-mb-6{margin-bottom:-1.5rem}.-mb-px{margin-bottom:-1px}.-ml-1{margin-left:-.25rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-4{margin-right:1rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-0\.5{height:.125rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-8{height:2rem}.h-\[85vh\]{height:85vh}.h-full{height:100%}.max-h-40{max-height:10rem}.max-h-48{max-height:12rem}.max-h-80{max-height:20rem}.max-h-96{max-height:24rem}.max-h-\[600px\]{max-height:600px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[90vh\]{max-height:90vh}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-1\/3{width:33.333333%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-\[90vw\]{width:90vw}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[90px\]{min-width:90px}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-8>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(2rem * var(--tw-space-x-reverse));margin-left:calc(2rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(229 231 235 / var(--tw-divide-opacity, 1))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-l-lg{border-top-left-radius:.5rem;border-bottom-left-radius:.5rem}.rounded-r-lg{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l-0{border-left-width:0px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-amber-300{--tw-border-opacity: 1;border-color:rgb(252 211 77 / var(--tw-border-opacity, 1))}.border-blue-100{--tw-border-opacity: 1;border-color:rgb(219 234 254 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-600{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-400{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-purple-300{--tw-border-opacity: 1;border-color:rgb(216 180 254 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-400{--tw-border-opacity: 1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-600{--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-300{--tw-border-opacity: 1;border-color:rgb(253 224 71 / var(--tw-border-opacity, 1))}.border-l-blue-500{--tw-border-opacity: 1;border-left-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-l-gray-300{--tw-border-opacity: 1;border-left-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-l-gray-400{--tw-border-opacity: 1;border-left-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.border-t-transparent{border-top-color:transparent}.bg-amber-100{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/20{background-color:#0003}.bg-black\/50{background-color:#00000080}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-50\/50{background-color:#f9fafb80}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-orange-100{--tw-bg-opacity: 1;background-color:rgb(255 237 213 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-opacity-50{--tw-bg-opacity: .5}.fill-current{fill:currentColor}.\!p-4{padding:1rem!important}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-3{padding-left:.75rem}.pr-10{padding-right:2.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.line-through{text-decoration-line:line-through}.opacity-0{opacity:0}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-blue-500{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.ring-gray-400{--tw-ring-opacity: 1;--tw-ring-color: rgb(156 163 175 / var(--tw-ring-opacity, 1))}.ring-offset-2{--tw-ring-offset-width: 2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}body{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:h-5:after{content:var(--tw-content);height:1.25rem}.after\:w-5:after{content:var(--tw-content);width:1.25rem}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:border:after{content:var(--tw-content);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.after\:bg-white:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.after\:content-\[\'\'\]:after{--tw-content: "";content:var(--tw-content)}.last\:border-0:last-child{border-width:0px}.last\:border-b-0:last-child{border-bottom-width:0px}.hover\:border-blue-300:hover{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:border-gray-400:hover{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.hover\:bg-amber-200:hover{--tw-bg-opacity: 1;background-color:rgb(253 230 138 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-50:hover{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-800:hover{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.hover\:bg-green-100:hover{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\:bg-opacity-50:hover{--tw-bg-opacity: .5}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:text-blue-800:hover{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.hover\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.hover\:text-green-600:hover{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-600:hover{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-red-500:focus{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.focus\:border-transparent:focus{border-color:transparent}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-gray-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(107 114 128 / var(--tw-ring-opacity, 1))}.focus\:ring-purple-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(168 85 247 / var(--tw-ring-opacity, 1))}.focus\:ring-red-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.group\/subtask:hover .group-hover\/subtask\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.peer:checked~.peer-checked\:bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:after\:translate-x-full:after{content:var(--tw-content);--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:checked~.peer-checked\:after\:border-white:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.peer:focus~.peer-focus\:outline-none{outline:2px solid transparent;outline-offset:2px}.peer:focus~.peer-focus\:ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.peer:focus~.peer-focus\:ring-blue-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity, 1))}@media (min-width: 640px){.sm\:w-auto{width:auto}}@media (min-width: 768px){.md\:col-span-2{grid-column:span 2 / span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-3{grid-column:span 3 / span 3}.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}} diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 615e7818..f2b2f86f 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -5,8 +5,8 @@ OpenCRM - - + +
diff --git a/frontend/src/components/contracts/ContractHistorySection.tsx b/frontend/src/components/contracts/ContractHistorySection.tsx new file mode 100644 index 00000000..a944b7af --- /dev/null +++ b/frontend/src/components/contracts/ContractHistorySection.tsx @@ -0,0 +1,292 @@ +import { useState } from 'react'; +import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; +import { Plus, Edit, Trash2, ChevronDown, ChevronUp, History, Clock, Bot, User } from 'lucide-react'; +import Modal from '../ui/Modal'; +import Button from '../ui/Button'; +import Input from '../ui/Input'; +import Badge from '../ui/Badge'; +import { contractHistoryApi } from '../../services/api'; +import type { ContractHistoryEntry } from '../../types'; + +interface ContractHistorySectionProps { + contractId: number; + canEdit: boolean; +} + +export default function ContractHistorySection({ + contractId, + canEdit, +}: ContractHistorySectionProps) { + const [isExpanded, setIsExpanded] = useState(false); + const [showAddModal, setShowAddModal] = useState(false); + const [editingEntry, setEditingEntry] = useState(null); + const queryClient = useQueryClient(); + + const { data, isLoading } = useQuery({ + queryKey: ['contract-history', contractId], + queryFn: () => contractHistoryApi.getByContract(contractId), + }); + + const deleteEntryMutation = useMutation({ + mutationFn: (entryId: number) => contractHistoryApi.delete(contractId, entryId), + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: ['contract-history', contractId] }); + }, + }); + + const entries = data?.data || []; + + // Sort entries by date (newest first) + const sortedEntries = [...entries].sort( + (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() + ); + + return ( +
+
+
+ +

Vertragshistorie

+ {entries.length} +
+
+ {canEdit && ( + + )} + {entries.length > 0 && ( + + )} +
+
+ + {/* Loading state */} + {isLoading && ( +

Laden...

+ )} + + {/* Collapsed view - show latest entry */} + {!isExpanded && !isLoading && sortedEntries.length > 0 && ( +
+ + {new Date(sortedEntries[0].createdAt).toLocaleString('de-DE', { + day: '2-digit', + month: '2-digit', + year: 'numeric', + hour: '2-digit', + minute: '2-digit', + })} + + {' - '} + {sortedEntries[0].title} +
+ )} + + {/* Expanded view */} + {isExpanded && !isLoading && sortedEntries.length > 0 && ( +
+ {sortedEntries.map((entry) => ( +
+
+
+ + {entry.title} + + {entry.isAutomatic ? ( + + + Auto + + ) : ( + + + Manuell + + )} +
+ {entry.description && ( +

+ {entry.description} +

+ )} +
+ + + {new Date(entry.createdAt).toLocaleString('de-DE', { + day: '2-digit', + month: '2-digit', + year: 'numeric', + hour: '2-digit', + minute: '2-digit', + })} + + von {entry.createdBy} +
+
+ {canEdit && !entry.isAutomatic && ( +
+ + +
+ )} +
+ ))} +
+ )} + + {isExpanded && !isLoading && sortedEntries.length === 0 && ( +

Keine Historie vorhanden.

+ )} + + {/* Add/Edit Modal */} + {(showAddModal || editingEntry) && ( + { + setShowAddModal(false); + setEditingEntry(null); + }} + contractId={contractId} + entry={editingEntry} + /> + )} +
+ ); +} + +// History Entry Modal Component +function HistoryEntryModal({ + isOpen, + onClose, + contractId, + entry, +}: { + isOpen: boolean; + onClose: () => void; + contractId: number; + entry?: ContractHistoryEntry | null; +}) { + const queryClient = useQueryClient(); + const isEditing = !!entry; + + const [formData, setFormData] = useState({ + title: entry?.title || '', + description: entry?.description || '', + }); + const [error, setError] = useState(null); + + const createMutation = useMutation({ + mutationFn: () => + contractHistoryApi.create(contractId, { + title: formData.title, + description: formData.description || undefined, + }), + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: ['contract-history', contractId] }); + onClose(); + }, + onError: (err: Error) => { + setError(err.message); + }, + }); + + const updateMutation = useMutation({ + mutationFn: () => + contractHistoryApi.update(contractId, entry!.id, { + title: formData.title, + description: formData.description || undefined, + }), + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: ['contract-history', contractId] }); + onClose(); + }, + onError: (err: Error) => { + setError(err.message); + }, + }); + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + setError(null); + + if (!formData.title.trim()) { + setError('Titel ist erforderlich'); + return; + } + + if (isEditing) { + updateMutation.mutate(); + } else { + createMutation.mutate(); + } + }; + + const isPending = createMutation.isPending || updateMutation.isPending; + + return ( + +
+ {error && ( +
+ {error} +
+ )} + + setFormData({ ...formData, title: e.target.value })} + placeholder="z.B. kWh auf 18000 erhöht" + required + /> + +
+ +