import Deck from "./entities/Deck" ; import ExcalidrawElement from "./entities/ExcalidrawElement" ; import PrintableArea from "./entities/PrintableArea" ; import Slide from "./entities/Slide" ; const Hash = { deck ( deck ) { return ( Hash . printableArea ( deck . printableArea ) + Hash . excalidrawElements ( deck . commonExcalidrawElements ) + Hash . slides ( deck . slides ) ) ; } , printableArea ( printableArea ) { return 2 * printableArea . width + 3 * printableArea . height ; } , slide ( slide ) { return ( 2 * ( slide . shouldRender ? 3 : 5 ) + 7 * ( slide . shouldRenderWithCommonExcalidrawElements ? 9 : 11 ) + Hash . excalidrawElements ( slide . excalidrawElements ) ) ; } , slides ( slides ) { return slides . reduce ( ( hash , slide , index ) => hash + ( index + 1 ) * Hash . slide ( slide ) , 0 ) ; } , excalidrawElement ( excalidrawElement ) { return excalidrawElement . versionNonce ; } , excalidrawElements ( excalidrawElements ) { return excalidrawElements . reduce ( ( hash , excalidrawElement , index ) => hash + ( index + 1 ) * Hash . excalidrawElement ( excalidrawElement ) , 0 ) ; } , } ; export default Hash ;